cancel
Showing results for 
Search instead for 
Did you mean: 

SPI Master-Slave Communication

SKAMILCELEBI
Associate

Hello,

I want to communicate with SPI between STM32F7 and Texas DSP devices. STM32F7 is the master device and Texas DSP is the slave device. I am sending data from STM32F7 master device to Texas DSP slave device. But I can not send data from slave device to master device.

How can i solve this problem?

Sinan,

Thanks and best regards.

4 REPLIES 4
S.Ma
Principal

Check for some cube nucleo example of spi master. If the spi bus is 4 wires, every transmit is also a receive.

TDK
Guru

SPI is a master-slave system. In order to pass information backwards, the master needs to send a clock and the slave sends out data on MISO, which the master reads.

https://en.wikipedia.org/wiki/Serial_Peripheral_Interface

If you feel a post has answered your question, please click "Accept as Solution".
SKAMILCELEBI
Associate

Hi,

My Master STM32 is successfully sending data to the Slave DSP device. Slave DSP device is also sending data to Master STM32 device. However, the Master device is not receiving the correct data from the slave device. For example, the slave device sends 0xABCD data to the master device and the master device receives this data as 0xD5E6.

Sinan,

Thanks.

TDK
Guru

> slave device sends 0xABCD data to the master device and the master device receives this data as 0xD5E6.

Looks like you're off by one bit, which means the master and slave are not synchronized. The CS line is used to do this. Keep it high when idle, set it low just before the transfer and back high again after the transfer.

Edit: having mispatched CPOL/CPHA settings can also cause this.

If you feel a post has answered your question, please click "Accept as Solution".