cancel
Showing results for 
Search instead for 
Did you mean: 

DCMI ov9655 Example help (STM3220g Eval)

re
Associate II
Posted on January 23, 2012 at 21:09

Hi, I'm new to STM32 and also to interfacing with Digital camera modules.

as a First step I went trough the DCMI example that boards with the STM32F2xx Library. although in the example firmware that came with the Eval board the camera seems to work fine, but simply running the DCMI example gives no result to the LCD, even though the code runs with no error.

I am using IAR EWARM to build and deploy the code to the board.

Do I have to make any change in the code to make it work?

Thanks in advance

#stm3220g-eval #smt3220g #dcmi #dcmi
11 REPLIES 11
re
Associate II
Posted on January 24, 2012 at 01:01

I've managed to get some image from the sensor. It seems that it was shipped an OV2640 instead of the stock OV9655. I used the library from STMf4xx that contains the example for OV2640. But now it seems there's some v-sync problem. the image is glitching. 

Edit: I made it stop glitching by putting the right bounding box in the LCD display. But now the image is split. the bottom part of it is in the upper part of the display. The good part is that it doesn't flip anymore, it's perfectly static =)

pobox2day
Associate II
Posted on February 07, 2012 at 02:31

Hi Renato

Have a look in the STM32F4 library DCMI examples where you will find an example that uses either the OV9655 or OV2640, the latter sensor is shipped with the STM3220G Rev B board. You need to make a few changes to the headers but usually it is changes from STM32F4xxxxx to STM32F2xxxxxxx. The compiler will give you errors in any case so just go through each error and fix up the header reference. I managed to get the example working with my development board and now are trying to get higher resolution images starting at VGA (640x480).

Ian 

kamada
Associate II
Posted on February 07, 2012 at 09:08

I read ''STM32F2xx_StdPeriph_Lib_V1.0.0\Project\STM32F2xx_StdPeriph_Examples\DCMI\OV9655_Camera\'' by MDK-ARM.

I rebuilded and started debug. It seems to run with no error. But I can not see image of CMOS image sensor on LCD. 

On DM00022972.pdf(rev.5) page 18, ''There are two possible modules and omnivision cameras populated on the CN15 connector 

of the board:''. 

Which kind of CMOS image sensor are implemented on this eval board? 

And tell me how to show this Rev.C's camera image on LCD by example source code?

pobox2day
Associate II
Posted on February 07, 2012 at 11:06

Damien

The firmware that comes with the evaluation board has a system I think menu option that displays the hardware. On my STM3220g-eval REV B board, the camera is an omnivision OV2640. I think you need to run the OV2640_dcmi.c code for this camera to run. Have a look at the F4 evaluation board examples and these include code to run the OV2640 camera. You will need to make some minor changes to get it to compile though.

Ian

kamada
Associate II
Posted on February 07, 2012 at 11:55

Hi Davies,

Thanks so much.

After my previous post, I inserted the following code to DCMI_OV9655Config() on main.c.

-------

  if(DCMI_SingleRandomWrite(OV9655_DEVICE_WRITE_ADDRESS,0x12, 0x80))

  {

     return (0xFF);

  }

  Delay(100); //kamada 20120207

  uPID = DCMI_SingleRandomRead(OV9655_DEVICE_READ_ADDRESS, 0x0A);

  uVER = DCMI_SingleRandomRead(OV9655_DEVICE_READ_ADDRESS, 0x0B);

-------

Sensor register address 0x0A is 0x26.

Sensor register address 0x0B is 0x42.

This means my sensor device on my eval board is OV2640.

I will look for OV2640 setting code in F4 sample codes.

Regards,

re
Associate II
Posted on February 09, 2012 at 18:25

I was able to remove the glitch from the image. I just enabled the camera capture command right after enabling the DMA, this made the image show up perfectly on the lcd display.

Damien, my Eval board is Rev. C and the sensor that came together is the ov2640 as well. with the example code from F4 I could configure my camera perfectly. to achieve higher resolutions you'll probably donfigure your DMA with a high buffer and double buffer it, at the highest resolution possible you'll have to set an interruption on the DMA to change the address to finish the transfer.

pobox2day
Associate II
Posted on February 13, 2012 at 06:05

Hi Renato

I have played with trying to double buffer the DMA transfer to SRAM but haven't had any luck. The lack of example code is not at all helpful. I was either going to try and use the JPG compressed mode from the camera or use RGB and double buffers. I am hopeful of getting at least 640x480 and would like to get even higher if possible. Certainly the camera and the hardware is capable og higher resolution images. Appreciate if you or anyone else would share some working code examples.

Thanks in advance . Ian

pobox2day
Associate II
Posted on February 13, 2012 at 06:05

Hi Renato

I have played with trying to double buffer the DMA transfer to SRAM but haven't had any luck. The lack of example code is not at all helpful. I was either going to try and use the JPG compressed mode from the camera or use RGB and double buffers. I am hopeful of getting at least 640x480 and would like to get even higher if possible. Certainly the camera and the hardware is capable og higher resolution images. Appreciate if you or anyone else would share some working code examples.

Thanks in advance . Ian

re
Associate II
Posted on February 14, 2012 at 21:43

Take a look at

https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/DCMI Issues, looking for insight&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=798

as it goes over the very same problem you are currently facing now.

I haven't tried it yet, but I believe only double buffer the DMA with the highest buffer possible won't be sufficient even, as it only gives you

524280 bytes (0xFFFF*2*4)

, when you actually need614400 bytes (640*480*2 -> each pixel is 16 bits long) for a 640x480 pixels.

What happens is that a single DMA transfer is not enough to transfer the whole image. You must set the DMA TC interrupt, and in the interrupt you must update the M0AR and M1AR address to go on with the remaining bytes. Once the image is fully transferred the DCMI will finally set its interrupt and you might be able to see your image in the SRAM address you defined.

Hopes this helps.