AnsweredAssumed Answered

STM32F7 DCMI with DMA to external SRAM

Question asked by Avner Gidron on Dec 7, 2017
Latest reply on Dec 11, 2017 by Avner Gidron

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/thread/40129-streaming-video-from-dcmi-to-ili9488-display-through-dma-and-fsmc

https://community.st.com/thread/44838-stm32f407-discovery-dcmi-ov7670-problem

 

Thanks is advance.

Outcomes