I use DMA (4bytes) with DMAMUX_3 Channel 5(Trigger by SPI_2 RFDF status) to receive SPI data (Copy to RAM buffer).
There are one STM 500us interrupt, if the interrupt take more time (about 40us, one SPI data time about 8us), my SPI receive will lost data.
Compiler: S32DS Power with GCC, Debug:Trace 32, MCU: MPC5746R, Core 0
This is software bug, software don't update DMA receive data length in time after 500us interrupt lead to DMA receive timeout.
Hi,
if my understanding is correct, DMA is configured to transfer 4 received SPI frames, then interrupt is triggered by DMA, you reconfigure the DMA and start over, right? If yes, then it makes sense that it doesn’t work if another interrupt is longer than about 5x duration of SPI frame. This needs to be solved on application level. Either ensure that DMA has highest priority and that it can pre-empt other interrupts or configure the DMA to receive more data at once or use scatter-gather for double buffering or whatever like this.
Regards,
Lukas
Hi, I use DMA without interrupt.
In main() loop, I use DMA to receive data with enough buffer about 100 DWORDs.
If the SPI "RFDF" is set, DMA will move data into buffer,.
In my application, After I tranfer one read command with start DMA RX, and then I will delay some time (maximum 510us) and copy the DMA data.
(delay function use different channel with STM interrupt, and STM interrupt only change " Compare Register ".
Does STM interrupt in supervise mode affect the DMA?
Hi,
STM can't affect the DMA directly. It can be rather system issue when there's heavy traffic on crossbar and when other DMA channels are active. An option is to configure higher priority for that DMA channel (if not already done). If you decrease SPI speed, does it help?
Regards,
Lukas