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.
Hi,
I'm running into a problem where the SPIRXBUF reads out whatever is in the SPITXBUF. If the loopback function was turned on, I'd expect this -- but I have it turned off.
Here's my SPI transmission function.
void spiTxRx(uint8_t * pau8_txData,
uint8_t * pau8_rxData,
uint8_t u8_numBytes,
uint8_t u8_spiModule,
uint8_t u8_chipSelect)
{
changeCS(u8_chipSelect, CHIP_SELECT_LOW); //set chip select low
uint8_t u8_i = 0;
if (u8_spiModule == SPI_MODULE_A_TX)
{
for (u8_i = 0; u8_i<u8_numBytes; u8_i++)
{
SpiaRegs.SPITXBUF= *(pau8_txData + u8_i);
// Wait until data is received
while(SpiaRegs.SPIFFRX.bit.RXFFST !=1) { }
*(pau8_rxData + u8_i) = (SpiaRegs.SPIRXBUF) >> 8;
}
}
if (u8_spiModule == SPI_MODULE_B_TX)
{
for (u8_i = 0; u8_i<u8_numBytes; u8_i++)
{
SpibRegs.SPITXBUF= *(pau8_txData + u8_i);
// Wait until data is received
while(SpibRegs.SPIFFRX.bit.RXFFST !=1) { }
// Check against sent data
*(pau8_rxData + u8_i) = SpibRegs.SPIRXBUF;
}
}
changeCS(u8_chipSelect, CHIP_SELECT_HIGH); //raise chip select now that we're done transmitting
return;
}
I've attached a screenshot of the SPI B registers that shows the loopback when I'm transmitting SPI. From SPICCR, you can see that bit 4 is 0, so the loopback is disabled.
I've tested this out on both A and B SPI ports on both a dev board (LAUNCHXL-F28069) and a custom PCB with the TMS320F28069 on it and got the same results.
Thanks in advance,
Karen
Karen,
I am seeing the same behavior as you. I have actually never seen this behavior before. It seems to be dependent on the configured word length.
Edit: removed an incorrect statement.
The code will not hang at the while loop, but RXBUF will always read as 0xFFFF if configured as 16-bit words.
Thanks,
Mark