With the USIC, the data word length settings can be dynamically changed with each write to the transmit buffer input location TBUFx, or if TXFIFO is enabled, to the TXFIFO buffer input location INx.
This is by making use of the Transmit Control Information (TCI) mode for word length control, which can be enabled by setting the bit field TCSR.WLEMD to 1.
Additionally for SSC protocol, the end of frame condition can also be controlled in this mode.
Depending on the input location (from TBUF[0] to TBUF[31]) being written to, a corresponding 5-bit TCI code will be generated.
For example, writing to TBUF[1] generates a TCI code of 00001b.
With WLEMD=1, a write to the buffer input location has the following effect:
- The word length bit field SCTR.WLE will be overwritten by TCI[3:0]
- The EOF bit TCSR.EOF will be overwritten by TCI[4]
To illustrate with a simple example, assume the application is sending a 12-bit SPI frame via two consecutive words (one 8-bit word and one 4-bit word) and needs to generate an EOF condition at the end of the frame. In this case, only the following is needed:
Attached is the main.c file for the running simple example:
Attachment 1995
This is by making use of the Transmit Control Information (TCI) mode for word length control, which can be enabled by setting the bit field TCSR.WLEMD to 1.
Additionally for SSC protocol, the end of frame condition can also be controlled in this mode.
Depending on the input location (from TBUF[0] to TBUF[31]) being written to, a corresponding 5-bit TCI code will be generated.
For example, writing to TBUF[1] generates a TCI code of 00001b.
With WLEMD=1, a write to the buffer input location has the following effect:
- The word length bit field SCTR.WLE will be overwritten by TCI[3:0]
- The EOF bit TCSR.EOF will be overwritten by TCI[4]
To illustrate with a simple example, assume the application is sending a 12-bit SPI frame via two consecutive words (one 8-bit word and one 4-bit word) and needs to generate an EOF condition at the end of the frame. In this case, only the following is needed:
Code:
/* 12-bit frame containing 0x555 */
XMC_SPI0_CH1->IN[7] = 0x55;
XMC_SPI0_CH1->IN[19] = 0x05;
Attachment 1995