cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F7 DCMI with DMA to external SRAM

Avner Gidron
Associate II
Posted on December 07, 2017 at 07:52

We encountered a problem with the ST’s MCU (STM32F767IGK6).

Problem description:

We are trying to read data from a camera sensor that is on our board (OV7740) connected to the  STM32F7 DCMI port.

The data is being read from the camera, however it is somewhat disrupted, for example a frame byte that should read 255 (decimal) is received as 252 (decimal) and so on( we are using the camera’s “test pattern� which sends predefined known data).

The data is read from the camera and transferred using DMA from DCMI to external sram, 16 bit address, connected using FMC.

Tests findings:

During our extensive tests we narrowed the problem to either the DCMI port, or the DMA mechanism:

  • Hardware verification: Verified on 2 separate boards, and also on ST’s evaluation kit STM32F769I-EVAL (the kit is connected to a header board of  OV7740). (Note: the evaluation kit has different hardware design than our hardware, the SRAM is different, camera is connected on different pins etc…) Result is the same on all three.

  • Lowest/highest frame rate (reducing system clock to justify the frame rate). Same results for all frame rates.

  • Define DCMI to 8 bit and to 10 bit: both modes showed erroneous data (We have 10 bit and 8 bit data formats).

  • Verify OV7740 configuration with Omnivision support, and also compared to omnivision’s evaluation kit configuration which is working.

DCMI configuration:

  hdcmi.Instance = DCMI;

  hdcmi.Init.SynchroMode = DCMI_SYNCHRO_HARDWARE;

  hdcmi.Init.PCKPolarity = DCMI_PCKPOLARITY_FALLING;

  hdcmi.Init.VSPolarity = DCMI_VSPOLARITY_HIGH;

  hdcmi.Init.HSPolarity = DCMI_HSPOLARITY_LOW;

  hdcmi.Init.CaptureRate = DCMI_CR_ALL_FRAME;

  hdcmi.Init.ExtendedDataMode = DCMI_EXTEND_DATA_8B;

  hdcmi.Init.JPEGMode = DCMI_JPEG_DISABLE;

  hdcmi.Init.ByteSelectMode = DCMI_BSM_ALL;

  hdcmi.Init.ByteSelectStart = DCMI_OEBS_ODD;

  hdcmi.Init.LineSelectMode = DCMI_LSM_ALL;

  hdcmi.Init.LineSelectStart = DCMI_OELS_ODD;   

DMA configuration:

    hdma_dcmi.Instance = DMA2_Stream1;

    hdma_dcmi.Init.Channel = DMA_CHANNEL_1;

    hdma_dcmi.Init.Direction = DMA_PERIPH_TO_MEMORY;

    hdma_dcmi.Init.PeriphInc = DMA_PINC_DISABLE;

    hdma_dcmi.Init.MemInc = DMA_MINC_ENABLE;

    hdma_dcmi.Init.PeriphDataAlignment = DMA_PDATAALIGN_WORD;

    hdma_dcmi.Init.MemDataAlignment = DMA_MDATAALIGN_HALFWORD;

    hdma_dcmi.Init.Mode = DMA_NORMAL;

    hdma_dcmi.Init.Priority = DMA_PRIORITY_HIGH;

    hdma_dcmi.Init.FIFOMode = DMA_FIFOMODE_DISABLE;

    hdma_dcmi.Init.FIFOThreshold = DMA_FIFO_THRESHOLD_FULL;

    hdma_dcmi.Init.MemBurst = DMA_MBURST_SINGLE;

    hdma_dcmi.Init.PeriphBurst = DMA_PBURST_SINGLE;

The rest of the code is based on ST’s STM32F7 formal snapshot example.

I found two other posts that are relevant to my problem although it is on F4 not F7:

https://community.st.com/0D50X00009XkeLMSAZ

https://community.st.com/0D50X00009XkXKPSA3

Thanks is advance.

#fmc #dma #dcmi #sram #stm32f7
2 REPLIES 2
Imen.D
ST Employee

Posted on December 08, 2017 at 17:05

Hello,

I recommend you to refer to this application note

https://www.st.com/content/ccc/resource/technical/document/application_note/group0/c0/ef/15/38/d1/d6/49/88/DM00373474/files/DM00373474.pdf/jcr:content/translations/en.DM00373474.pdf

(Digital camera interface (DCMI) for STM32 MCUs). It will help you about the DCMI usage with DMA configuration.

Best Regards

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
Posted on December 11, 2017 at 08:30

Hi Imen,

Thanks for the replay.

I read the application note before and the code examples in the end of it and wasn't able to solve my problem.