Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 5 of 5

Thread: OV7670 correct colors

  1. #1
    Junior Member
    Join Date
    Nov 2020
    Posts
    3

    OV7670 correct colors

    Hi friends.
    A favor, please!. It is about the camera Ov7670, I got a image but the colors are wrong. Could someone tell me what registers should i set to get the adequate colors?.

    I thank you very much for your help.

    I am new here, I dont know if it is possible to add image file.

  2. #2
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    8,175
    Sorry might help to know additional information, like what is the camera hooked up to? Some form of Teensy?

    What software are you running on it? How is it connected?

    As for image. You can upload images by clocking on the Insert Image button which is I believe the 4th from the right button. You can only upload specific files like JPEG, GIF, BMP with this, and there is a maximum size. Also not sure if brand new users can upload or not.

  3. #3
    Junior Member
    Join Date
    Nov 2020
    Posts
    3
    Well, I will try to explain that I have done.
    I am using a Pic microcontroller of 32 bits, one ov7670 camera without fifo al422b (dram of 3 Mbits), and 2 chips al422b.
    I am using the camera with Vga (640 x 480) resolution, then using a camera configuration RGB565, it would be necessary almost 5Mbits of dram to save the bits of the image, for such reason i am using 2 chips al422b (dram of 3Mbits), each chip al422b save bits of odd and even rows, I designed a small circuit using nand port and flip flop D to save the bits inside the al422b automatically.

    About the software, I made it only using the assembler language of the Pic32, I read the datasheet of the Pic32, of the al422b and of the OV7670, with that information i made the code Assembly to read the bits of the image from the al422b, and the Pic32 send it to computer using rs232, with the image in the computer i verify the work.
    There are many details about the hardware and software to explain here because it could be extense here.

    Now I have dificulties to get the adequate colors, the OV7670 have many commands, to understand them take time because it is test-observation several times.

  4. #4
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    8,175
    Sorry I probably won't be able to help much. About the only thing I could mention is there are are a couple of thread up on this forum about writing code to be able to use these cameras using Teensy 3.x or 4.x boards made by PJRC.

    Such as the thread: https://forum.pjrc.com/threads/63195...IRQ-Teensy-4-0
    There are a few others as well. In these threads, some of the test programs have the ability to read display the different register values of the camera.

    Likewise there are links to PDF files for the camera.

    About the only way I have debugged some issues is using a Logic Analyzer. Mine are by Saleae. For this I typically don't use my faster newer one, but an earlier one that has 16 inputs, such that I can get all 8 data pins plus the 4 control signals (MCLK, PIXCLK, HREF, VREF) and sometimes the two I2C pins as well.


    So with a such a specific hardware setup, which does not use any PJRC products, it may be difficult for anyone up here to help you very much.

    The main way that I have found that I can debug anything with this camera is by looking at the data from the Logic Analyzer, where for example I may remove looking at the 2 SPI pins, which leaves me 4 pins on my Logic16 that I can put in debug pin set high or low or toggle and double check things like seeing where our code detects when a frame starts VREF and where each line of pixels start (HREF) and then see what pixel data is being returned and what data bits is the program actually seeing.

    Sometimes it could be as simple as your assumption on the 565 format do I need to reverse the order of the two bytes that make up the 16 bits.

    Good luck

  5. #5
    Junior Member
    Join Date
    Nov 2020
    Posts
    3
    Thank you very much for your help.
    You are right, the logic analyzer is very useful.
    I am changing some values in the colors matrix and I am getting best results. I will continue trying it.

    Again thank you for your advices.😊👍

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •