cancel
Showing results for 
Search instead for 
Did you mean: 

We are facing issue with SPI slave communication for spc560C50L3 controller. The generated code for SPI slave from SPC5studio is not working.

AChan.1
Associate

We have written a register level code to transmit 1 byte and read 1 byte for SPI slave. The observations for the above controller is detailed below.

1. In fifo enabled mode the TxCNT increased when 4 bytes are pushed . We have pushed 'P' + Count++ as 4 bytes whereas count is zero initially.

2. After master provides read for 10 bytes the data received is only 'P' character for all 10 bytes read. The MCU is not pushing next character instead the same character is transmitted. 

3. The TXCNT remains 4 for each byte transfer. The TXNXTPTR does not increment at all. It remains 1

4. The bytes 'PQRS' pushed in fifo can be read from TXFR register but after pushing the 4 byte it does not update with new byte.

5.The fifo does not get clear. It only transmits 1byte every time the master initaites a read request for 10 byte continuous read.

6.At master we only receive same character as 'P' for 10 bytes continueous read. It should be PQRSTUVWXY as per the logic.

Below is the complete code snippet written for spi slave. Please guide & suggest a solution if we are missing anything. Please share a working code as the generated code is not working.

PFA code and log for more details. Please refer.

Regards,

Ankit Channa

This discussion has been locked for participation. If you have a question, please start a new topic in order to ask your question
5 REPLIES 5
Erwan YVIN
ST Employee

Hello ,

i have submitted an ER/CR for this topic.

Best regards

Erwan

AChan.1
Associate

Hello Erwan,

Thank you for the reply.

Could you please connect us to concerned tachnical person to discuss and resolve this issue? Is SPI slave tested for this microcontroller?

Regards,

Ankit Channa

MShai.2
Associate

Hi Erwan,

Any further update on SPI slave issue.

Regards

Mohammad Rafi

zambrano.luigi
Senior III

Hi Mohammad,

sorry for the delay. In attachment you can find an SPC5Studio project developed for a SPC560B50L5 (same family of your core SPC560C50L3) that shows how to use the DSPI low level driver integrated in SPC5Studio to transmit a buffer between a master and a slave. In this project the DSPI1 is used as MASTER and the DSPI2 is used as SLAVE. it is possible to test the following 2 cases:

1. MASTER transmitter - SLAVE receiver, if MASTER_TRANSMITTER = TRUE

2. SLAVE transmitter - MASTER receiver, if MASTER_TRANSMITTER = FALSE

In both cases a buffer of 10 bytes is transmitted and the test verifies that the received buffer is equal to the transmitted buffer. If the test passes, LED1 and LED2 will blink simultaneously. If test fails, the LED3 will blink. In order to connect the DSPI1 and the DSPI2 in loop-back, the following connections are required:

PJ6[6] - PJ6[13]

PJ6[3] - PJ6[15]

PJ6[5] - PJ6[14]

PJ6[4] - PJ6[16]

Please, let me know if this example is enough to clarify the DSPI behavior.

Best Regards,

Luigi

MShai.2
Associate

Dear Luigi,

Thanks for your feedback. We will check and confirm back.

with regards

Rafi