CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

OV7670 interface

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Jim90



Joined: 27 Apr 2013
Posts: 55

View user's profile Send private message

OV7670 interface
PostPosted: Fri Jul 12, 2013 5:52 pm     Reply with quote

I recently buy a OV7670 module camera and i would like to interface it with an dspic microcontroller.

This is the first time that i trying to use camera module, thats why i need help.

Firstly the dspic33 is able to interface this module ? if yes how to connect it?
temtronic



Joined: 01 Jul 2010
Posts: 9246
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sun Jul 14, 2013 5:09 am     Reply with quote

Since no one has replied for a day or two...
..you have a good challenge as there aren't too many 'threads' about dsPICs(16/18 series is more popular) and that camera module is new.

A quick Google search shows a few different types of that camera module and several threads of using a couple of them with other processors.
I'd suggest finding /downloading their code and converting to CCS C.
Perhaps the mfr of the camera has some example code?

I know, you've probably thought of these ideas.
good luck !!

hth
jay
Jim90



Joined: 27 Apr 2013
Posts: 55

View user's profile Send private message

OV7670 interface
PostPosted: Sun Jul 14, 2013 5:52 am     Reply with quote

Thanks temtronic for the reply.

I don't have much experience in dspic series but i thought that it will be more compatible for image application.

Also this is the first time that i try to program a camera module that's why i have a little confuse.

I was tried to find a project of camera module+pic to study but without success.
Can you suggest me any?

Is need to put a memory component between camera and the pic ? I don't know how to connect it ?
miro



Joined: 15 Jan 2011
Posts: 62

View user's profile Send private message

PostPosted: Sun Jul 14, 2013 6:13 am     Reply with quote

dspic33 (or24) are probably the best chips for your application. Above that you may consider pic32MX or the new pic32MZ (up to 512kB ram, 200MHz).

Quote:
Is need to put a memory component between camera and the pic ?

There are two variants of the OV7670 module - with a fifo and without. Better you have got the one with 380kB large fifo memory.
Jim90



Joined: 27 Apr 2013
Posts: 55

View user's profile Send private message

OV7670 interface
PostPosted: Sun Jul 14, 2013 7:09 am     Reply with quote

what is the minimum value oscillator is needed ?

also is need a memory component between pic and camera ?(i think my component is not supporter by a fifo memory, i will check it again )


how to connect it and how to check that the module is working before to start the project ???
Jim90



Joined: 27 Apr 2013
Posts: 55

View user's profile Send private message

usb module with dspic33f
PostPosted: Sat Aug 17, 2013 6:57 pm     Reply with quote

I am trying to use a usb module but my problem is that there is not resources for usb for dspic33f series.

Code:


#define LED1 PIN_B7
#define LED2 PIN_B6
#define LED3 PIN_B5

//Transmit and Receive Packet Size
#define USB_CONFIG_HID_TX_SIZE 16
#define USB_CONFIG_HID_RX_SIZE 16

/*******VENDOR ID AND PRODUCT ID********/
#define USB_CONFIG_PID 1        //Chnage Vendor Id and Product Id
#define USB_CONFIG_VID 4660        //So that they will work with my Application
/***************************************/

//#include<pic18_usb.h>
//#include<usb_desc_hid.h>
//#include<usb.c>
  #include <pic24_usb.h>
#include <usb_desc_hid.h>
//#include <usb_desc_scope.h>   //USB Configuration and Device descriptors for this UBS device
#include <usb.c>        //handles usb setup tokens and get descriptor reports


//Macro Definition for LED ON and OFF
#define LED_ON(x) output_low(x)
#define LED_OFF(x) output_high(x)

void usb_debug_task(void)
{
    static int8 last_connected;
       static int8 last_enumerated;
       int8 new_connected;
       int8 new_enumerated;

       new_connected = usb_attached();
       new_enumerated = usb_enumerated();

    if (new_enumerated)
          LED_ON(LED1);
       else
          LED_OFF(LED1);

       if (new_connected && !last_connected)
          printf("\r\n\nUSB connected, waiting for enumaration...");
       if (!new_connected && last_connected)
          printf("\r\n\nUSB disconnected, waiting for connection...");
       if (new_enumerated && !last_enumerated)
        printf("\r\n\nUSB enumerated by PC/HOST");
       if (!new_enumerated && last_enumerated)
        printf("\r\n\nUSB unenumerated by PC/HOST, waiting for enumeration...");

       last_connected=new_connected;
       last_enumerated=new_enumerated;
}





