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.
Pardon the newbie question.. I'm trying to send out a 16-bit SPI command via the USCI via two 8-bit writes, but the slave device keeps telling me it didn't get 16 bits of data. I'm sure I'm doing something wrong.. my code:
SetSPISlaveSelect(DevAddr); // Chip Select off USCI_A_SPI_transmitData(SPI_BASE, *(pBuf)); while(USCI_A_SPI_isBusy(SPI_BASE)) ; pDummy[0] = USCI_A_SPI_receiveData(SPI_BASE); USCI_A_SPI_transmitData(SPI_BASE, *(pBuf+1)); while(USCI_A_SPI_isBusy(SPI_BASE)) ; pDummy[1] = USCI_A_SPI_receiveData(SPI_BASE); SetSPISlaveSelect(SPI_SLAVE_NONE); // Chip Select OFF nFoo = (pDummy[0] << 8) | pDummy[1];
.. I can see a brief burst on my scope, but the scope is super-cheap and I can't see the individual pulses. The USCI is in 8-bit mode so it's not just sending out 14 bits.
Am I doing something wrong here?
All help appreciated!
Ed Averill
Those functions are in the MSP430Ware library from TI.. it just pumps out a byte.
I discovered that by doing back-to-back writes with chip select active, my slave device will process it as a 16-bit command despite the delay between clocked-out data.
No wonder. In a synchronous transfer like SPI or I2C, there is no difference between a gap or just a slower clock speed (down to 0Hz). This is why the chip select signal is used to synchronize transfers to byte borders or even high-level protocol borders.
**Attention** This is a public forum