cancel
Showing results for 
Search instead for 
Did you mean: 

How to use DMA to perform more than 65,536 transfers from DCMI to memory

Chris Rice
Associate III

Hello, we are creating a camera application on top of an STM32F7, using the DCMI peripheral. We have patterned our code after the BSP code, but when we tried to scale up from 250x250 to 400x400, we found that the DMA2->NDTR field is only 16 bits, and can only support 2^16 transfers, which isn't enough got 400x400 pixels (with 3 bytes per pixel) -- in our target memory, we were simply not writing past that.

How do we configure the DMA to perform more transfers?

Please note that we are using DMA (DMA2->PFCTRL=0) flow control rather than peripheral flow control... when I use peripheral flow control I get very weird output. There seems to be some coordination anyway since the DMA seems to get launched by the DCMI somehow (is it just when the DCMI data register (DR) changes?). My first thought was to handle the interrupt, change the target in memory to the next segment within the destination frame buffer, and re-start the DMA transfer, but the transfer seemed to still be in progress (DMA2.S1CR.EN=1) at that point, so setting it to 1 didn't seem like it would have an effect,

Then I turned to the geniuses here to ask for the capital-R right way to do it, rather than taking wild stabs.

Thanks for any insight.

3 REPLIES 3

> How do we configure the DMA to perform more transfers?

You can't.

However, you can use circular double-buffer mode, and in the transfer-complete interrupt change the currently inactive memory address register. With little software effort the resulting effect is a virtually infinite number of transfers.

> when I use peripheral flow control I get very weird output

That's because only SDMMC generates the transfer-end signal, i.e. that's the only module with which the peripheral flow control can be used - see Flow controller subchapter in the DMA chapter of RM.

JW

Chris Rice
Associate III

Wow, thanks for the good info. I'm starting to write code and get things working, but apparently I have far to go to be expert. 🙂

Researchers have shown it takes about ten years to develop expertise in any of a wide variety of areas...

http://norvig.com/21-days.html

JW