2010-03-25 11:33 PM
Communication between 2 STM32 via SPI
2011-05-17 04:44 AM
Remember that SPI is not like a full duplex asynchronous UART. The slave (B) device doesn't have an independent data clock for its transmitter. In order for the (B) STM32 to send data the master (A) device must send dummy data to generate the data clocks to shift bits out of the SPI buffer on (B).
The alternative is that (A) and (B) use some kind of protocol to reverse roles, where the (B) STM32 reconfigures for master and (A) as slave, expecting data from (B). Jack Peacock2011-05-17 04:44 AM
Thanks for reply,
I had allready try to send data from slave to master while master sending data. But in this case only slave can receive data from master but master can't receive data from slave. And whatever data slave receive from master is save in Address + 1. so, data not save in proper lacation. I had also try to send and receive data using DMA.I had configure SPI on DMA. But in this case also same problem. Can anyone help me what to write in Master and what to write in slave for data Exchanging between 2 Controllers(STM32F103)?2011-05-17 04:44 AM
Alternatively, the slave can use the clock while it's receiving to be transmitting at the same time...
2011-05-17 04:44 AM
I think you are trying to do too many things all at once here!
I suggest that you start by just getting an SPI master working and talking to some standard SPI slave chip. Once you know that you have a working master, then move on to making the slave. What test equipment do you have? You really need a storage oscilloscope at the very least. Some 'scopes & logic analysers have built-in SPI decoding. Or get a specific SPI analyser; eg:2011-05-17 04:44 AM
No i am not doing much thing at a time.
I am just sending a array of 20 bytes from master to slave and want to receive 20 bytes from slave.I am receiving 20 bytes from master to slave but i can't receive bytes from slave to master.I had also check the Waveform on Oscilloscope it shows data flow towards slave from master but i can't see data flow from slave to master. I don't know how data can be send to Slave. I had check SPI as a master with ADC,DAC and EEPROM it is working OK.2011-05-17 04:44 AM
Hello
I had solved problem. Now, i can read and write from/to master/slave. But now one probelm occure during reading slave. Data from slave not comes continously. It receive data for 1 cycle and for next 4-5 cycles it sends 0's. Please tell me the solution. I am doing this by making one pin Low in master and this low pin, interrupt slave and slave starts sending and receiving data.From: panchal.jayesh
Posted: Saturday, March 27, 2010 12:09 PMSubject: Communication between 2 STM32 via SPINo i am not doing much thing at a time.
I am just sending a array of 20 bytes from master to slave and want to receive 20 bytes from slave.I am receiving 20 bytes from master to slave but i can't receive bytes from slave to master.I had also check the Waveform on Oscilloscope it shows data flow towards slave from master but i can't see data flow from slave to master. I don't know how data can be send to Slave. I had check SPI as a master with ADC,DAC and EEPROM it is working OK.2011-05-17 04:44 AM