Skip to main content
Associate III
June 12, 2022
Question

Configuration in spi slave mode

  • June 12, 2022
  • 2 replies
  • 1222 views

Hello.

I'm working with spc560p and I want to enable it's spi slave mode​. All connections are OK but the slave is not working. My code is:

for(;;){

spi_lld_start(...)​;

spi_lld_receive(​...,Rxbuf);

spi_lld_stop(...);

if(RXbuf == 0xAA){

pal_togglepad;​

}​

}

Is there any problem with this code?

Thanks for your attention.

This topic has been closed for replies.

2 replies

Erwan YVIN
ST Employee
June 17, 2022

Hello ,

I would recommend to use :

spi_lld_exchange(&SPID1, 512, txbuf, rxbuf);

Could you check your assembler code generated by the compiler ?

Other clue is to put a protocol Analyser to check if SPI Frame is well received.

Best regards

Erwan

DNewm.1Author
Associate III
June 19, 2022

Hello.

In slave mode, ​I just want to read buffers and no sending. With this command I should send something then receive my buffer!

I checked with logic analyzer and master is OK. But my slave is not working. Is there any other ways to receive just rxbuf, how about receive interrupt?

​Thanks