void main(void)
{
   
    unsigned char in_data[16];
    unsigned int i;
    set_tris_b(0x00);    //Port-B as Output Port
    set_tris_c(0x10);
    output_b(0x00);
    LED_OFF(LED1);
    LED_OFF(LED2);
    LED_OFF(LED3);
    lcd_init();        //Initialize the LCD Module
    lcd_gotoxy(3,1);
    lcd_putc("PIC18F4550");
    Delay_ms(1000);
    lcd_gotoxy(3,2);
    lcd_putc("USB EXAMPLE!");
   
    printf("\r\n\nUSB Test Program--->Written in CCS PIC-C");
    printf("\r\nEMBEDDED LABORATORY\r\n");
    usb_init_cs();
    Delay_ms(1000);
    lcd_putc("\fRECEIVED DATA:-");
    Delay_ms(1);
    while(1)
    {
        usb_task();
        usb_debug_task();
        if(usb_enumerated())
        {
            if(usb_kbhit(1))
            {
                lcd_gotoxy(1,2);
                lcd_putc("                ");
                usb_get_packet(1,in_data,16);
                printf("\r\nReceived Data: ");
                for(i=0;i<16;i++)
                {
                    printf("%c",in_data[i]);   
                    //Send the Recevied Data to Serial Port
                    lcd_gotoxy(1+i,2);
                    lcd_putc(in_data[i]);
                }
                //Now Clear the in_data array
                for(i=0;i<16;i++)
                {
                    in_data[i] = '\0';    //Null Character
                }

            }
           }       
    }
}
           




Is anyone who can help me?
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Sun Aug 18, 2013 7:40 am     Reply with quote

I don't understand what your problem is. You have to give more details about what is working and what is not: what output do you expect to see and what do you really see is happening?

- Your program is incomplete, it is missing the fuses and processor include file.
- ALWAYS post your compiler version number and the processor you are using.
Code:
lcd_putc("PIC18F4550");
This makes no sense when you are using a dsPIC33. Where did you get your code from?

Sorry, but I have the strong feeling you are going in the wrong direction.
You haven't told us what you want to do with the camera module but my feeling is that you are a (relative) beginner in programming and this project may be way to large for your current level of experience. This is not to put you down, but when you are doing a project that is too difficult than experience from many other people has shown that you most likely will fail and be very disappointed. The trick is to break your project down into small pieces and then slowly expand the project to 'grow' into what you want it to be.

As Temtronic told to you before, the dsPIC family of chips is not being used a lot on this forum, so help will be difficult to get here. Perhaps you will be better of on the Microchip website forum.

Also, we have no clue as to what you want to do with the camera module but often it involves processing a relative large amount of data. Before deciding on which processor you are going to use it is good to do some calculations. How many bytes of data to read? What kind of processing to do on the data and how many instructions will this take approximately? Then, writing the data will take time as well. From these calculations you will get an idea of how fast the processor should be. Then choose a processor that is at least 4 - 10 times faster so you have some margin for errors and future extensions.
Perhaps your dsPIC33 is fast enough. Without more details we can't tell. Personally I like the ARM based processors a lot because there is a wide range of manufacturers and speed options. When you choose the wrong ARM processor it is relative easier to switch to a faster model.

Another thing to consider is if you want to write the driver for the camera module yourself or use one of the existing operating systems with existing camera drivers included. For example, a quick internet search for Android and OV7670 module camera shows a lot of good looking hits.
Ttelmah



Joined: 11 Mar 2010
Posts: 19552

View user's profile Send private message

PostPosted: Mon Aug 19, 2013 1:31 am     Reply with quote

I think he is trying to use a USB version of the camera. If so, then 'forget it'.
To do this needs USB 'OTG'. A USB host in the PIC. The CCS drivers _do not support OTG_. Even if they did, or he switched to using the Microchip USB stack, or ported these to CCS, you could talk in terms of several weeks programming to get the camera interface working, and nothing else.

Writing a USB host, is complex.

Only 'easy' (relatively low software development) way of doing this, would be to add an FTDI Vinculum, for which a basic USB stack is fully available, and then talk to this using SPI. However much simpler to use an SPI camera to start with.....

Best Wishes
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group