Greetings,
I have been trying to implement a SPI slave on the TMS570LS0432 launchpad and am unable to observe an RXBUF full interrupt when the transmit shift register has no data in it.
Driver code is configured with HALCoGen on SPI3 with FreeRTOS. The HALCoGen function 'spiSendData' correctly stages data in the TXBUF and transmit shift register(s). 'spiSendAndGetData' sends and receives data as long as the transmit shift register has data. However, the interrupt stops occurring once the transmit data has been shifted out, even if all staged receive data has not been received by the slave. For this reason, 'spiGetData' does not ever generate the RXFUL interrupt. If I pre-load the tx shift register with a dummy word, receive interrupts are generated and everything works as expected, but since the txempty interrupt occurs when TXBUF is empty as well as when the shift register is empty, this method requires transmitting a least 2 dummy words on every data exchange with the master.
I've tested the same scenario bare metal, without freeRTOS and have the same results.
Any help would be appreciated. The example code for spi master slave floating around only works for one exchange.
static void prvSpi3RxTask(void *pvParameters) { uint16_t tx_word = 0x1234; uint16_t rx_word = 0x0000; spiDAT1_t dataconfig3_t; dataconfig3_t.CS_HOLD = FALSE; dataconfig3_t.WDEL = TRUE; dataconfig3_t.DFSEL = SPI_FMT_0; dataconfig3_t.CSNR = 0xfe; //spiSendData(spiREG3, &dataconfig3_t, 1, &tx_word); for (;;) { /**/ // initiate SPI3 transmit receive through interrupt mode if (g_release_spi3) { g_release_spi3 = 0; spiSendAndGetData(spiREG3, &dataconfig3_t, 1, &tx_word, &rx_word); } } }
note, 'g_release_spi3' is a global variable that is set in 'spiEndNotification' once all data has been transmitted and received.
My test setup is two tms570ls0432 launchpads, one configured as master and programmed to send and receive one word of data on a button press, the other configured as a slave.