cancel
Showing results for 
Search instead for 
Did you mean: 

Stm32f4 and DCMI problem

askari.nima
Associate II
Posted on April 26, 2016 at 08:28

hello 

I get overflow on DCMI .

please see my code.

DCMI config : 

 hdcmi.Instance = DCMI;

  hdcmi.Init.SynchroMode = DCMI_SYNCHRO_HARDWARE;

  hdcmi.Init.PCKPolarity = DCMI_PCKPOLARITY_RISING;

  hdcmi.Init.VSPolarity = DCMI_VSPOLARITY_LOW;

  hdcmi.Init.HSPolarity = DCMI_HSPOLARITY_HIGH;

  hdcmi.Init.CaptureRate = DCMI_CR_ALL_FRAME;

  hdcmi.Init.ExtendedDataMode = DCMI_EXTEND_DATA_8B;

  hdcmi.Init.JPEGMode = DCMI_JPEG_DISABLE;

  HAL_DCMI_Init(&hdcmi);

DMA config :

 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_WORD;

    hdma_dcmi.Init.Mode = DMA_NORMAL;

    hdma_dcmi.Init.Priority = DMA_PRIORITY_LOW;

    hdma_dcmi.Init.FIFOMode = DMA_FIFOMODE_DISABLE;

    HAL_DMA_Init(&hdma_dcmi);

global : 

uint16_t CameraBuffer[160*120];

I config my sensor 160*120 RGB565

start capture :

Camera_SnapshotStart((uint8_t*)CameraBuffer);

Capture function :

void Camera_SnapshotStart(uint8_t *buff)

hdcmi.DMA_Handle->Init.Mode = DMA_NORMAL;

  HAL_DCMI_Start_DMA(&hdcmi, DCMI_MODE_SNAPSHOT, (uint32_t)buff,9600);  

}

what is my proble ?

#overflow
9 REPLIES 9
askari.nima
Associate II
Posted on April 26, 2016 at 15:24

Nobody can answer me ?

 I'm waiting .. 
askari.nima
Associate II
Posted on April 27, 2016 at 05:30

I have all signal and saw in oscop. href signal 396 us. vref signal 50 ms .

askari.nima
Associate II
Posted on April 27, 2016 at 07:53

/* StartCameraTask function */

void StartCameraTask(void const * argument)

{

/* USER CODE BEGIN StartCameraTask */

/* Infinite loop */

osDelay(500);

Camera_Init(Camera_Mode_RGB565);

osDelay(1000);

for(;;)

{

Camera_SnapshotStart((uint8_t*)CameraBuffer);

osDelay(1000);

}

/* USER CODE END StartCameraTask */

}

this is my task for read camera ..

this is result in picture . Debug mode . please see it .

________________

Attachments :

keil.png : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HtqS&d=%2Fa%2F0X0000000aXl%2FmaJX1KH4Tfm.OIEmIG7wf8gsJvza07iBnvBMqujR99k&asPdf=false
askari.nima
Associate II
Posted on April 28, 2016 at 07:38

Mr.Clive .. please answer . I'm late.

Posted on April 28, 2016 at 15:19

This isn't really something I can provide assistance with.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
askari.nima
Associate II
Posted on April 28, 2016 at 17:19

Mr.Clive . I Really Need to Solve my problem. please see my debug picture.

My micro detect  Href signal every 396 us and Vref at 50 ms . why DMA handler not work . I see stm32cube example and my code is very like it. 

hdcmi alwaye have error OVF . 

Please Help me.

askari.nima
Associate II
Posted on April 28, 2016 at 17:21

this is my university project and very important. Nobody cant help me ?

Posted on April 28, 2016 at 20:31

Perhaps the DMA needs to have a higher priority, and use the FIFO, to mitigate the differential in speed, and hard time lines, between the camera and the memory.

As urgent as it may be to you, there really aren't that many people here, and most of them have their own problems and issues.

I have basic logic and problem solving skills, the HAL and Cameras really aren't my thing. Suggest you review the DCMI examples related to the EVAL boards, and experiment with those boards.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Walid FTITI_O
Senior II
Posted on April 28, 2016 at 20:57

Hi askari.nima, 

Here is few recommendation that may help you:

-Try to increase the

 â€œCameraBufferâ€� size.

- Try to use the 4-word deep FIFO available to leave enough time for DMA transfers and avoid DMA overrun conditions.

- Make sure the you have configured the NVIC for DCMI and DMA

- Make sure that you called the DCMI and DMA IRQ_Handlers inside stm32f4xx_it.c

Take a look to ''stm32f4x9i_eval_camera.c'' file to inspire from it the configuration of you function. ( see BSP_CAMERA_MspInit() function) at this path stm32cubef4_1.11\STM32Cube_FW_F4_V1.11.0\Drivers\BSP\STM324x9I_EVAL

I want to mention that the example  ''DCMI_SnapshotMode'' in STM32CubeF4 will be very helpful for you where the configuration of DCMI peripheral is done through the BSP library.

Good Luck

-Hannibal-