Hi,
I've been using the LPSPI EDMA transfer API from the SDK (2.16.100) on IMXRT1172 to read and write SPI data simultaneously (i.e. a TX+RX transfer on two DMA channels with two buffers of the same size). Unfortunately, it appears that the EDMA callback is getting called before the transfer actually finishes. In the callback, checking LPSPI's SR, FSR, and RSR shows that SPI thinks it's still busy even though DMA thinks it's complete. I.e. MBF is still set and TXCOUNT is 1.
SR = 0x01000100 (MBF, WCF)
FSR TXCOUNT = 1, RXCOUNT = 0
RSR = 0x00000002 (RXEMPTY, !SOF)
Now, if I was only doing TX, this could somewhat make sense as the SPI peripheral could still be clocking out the last byte loaded from DMA. So in that case the DMA peripheral would actually be finished loading the last byte from RAM into the SPI data TX register, but SPI still had work to do to send it out.
However, when doing TX and RX simultaneously, I would have expected that if TXCOUNT was 1, then so would RXCOUNT be. I.e. the DMA shouldn't be complete with RX until all the TX data is clocked out because the last byte needs to be transferred by DMA into RAM from the SPI RX data register, and this would only happen on the last clock cycle of the transfer.
Is this actually a problem?
If so, is it with the SDK? Or with the hardware IP?
I was hoping to be able to check LPSPI SR in the DMA callback to determine if there are any SPI errors.
Thanks,
-m