AnsweredAssumed Answered

DMA and DCMI issues.

Question asked by jab on Nov 5, 2013
Latest reply on Nov 6, 2013 by Clive One
Hi,

I've recently been playing with a Keil MCBSTM32F200 board, specifically using the camera module. Essentially, I'm trying to use DMA2 to route the camera data to an arbitrary location in the SRAM instead of directly to the LCD memory. In order to do image processing before finally displaying the image.

I can 'DMA' from camera to LCD address fine, but when I start sending it to say '0x20000000' (valid location in SRAM), it is only sending the first 'pixel' of data. Do I need to manually increment the destination address? I'm not sure if this happens automatically because when I set the LCD address as the destination and view the memory map, all the pixel values appear to be copied across. 

Here is my DMA & DCMI setup code:
/* Configure DCMI peripheral */
DCMI->CR &= ~(DCMI_CR_ENABLE | DCMI_CR_CAPTURE);
 
DCMI->CR  =  DCMI_CR_PCKPOL |                 /* Rising polarity                    */
             DCMI_CR_VSPOL;           /* VS Polarity high                   */
                                      /* HS Polarity low                    */
                                      /* Continuous mode                    */
                                      /* Hardware sync                      */
                                      /* Capture rate all frames            */
                                      /* Extended data mode 8b              */
/* Configure DMA stream */
DMA_StreamInitialize(DCMI_DMA_NUMBER, DCMI_DMA_STREAM);
 
s_ctrl = (DCMI_DMA_CHANNEL  << DMA_CHANNEL_POS)  |
         DMA_MEMORY_DATA_16BIT                   |
         DMA_PERIPHERAL_DATA_32BIT               |
         (DCMI_DMA_PRIORITY << DMA_PRIORITY_POS) |
         DMA_PERIPHERAL_TO_MEMORY                |
         DMA_CIRCULAR_MODE                                            |
                   DMA_TRANSFER_COMPLETE_INTERRUPT;
 
DMA_StreamConfigure (DMAx_STREAMy(DCMI_DMA_NUMBER, DCMI_DMA_STREAM),
                     s_ctrl,
                     DMA_FIFO_DIRECT_MODE_DISABLE |
                     DMA_FIFO_THRESHOLD_25,
                     DCMI_SRC_ADDR,
                     SRAM_ADDR,
                     1);

I'm not 100% sure what the FIFO Direct mode and threshold does. I've tried changing the NDTR from 1 to 76800, (the amount of pixels I have) but that doesn't seem to  make a difference. Should I still use DMA if I am going to be processing every pixel anyway? I'm trying to figure out the best way capture a frame in memory, process it then output the result. As fast as possible.

Any advice on this would be greatly appreciated. Thanks in advance.

Kind regards,
Thomas

Outcomes