Delays


While my board (CTS module) seems to work fine, I am still waiting for the final boards to reach here from the factory (over 2 weeks already) and for the FIFO chips (over 6 weeks on the way here!!!). Yes, these boards will come equipped with FIFO chips, so any OV7670 cheap camera modules can be used, there is no need for OV7670 FIFO modules anymore, which makes them much cheaper.

Did a first cleanup and I can compile the code for Atmega16 without issues (SRAM and FLASH). Since I do plan to use only Atmega644P chips on the new boards, there should be no limitations and furthermore, will allow for more future enhancements.

Will start working on updating project documentation and on the PC client to clean it up and see if can make it faster. Should see more changes and information coming soon.

Advertisements

8 thoughts on “Delays

  1. Hello
    Would it be posible to get your source code in order to work with it.
    I am working with a OV7670 without FIFO and a ATMEGA328, I am trying to make XCLOCK from atmega at 500khz and see what it happend. But I would like to user a SCCB library instead of make it by myself.
    Thanks in advance.
    Paco

    • Hi Francisco, Not sure how my code is going to help as I am using the FIFO version as Atmega will not have enough resources to handle capturing of the image and image processing.

      If you look around there are quite a few number of projects that cover the part you are interested, however, they usually go for a ARM solution where RAM and CPU speed is not a concern.

      If you just need the SCCB library, I can email you the code but is very generic, I am using macros as much as possible so I can reuse it on ARM.

      Hope this helps.

      • Hello Nasulica
        I actually already have the SCCB, maked by my self.
        It a chalenge to make OV7670 work in some way with Atmega328. In avrcam there is some information, but I am a little lost. I have defined INT0 as PCLK and INT1 as HREF and T1 as VSYNC. I have T2 working as a clock generator for OV7670 at 1MHz.
        Do you mention in other post about a trick for make work OV7670 with low speed, where can I find that information?
        Thanks in advance.

      • Hi Francisco,

        First I will suggest a different way: INT0 handle VSYNC, INT1 handle HREF, generate XCLOCK through AT328P CLKOUT (PB1) pin (AT328P can take 24 Mhz clock which then can use it to drive the OV7670). Can change REG_CLKRC register on OV7670 to control the clock for OV7670.

        Using INT for PCLK may be too slow at 30 FPS, my suggestion is to just read the data directly and use NOP for catching up. At high speed is no time to do much else anyway and using INT will not help much either. Keep in mind that your AT328P is the one driving the OV7670.

        Can you share what you want to use it for?

  2. Hello Nasulica
    I actually driving OV7670 with AT328 but to 1Mhz.
    Yes I don’t want 30fps at the momen I only want 1 fps with QCIF in order to start.
    Yes I see INT are very slow, with 1Mhz and QCIF I get a 125khz in PCLK and this is enought for INT.
    What value do you recomend for reg CLKRC with 8Mhz of XCLK for instance?
    In other hand I am thinking on using INT0, and INT1 for VSYNC and HREF and T0 to count PCLK and put out 11(arduino) high when count is reached. This pin is the clock of a 8bit latch a 74HC165 for instance and read the bits via SPI (hardware or software).
    I just would like to offer to the Arduino community a cheap Camera Library. Since that I can’t overclock que ATmega328.
    Thanks in advance.
    P.D.: Does you have any relationship with avrcam?

    • Hi Francisco,

      No, I am not related to AVRCAM project, however, I was somehow inspired by it. I started using LPC1769 then switched to AVR cause was easier to build my own boards and the IDE/compiler is free, but lack of RAM is quite a limitation for such projects.
      Going back to your questions, you can use any clock to drive OV7670, however, if I’m not wrong, they recommend to use at least 10 Mhz in their OV7670 Application Note.
      For CLKRC registry, check the VSYNCK timing with the crystal you have (10 FPS?) and CLKRC set to 0x01. Then calculate the value to reach the framerate you plan to use and check with a scope to confirm.
      For a very low framerate you can just use a while loop that checks for the PCLK to change from LOW to HI then read the pixel value (just remember that 1 pixel require 2 PCLK clocks).
      Hope it helps.

      • Hello Nasulica
        Does you know launchpad stellaris?
        It is ARM at very low cost with free IDE.
        I just bought one today 12$.
        Following your suggestion I am going to make a try:
        T0 as HREF and not Interrupt at all just counter
        T1 as PCLK and not interrupt at all just counter
        INT0 as VSYNCK and set TCNT0=HREF_counter=0 each inerruption;
        main loop
        wait ultil HREF_counter=lineTOread;
        PCLK_counter=TCNT1=0
        while TCNT1512 (whant to read 255 pixel)
        pixels[TCNT1]=8 bit read
        send pixels by UART
        lineTOread=HREF+1

        And I am doing this setup on OV7670
        //PCLK does not toggle during horizontal blank
        // (COM10)
        setOV7670(0x15,0b00100000);
        //For QCIF video format 176×144
        //Enable scaling (COM3)
        setOV7670(0x0C,0b00001000);
        //Scale to QCIF (COM7)
        setOV7670(0x12,0b00001000);
        //Set RGB format (COM7)
        setOV7670(0x12,0b00000100);
        //Set RGB 555 (COM15)
        setOV7670(0x40,0b00110000);
        That do you think. Am I in the right way?
        Thanks you

      • Hi Francisco,

        Not big fan of TI… My experience with their site was bad, tried several browsers and I never managed to download their IDE due so many restrictions. I am using NXP instead, their documentation is great and is a huge community out there. Got a free IDE, a JTAG that comes with the demo board and can break it away from it and use it with all your custom designed boards… Also, ST have ST32F4 that comes with 194 Kbytes RAM and dedicated DMA for camera and the board is very cheap and can do so much…

        You may want to consider using the time between each line for processing/streaming. for example: choose a resolution like 128 x 120 that will reduce the number of pixels by 40 % while still providing an acceptable image. This will allow you to store 8 lines in RGB332 format in 1 Kbyte and using the gap between the lines will allow you to do some processing or streaming of data while still having an acceptable framerate. You can also choose to skip the odd lines and use that time for processing/streaming, etc…

        Sent you a mail with some details on OV7670 that may help withe the configuration.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s