cancel
Showing results for 
Search instead for 
Did you mean: 

Problem of SPI slave transmit

Sangkyu Kim
Associate II

I testing SPI using two STM32F411 disco.

One is master, the other is slave.

My problem is only work MOSI , MISO is not working.

I attach my Two source code.

This is setting of my disco board.

Do you have any idea about error of Slave transmit of SPI?

0690X0000087YD0QAM.jpg

4 REPLIES 4
Mike_ST
ST Employee

On picture, I don't see ground connection between boards.

I only see SCK/MOSI/MISO.

supply of power at same usb hub.

So, GND connected by usb mini cable.

Mike_ST
ST Employee

Anyways, I recommend connecting ground between boards.

Please check MISO/MOSI signals on scope.

And configure a NSS pin on Slave and connect it to ground.

S.Ma
Principal

connect NSS as well. Match MISO and MOSI on both side. Use SPI 8 bit mode. NSS by SW (choose the GPIO). Use NSS GPIO EXTI interrupt to get event when NSS goes low and high (beginning transmit and process received message). Allow small delay after changing NSS for slave EXTI interrupt to complete before data is being transited.

Use 4 wire bidirectional mode to get started. For slave, I recommend to use DMA in cyclic buffer mode (both TX and RX)