I need to connect a BLE112 to a microcontroller (msp430 family) as an spi slave device.
I've configured it using hardware.xml file, setting mode="spi_slave".
Now, how can I read data?
"hardware_spi_transfer" does not fit my need, because it also sends bytes, while I only want to receive. And also, it seems it provides clock generation, which I want to avoid. Infact, I want the device working as slave.
Thanks in advance.
I believe 'hardware_spi_transfer' is to be used when the BLE112 is the master and you want to transfer data from/to a slave that is connected to it. The configuration guide ('usart' section) seems to say that SPI slave functionality is very limited.
You probably need to connect the BLE112 USART pins to the SPI port of the MSP430. Then on the BLE112 you run a BGScript that polls for the SS pin being pulled low by the master. When SS is low write your data to the USART.
Why not just use the USART to transfer the data?
Related
I have four Atmega328p in a single board and I want one of them send the same data (i.e. sensor readings) to the other three simultaneously. I'm not interested in a bidirectional communication. I read this thread (How can I broadcast data to multiple SPI slaves and how it works?) about SPI broadcasting, and someone mentioned not being possible because in SPI communication is full duplex and MISO and MOSI lines are active at the same time. However, I was wondering if I could just let the MISO lines unconnected and all SS pins pulled low, so I could broadcast a message to all slaves simultaneosly, taking into account that I do not need any type of response from the slaves to the master.
So, is this possible? Or how else could I work around this problem? I was also considering on using UART's Tx line and connect all the receivers in parallel to it, but I'm not sure that would work too.
Thanks for your attention.
one micro-controller support all adc dac, spi, uart except I2C, but i want to use i2c communication.How to make i2c port using these protocol?
It would help if you told us which microcontroller you are using, and whether you need your micro to be an I2C master, a slave, or either.
If you just need to an I2C master, and you don't need to worry about other masters on the same bus (arbitration) or very slow slave devices (clock stretching), then I2C is very simple to implement using two GPIO pins. Search for " software i2c master" and you'll find things like I2C Implementation on 8051.
If you need to do arbitration because there may be multiple masters on the bus, or if you need to handle slave clock stretching, then read the I2C specification from Philips NXP. Take the simple code you find through Google and add the functionality you need.
I am working with Arduino yun, and I would like to know how can I access sensor values from one arduino using another arduino. Which ways of comunication they are between arduinos? Can I access data from another arduino through wireless? Do I need additional hardware to accomplish this, or its possible with just two arduinos and one computer?
It is possible. Arduinos, depending on the model, can usually communicate via SPI, I2C, etc. Both Arduinos can send and receive data via SPI, for example, so you can hook them up to each other.
It also depends on the type of sensor data you have as well as how many open pins you have: if you really wanted to, you could set 8 bits of data to 8 different pins, and simply connect those pins to 8 pins on the receiving Arduino. That's a rather barbaric way to do it considering you have SPI at your disposal, though.
There are a couple of ways, without any external hardware you have :
SPI
I2C
Serial communication/UART
Serial is the easiest to use among these 3.
And for any other kind of communication you will require external hardware, so if you want to go wireless, then you have cheap RF modules, XBee, etc..
That said that's more appropriate question for Arduino SE site ;)
Check this page. https://www.arduino.cc/en/Tutorial/MasterWriter
I used the I2C to trigger sound from on one arduino and play it on the other. There was no noticeable delay. If you want to stream a lot of data then SPI should be used.
I will have several devices with atmel microcontrollers which Im going to connect to PC using COM. Is there any way to connect several devices into one COM? (Let's assume COM can handle amounts of data I need to transmit and I can choose the way of sending data using COM)
Sure, chain the ATmegas together via serial, and use a single USB-serial device. Combine all the data you need to send, and send it out of the single serial port. In each ATmega, you can either relay all the data to the next one, or use a little more intelligent scheme and only forward data meant for other ATmegas.
The standard RS232 COM port does not allow to connect several devices to one port. Because parallel connection of several devices may change electrical signal characteristics such as voltage levels. You may build a chain of ATmegas as uint128_t suggested or change the physical interface type to RS485.
RX pins: you can connect more RX pins together.
TX pins: you can connect more TX pins together if you ensure that only one is active at any time. Others pins must be configured as input or high impedance. This can be done with a suitable protocol.
The parasitic capacitances of pins connected together sum up - this can eventually limit the transfer speed.
I have a doubt on SPI slaves.
When we pull up the Chip select line, does it disables the whole Slave ( Functionality ) or just the communication module of the slave.
Taking a Ex:
If we have a SPI ADC. When we Pull up the slave , will it disable the ADC conversion process also or just the SPI lines of the ADC will be disabled but the conversion will still in going on?
I may be wrong, but from the research I did while looking into the SPI bus on AVR MCU's, the SPI hardware in the chip works independently of the AVR core. That is to say, whether or not there is data being transferred on the SPI bus, chip functionality shouldn't be directly affected.
I don't know what electronics you're using, but I would assume that toggling the chip-select has no effect on the core function of your peripherals. When in doubt, reference the datasheet of your slave device. It may have some useful insights on the particular SPI hardware.
I hope this helps.