SSC start/end of frame control

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
User8819
Level 4
Level 4
Hello,

I am using SSC with FIFO for full duplex communication. I would like to use control of slave select signal by TCI, TCSR.SELMD=1. By writing into IN[1] I would expect SEL0 to go LOW (SELINV=1) and as a last transmission I write to IN[0] to deactivate SEL0 (in mode SCTR_FLE=63). I was not able to make it work. Are there any examples available describing usage of FIFO together with TCI for Slave select control? Examples available seem do not cover such case.
Can anyone help?

rum
0 Likes
3 Replies
chismo
Employee
Employee
First like received
Hello,

The intended usage for the slave select mode of TCI (SELMD=1) is a bit different.
The use case is for a SPI master that needs to communicate to several slaves.

For example, assume a master (XMC_SPI0_CH1) needs to send byte0 to slave0 and byte1 to slave1.
With SELMD=1, the sequence would be:

/* select SELO0 */
XMC_SPI0_CH1->IN[1] = byte0;
/* select SELO1 */
XMC_SPI0_CH1->IN[2] = byte1;


For your purpose to toggle the slave select line with TCI, the correct mode should be word length control mode (WLEMD=1).
Here, the bit TCI[4] is used to indicate that the current word is the last word of the frame and after which, the slave select line will be deasserted.
The LSB 4 bits TCI[3:0] are used to control the word length but for your case, always the same word length is used.
For example, assuming WLE = 7 (8-bit words) and byte3 is the last word:

XMC_SPI0_CH1->IN[7] = byte0;
XMC_SPI0_CH1->IN[7] = byte1;
XMC_SPI0_CH1->IN[7] = byte2;
/* TCI[4] = 1 to select End-of-Frame (EOF) */
XMC_SPI0_CH1->IN[23] = byte3;


Two points to take note when using WLEMD:
1) All other TCI modes must be 0
2) PCR.FEM bit must be 1, otherwise an EOF is generated whenever the buffer runs out of data to be sent

Regards,
Min Wei
0 Likes
User8819
Level 4
Level 4
Hello chismo,

thanks for explanation, this is much better than cryptic manual description.

One more question, if I have FLE=63, WLE=8, FEM=1, WLEMD=1 and write just one XMC_SPI0_CH1->IN[23] = byte; will the SELO0 output go down and up just for this one byte?
I am asking this just to avoid reconfiguring SPI in case I need to send just one byte (in scenario where I need to change number of send bytes frequently).

rum
0 Likes
chismo
Employee
Employee
First like received
Hello rum,

Yes, in this case a frame of only 1 byte will be transmitted. The SELO0 output gets asserted to transmit the byte and deasserted at the end of the transmission as you expected.

Regards,
Min Wei
0 Likes