This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

SPI Flash write using DMA

Hi,

I have camera interfaced on GPIOs of nRF52832.. I am reading image data at the rate 80KHz. Is it possible to write the data to SPI Flash (Slave) by DMA or by any other way such that I won't need to buffer much image data before write it to the flash ? Will that be possible at such higher rate ?

  • Hi Vishal

    The DMA of the SPI master can only read from the RAM, so at some point the data will have to be stored in a RAM buffer for you to write it over the SPI. I don't understand exactly how your camera interface works, but I would assume that you can prepare the next SPI transfer in one buffer while the previous transaction is being written from a different buffer?

    Best regards
    Torbjørn

  • Hi, Thanks. I read the Data lines of the Camera with sync of its clocks, HREF and VSYNC, and what Data I get, I store that in the internal RAM.. At present due to the limited memory, my image resolution is also limited.. so what I want to do is - Read Image Data --> Store in internal Ring Buffer --> Read from Ring Buffer --> Write to SPI Flash..

    So far I could not find the appropriate example how I can do that.. All I found is this macro
    "define SPI0_USE_EASY_DMA 1"

    Can you give me any reference from where I can understand how I can configure EasyDMA to Read from buffer and Write data to Flash ?

  • Hi

    In that case all you have to do is to point to the right spot in the ring buffer when calling nrf_drv_spi_transfer(..)
    You don't have to copy to a second buffer first.

    Once you get the event from the SPI driver saying that the transaction was completed you can free up that part of the ringbuffer, so that it is available for more data.

    Best regards

Related