I have been beating my head against the wall for several days trying to figure out what could be going wrong with my SPI bus communication. I use a single bus to talk with two different devices. Device A uses an 8-bit data width, and device B uses 16-bit data width.
If I never talk with device B, the communication with device A works fine. But if I talk to device B and then switch to device A. I get an odd behavior.
I am using a Beagle SPI bus sniffer to examine the data that is being transferred between the Tiva and device A. When I send a command code of 0xB0 to device A, the sniffer shows that one byte containing the proper value is being transmitted. If, however, I talk with device B first, when I reconfigure the SPI to 8-bit mode and send the 0xB0 to device A, the sniffer indicates that 2 bytes were sent -- 0x58 and 0x00. It is interesting that 0x58 is 0xB0 shifted right by one bit. The sniffer also flags a "partial last byte" error for the transaction. Subsequent transactions seem to be okay.
I checked the contents of the SSI registers just prior to transmission in both cases (before talking to device B and after), and they are identical:
SSI_CR0 0x000013C7 SSI Control 0 [Memory Mapped]
SSI_CR0_SCR 00010011 SSI Serial Clock Rate
SSI_CR0_SPH 1 SSI Serial Clock Phase
SSI_CR0_SPO 1 SSI Serial Clock Polarity
SSI_CR0_FRF 00 - SSI Frame Format Select
SSI_CR0_DSS 0111 - SSI Data Size Select
SSI_CR1 0x00000000 SSI Control 1 [Memory Mapped]
SSI_CR1_EOM 0 Stop Frame (End of Message)
SSI_CR1_FSSHLDFRM 0 FSS Hold Frame
SSI_CR1_HSCLKEN 0 High Speed Clock Enable
SSI_CR1_DIR 0 SSI Direction of Operation
SSI_CR1_MODE 00 - SSI Mode
SSI_CR1_EOT 0 End of Transmission
SSI_CR1_MS 0 SSI Master/Slave Select
SSI_CR1_SSE 0 SSI Synchronous Serial Port Enable
SSI_CR1_LBM 0 SSI Loopback Mode
SSI_DR 0x00000000 SSI Data [Memory Mapped]
SSI_SR 0x00000003 SSI Status [Memory Mapped]
SSI_SR_BSY 0 SSI Busy Bit
SSI_SR_RFF 0 SSI Receive FIFO Full
SSI_SR_RNE 0 SSI Receive FIFO Not Empty
SSI_SR_TNF 1 SSI Transmit FIFO Not Full
SSI_SR_TFE 1 SSI Transmit FIFO Empty
SSI_CPSR 0x00000002 SSI Clock Prescale [Memory Mapped]
SSI_IM 0x00000000 SSI Interrupt Mask [Memory Mapped]
SSI_RIS 0x00000048 SSI Raw Interrupt Status [Memory Mapped]
SSI_MIS 0x00000000 SSI Masked Interrupt Status [Memory Mapped]
SSI_ICR 0x00000000 SSI Interrupt Clear [Memory Mapped]
SSI_DMACTL 0x00000000 SSI DMA Control [Memory Mapped]
SSI_PP 0x0000000D SSI Peripheral Properties [Memory Mapped]
SSI_CC 0x00000000 SSI Clock Configuration [Memory Mapped]
Do you have any idea how, given that the SSI registers are the same in both cases, different behaviors are observed? And is there anything you can suggest I look at for more clues, or any possible workaround for this problem?
Regards,
Dave