This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
We are trying to send multiple words over an SPI interface using TMS570LS20216 MCU. In C language, we set the CSHOLD bit of DAT1 register separately, and then write the TXDATA field afterwards.
We have inspected the assembler instructions used to set the CSHOLD bit. In the C code, we have defined the register fields as C struct bit fields. The C compiler (Keil uVision 4.54.0.0) generates STRB (store byte) instructions to modify only the byte of interest within the DAT1 register.
We observe that when a STRB instruction is executed to store the high order byte of the DAT1 register with the CSHOLD bit set to 0, the nCS line IMMEDIATELY transitions from low to high, thus ending the SPI transaction. We also observe that when CSHOLD is set to 1 using the same method, the nCS line IMMEDIATELY transitions to low rather than waiting until the transmission. In both these cases, the low-order 16 bits of DAT1 (the TXDATA field) is untouched. This is further proved by the fact that no clock is generated when modifying the CSHOLD bit alone. The clock is generated when the TXDATA field written using a STRH (store have word) instruction.
After reading the datasheet, we would have expected the nCS line to change (or not) AFTER the next transaction, not immediately upon setting or clearing CSHOLD. Is this an error in the silicon? It is perhaps a bit unclear from the datasheet whether this is supported.
Hello Allen,
I have received your question and I am looking into it. I should have an answer for you early next week.
Hello Allen:
The behavior you describe in your post is per design. The CSHOLD bit has direct influence on the CS pin so any change will be immediate. The recommended use is to write the control byte at the same time the data is written.
Hi Chuck,
Thanks for the info. The behaviour you describe is not clear from the datasheet. Perhaps something should be added to the datasheet to describe this behaviour. After reading the datasheet, I thought the nCS pin would be unaffected until after TXDAT was written and the word was completely transmitted, regardless of when CSHOLD was modified.
Allen
Thanks Allen,
The input is valid and noted. I have forwarded it to our TRM author for consideration. Thanks again for bringing this to our attention.