We have the following concept we would like to implement S32K3xx
We have SyncTransmit code working using the RTD2.0.0 code but would like to switch to DMA transfers.
Concept:
Use the PIT to periodically transfer 6x16 bit of data on the LPSPI0 module.
We use 16 bit transfers on the SPI bus with a chip select toggle in between to communicate with an ADS7950 ADC.
The RX side then receives the data based on the RXFIFO being full using the RX fifo flags and DMA.
I configured the transfer using some copy pasting of RTD2.0.0 Lpspi code see attachment dma_spi_burst_example.zip Note that this example code uses a software trigger for the time being.
I configured the TCR register for 16 bit transfers on the SPI bus and afterwards.
I let the DMA transfer write into the TDBR register (burst data) on entry TDBR[0] .... TDBR[15].
I masked the RXdata to debug the TX transfers.
As a test I try to transfer this array on the SPI bus
uint16_t lpspi_tx_data[16] = {0x1010, 0x1111, 0x2222, 0x3333,
0x4444, 0x5555, 0x6666, 0x7777,
0x8888, 0x9999, 0xAAAA, 0xBBBB,
0xCCCC, 0xDDDD, 0xEEEE, 0xBEEF};
Issue:
After writing the TCR and writing to the TDBR[0] .... TDBR[15] using DMA.
I only see element 0 up to 4 on the SPI bus and afterwards element 15.
see attachment logic_analyzer_output_spi_transfer.png
Main Question:
-1- So I'm wondering how I can use the TDBR memory map to properly write more then 5 elements on the SPI bus using DMA without the need to use the TX fifo empty flag.
Other Questions:
-a- Do you have some example of using the TDBR to do multiple transfers on the SPI bus
-b- Can you clarify in a diagram what the relation is between the TDBR the TDR and the internal FIFO and how the S32K3xx keeps track of which element of the TDBR has been written on the SPI bus.
(The reference manual is a bit lacking on this point)
Thanks in advance,
Regards Rob van de Voort