I am trying to get large amounts of data into the Pixhawk 4 via the external SPI bus. As a test I am calling spi::transfer() in a 500Hz work queue to exchange 256B of data, which is working well.
Since this uses about 14% CPU time (proportional to the amount of data, will go up for the final application) and the transfers are not continuous (as expected from a multi tasking OS) I decided to enable the DMA for SPI5. I got it running but the behaviour is kinda weird.
Sometimes it works beautifully, with the transfer being continuous and only about 1.5% CPU usage (independent of the amount of data). But other times it behaves the same way as it did with DMA disabled (non continuous transfer, high CPU usage).
Does anyone have an idea why it sometimes does not work as intended?
Thanks in advance for any help!