After OV2640 Camera Success, Some Frustratingly Obvious Conclusions


Cameras have been source of extreme pain for me for the past year as they have been very good at playing mind games, often avoiding communication or even setting off into the far west into lands unknown making sure that every time I try my hands on making love to them, they show complete apathy.

How utterly blatantly rude.

Well, after finally getting to exactly what was causing all this drama, I was, in the end, with the undying help of host of numerous websites and friends and foes alike, able to get some data out of it. Even though I would have loved to bore you with all the fascinatingly frustrating adventures I had on my quest to become an embedded imaging programmer and hardware developer, I will just leave you with a slight bit of aftertaste of conclusive bitterness.

1. The Heart Beat of the Camera

XCLK (External Clock) is perhaps the most overlooked subject while programming and debugging and making a camera work. While this was being said in a number of websites, I am still not sure how I didn't manage to get that in my thick head for the three amazingly frustrating, no-progress-on-camera months working with a Korean VGA sensor. Now that I look into it, I can't help but feel a little stupid not to have supplied a clock.

And how amazing is that no datasheet ever mentions this?

In regard to MCO (XCLK output) from your processor, make sure that the processor's clock settings are correctly done. I had my HSE (External Clock Setting) set at 12000000 for some reason when it should have been 80000000 (8MHz, the value of external oscillator on the stm32f429zi board) and the MCO values were coming out real weird.

The lesson that I have learnt here is that next time I build my module from bottom up, especially because there's dearth of Korean image modules in the market, I will have an external oscillator placed just like the one on for my custom board processor so that I will not have to worry too much about providing MCO to the camera.

2. Work Process

Getting the hardware right is crucial but there are certain steps I should have followed before heading out to build a camera from scratch.
Process is pretty easy:
1. Get hold of a popular image module
2. Look for base working software to work with
3. Look for compatible development hardware. I mean not just an evaluation hardware like the STM32F4 disco/ discovery board but an expansion board with all the peripherals sticking out. Life becomes much easier.

While I learned how to build my own PCB for the case, I think it's better for most beginners to just go buy the whole package NO MATTER HOW MUCH IT COSTS.

i mean seriously.

3. Learning how to read a schematic

One thing I learnt the hard way was not understanding a given schematic. It's quite frankly, very very difficult to look into all those lines of electronic zigzags but I think the best way not to screw up is by making sure you understand what the f**k the schematic says.

It's easy for me to say that now, sure, but sitting down with someone who can logically explain you a given hardware circuitry can go a long long way on making your life easier. I just wish somebody could have looked at my camera circuit in the very beginning and gone "what the f**k are you doing?"

Anyways, I have here documented my latest result on a working OV2640 camera. The image is 160*120 resolution image, smaller than what I would have liked to extract but image all the same.
Happy slide watching!


Comments

Popular Posts