I'm using a S32K344 EVB and trying to setup the DMA to transfer from the LPSPI RX buffer, but not using the PIT-based trigger. I am sending 1 command word to a sensor and receiving back at least 2 words of data, and I want to have these automatically transferred to memory whenever the transaction takes place (not periodically).
My understanding on how to enable DMA transfers from reading the Reference Manual:
- Receive Data DMA Enable (LPSPI DER)
- DMAMUX enabled with correct source (46 for LPSPI1)
- TCD set with proper source and destination addresses, offset, etc.
- Enable DMA Request (TCD_CH0_CSR, ERQ bit)
I'm assuming the LPSPI Status Register, (RDF bit) is the peripheral trigger to the DMAMUX, and that routes the request to the eDMA Engine, and this is what kicks off the data transfer. Is that correct? Is there any software intervention required, like an ISR needed to clear any flags? Or does it transfer everytime the RDF flag is pulsed?
I verified the SPI is working as expected with a logic analyzer and am able to see the RDR register has data in it from my sensor and the RDF flag set, but I don't see any data in the destination memory location.
I have attached my code, for reference. Please help to point out what I might have missed.
-Alex