OV7670 FIFO camera wrong data

General project discussion / help
Did you make a robotic coffee pot which implements HTCPCP and decafs unauthorized users? Show it off here!

Moderator: phalanx

Post Reply
Posts: 2
Joined: Tue Mar 15, 2011 9:42 am

OV7670 FIFO camera wrong data

Post by rulla » Sat Oct 28, 2017 4:37 am

The OV7670 module with FIFO gives me bad color data. In particular, I use it in RGB565 mode, the green is the channel where I get what looks like an error: it seems that the 4th bit of the 6-bit green color data is stuck in "1" position; it never changes throughout the image, even if I put a lens cap to have a dark image. I have tried many many registers settings, and even tried the YUV colorspace instead of RGB565. Here you are G,R,B channels separately. It is clear that the green channel is wrong; using ImageJ to plot the pixels, I can count a mere 4 shades of green (they should be 64).
Green channel:
G channel
ImageSfereG.jpg (5.74 KiB) Viewed 128 times
Red channel:
R channel
ImageSfereR.jpg (5.63 KiB) Viewed 128 times
Blue Channel:
B channel
ImageSfereB.jpg (4.03 KiB) Viewed 128 times
Do you have an idea of what' s going wrong? It should be EVERYTHING ok, registers, timing, color data conversion. The camera configuration code is at: https://os.mbed.com/users/rulla/code/OV ... f5d7c979cf , while the piece of code I use to convert data bytes to color is:

bank0 = cam.ReadOneByte();
bank1 = cam.ReadOneByte();
r=((bank1 & 0x1f)) ;
g= ((bank1 & 0xe0)>>5 ) |((bank0 & 0x7)<<3);
b=((bank0 & 0xf8)>>3 );

Thank you all for your time!

Post Reply