[Kudly] Cheese V2

Hey,

Yesterday, I finally got an image without any problem 😉 I will explain you what I did to use the STM32F4xx with Chibios, DCMI and OV2640.

First, DCMI is not supported by Chibios but someone wrote a driver that works a bit. I adapted it to make it work. You can find it here : https://github.com/EwanColdicott/ChibiOS . There was some problems. First, there is written DCMI_CR_CRE instead of DCMI_CR_CAPTURE in the dcmi_lld.h file. Without changing that I obtained strange results. Next, in dcmi_lld.c, in the receive function, the dma  mode is define again whereas it was also defined in the init function. However, the interrupts flags are forgotten. So, I just used the former value.

The VSYNC interrupt is also activated by default and it causes problems. The dcmi interrupt is called multiple time and in One Shot mode, this interrupt is supposed to be used only once. Else, the dcmi driver thinks it is in continuous mode. So, I changed the line of the interrupt :

dcmip->dcmi->IER |= STM32_DCMI_IER_FRAME_IE;

To communicate with the camera, a sccb interface is needed. I wrote my own driver and Eric made it better. You can find it on this post : http://rose.eu.org/2015/04/09/heros-faster-camera-configuration . It looks like I2C.

Now, the configuration of the camera. Open your grimoire page 404 because we are going to do dark magic. It the datasheet, all the registers are not defined. So, I found configuration on the internet. Here is my main inspiration source : http://tech.munts.com/MCU/Frameworks/ARM/stm32f4/libs/STM32F4xx_DSP_StdPeriph_Lib_V1.1.0/Project/STM32F4xx_StdPeriph_Examples/DCMI/DCMI_CameraExample/dcmi_ov2640.c

. I initialized my registers with those configurations and it works. At the beginning, I was not able to obtain a pixel clock. It was to be activated in a hidden register…

I modified the clock speed register because it was too long to take a picture (I change a prescaler). After changing some parameters like the clock polarity (samples on rising edge), the camera finally worked.

Cheese !

test

 

Julien

Facebook Twitter Google+ 

1 comment to [Kudly] Cheese V2