Interfacing DMA with SPI to save camera frames to RAM buffer
I need to process camera frames arriving from an Arducam OV5642 via SPI. If I add both QSPI chips I can get a 16MB buffer which is large enough for to store a RAW format or a JPEG format which can then be uncompressed to a RAW file.
The default Arducam library code writes to the SD card, but I can modify it to write to a buffer instead. This sort of buffer copying is what DMA is used for. I’ve never used the Teensy DMA features, but I’ve heard of people using DMA features to speed SPI data handling like this. Does this sound similar to anything anyone has implemented?
Questions:
1. Does the peripheral’s SPI interface have to support DMA to be used like this?
2. It seems like I might be able to implement DMA by turning it on before a series of repeat SPI reads of predetermined length (ie 640x480) and then disabling it afterward. This way the arriving SPI data will be ferried to the buffer without any control traffic also being transferred into the buffer and corrupting the image. Is this a close guess to how it could work?
I need to process camera frames arriving from an Arducam OV5642 via SPI. If I add both QSPI chips I can get a 16MB buffer which is large enough for to store a RAW format or a JPEG format which can then be uncompressed to a RAW file.
The default Arducam library code writes to the SD card, but I can modify it to write to a buffer instead. This sort of buffer copying is what DMA is used for. I’ve never used the Teensy DMA features, but I’ve heard of people using DMA features to speed SPI data handling like this. Does this sound similar to anything anyone has implemented?
Questions:
1. Does the peripheral’s SPI interface have to support DMA to be used like this?
2. It seems like I might be able to implement DMA by turning it on before a series of repeat SPI reads of predetermined length (ie 640x480) and then disabling it afterward. This way the arriving SPI data will be ferried to the buffer without any control traffic also being transferred into the buffer and corrupting the image. Is this a close guess to how it could work?
Last edited: