cancel
Showing results for 
Search instead for 
Did you mean: 

Camera DCMI with DMA issues

43102399
Associate II
Posted on October 28, 2016 at 15:26

Hey,

I have some trouble configuring my camera interface. I am using an analog NTSC camera with differential data lines. For decoding it into digital YCbCr 4:2:2 I am using the Intersil TW9990. I think I configured it more or less right because I am receiving VSYNC, HSYNC and data. Only I am not sure because I have the possibility to crop the image with the TW9990 too. And also I don't know if the vsync and hsync lines must be active all the time during transmitting active lines/pixels. Does anybody of you know it? Because I can't find any good description for the DCMI interface.

So now configuring my STM32F746 Discovery Board to continue with these received data. I want store the data via dma in the external sdram. I know I am receiving 8 bit data by each pixel clock. Can I configure the dma as followed?

/*** Configure the DMA ***/

  /* Set the parameters to be configured */

  hdma_handler.Init.Channel             = DMA_CHANNEL_1;

  hdma_handler.Init.Direction           = DMA_PERIPH_TO_MEMORY;

  hdma_handler.Init.PeriphInc           = DMA_PINC_DISABLE;

  hdma_handler.Init.MemInc              = DMA_MINC_ENABLE;

  hdma_handler.Init.PeriphDataAlignment = DMA_PDATAALIGN_WORD;

  hdma_handler.Init.MemDataAlignment    = DMA_MDATAALIGN_WORD;

  hdma_handler.Init.Mode                = DMA_CIRCULAR;

  hdma_handler.Init.Priority            = DMA_PRIORITY_HIGH;

  hdma_handler.Init.FIFOMode            = DMA_FIFOMODE_DISABLE;

  hdma_handler.Init.FIFOThreshold       = DMA_FIFO_THRESHOLD_FULL;

  hdma_handler.Init.MemBurst            = DMA_MBURST_SINGLE;

  hdma_handler.Init.PeriphBurst         = DMA_PBURST_SINGLE;

I mean the PeriphDataAlignment as WORD? Buffers the dma 4 bytes and send them as a word? I need it because of the counter limitation of the dma (65536).

The NTSC format has a size of 720x525 pixels. It should send the odd- and even-field speratly. So first all odd line numbers, vsync and then all even line numbers. How does the dma know when it should go back to the beginning of the memory? Is it only controlled by the length of the HAL_DCMI_Start_DMA() function? I configured mine as followed.

HAL_DCMI_Start_DMA(&hDcmiHandler, DCMI_MODE_CONTINUOUS, CAMERA_BUFFER, 0xFF00)

The length 0xFF00 is for the display size of 480x272 multiplied by 2 for the YCbCr 4:2:2 and devided by 4 for the word transmitting from the dma.

I extract first only the Y channel to see a gray scaled picture. Everything can't be so wrong because I can see the image around three times on the display and it's moving from the right to the left.

Does anybody have an idea what I can do? Slowly I am out of ideas. I tried a lot.

Greets Jan

#stm32 #dma #camera #dcmi
1 ACCEPTED SOLUTION

Accepted Solutions
43102399
Associate II
Posted on October 29, 2016 at 19:14

I found the issue guys...

I didn't connect the +3.3 V digital supply voltage between the STM and TW9990. Only GND. I thought that I don't need it because the TW9990 is on a demo board with its own supply voltage.

View solution in original post

1 REPLY 1
43102399
Associate II
Posted on October 29, 2016 at 19:14

I found the issue guys...

I didn't connect the +3.3 V digital supply voltage between the STM and TW9990. Only GND. I thought that I don't need it because the TW9990 is on a demo board with its own supply voltage.