SWCU193 April 2023 CC2340R2 , CC2340R5 , CC2340R5-Q1
When using the Motorola 3-wire frame format with the SPI.CTL0[3:0] DSS bit field programmed for 8 bits, the SPI.CTL1[11] CDEN bit can be set to use the CS line as a signal to distinguish between Command and Data information. This is often used for LCD or data storage devices.
The SPI.CTL1[15:12] CDMODE bit field can be written with a value of 1-14 to specify the number of bytes the CS line is set low for, starting with the next value to be transmitted. After the number of bytes are transmitted, CS is set high automatically. If a value of 0xF is set, CS stays low permanently. A value of 0 sets the CS line to high immediately after the current data byte has been transmitted.
This option is only available in controller mode. The SPI.CTL1[11] CDEN bit can only be updated when the SPI module is disabled. SPI.CTL1[15:12] CDMODE can be updated between the different data packages. The counter is reset with CDEN or SPI ENABLE set to disabled. Before setting a new value in CTL1.CDMODE, check that the FIFO is empty and that SPI is in idle mode (SPI.STA[4] BUSY bit is cleared to 0).
When writing a new value into the SPI.CTL1[15:12] CDMODE bit field, the internal counter is reset and the new value is used for counting. If the counter counts down to 0 and another command package is sent, the CDMODE needs to be set again. Otherwise the next frames are sent as data with the CS pin signaling data mode.