This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

OV7670 Camera Driver

Hi, 

I'm having some trouble getting a device pointer for the OV7670 Camera. I've ported the OV7725 driver. It appears as if the program exits the driver before setting the I2C address:

drv_data->i2c = device_get_binding(DT_INST_BUS_LABEL(0));
printk("HERE!!!!!!!!!!!!!!!!!!!\n");
if (drv_data->i2c == NULL) {
LOG_ERR("Failed to get pointer to %s device!",
DT_INST_LABEL(0));
return -EINVAL;
}
printk("HERE!!!!!!!!!!!!!!!!!!!\n");
drv_data->i2c_addr = DT_INST_REG_ADDR(0);

I'm pretty sure I'm doing something but not entirely sure where.

  • sure

     &i2c0 {
    	compatible = "nordic,nrf-twim";
    	status = "okay";
    	ov7670@43 {
    		compatible = "ovti,ov7670";
    		label = "ov7670";
    		reg = <0x43>;
    		data-gpios = <&gpio0 0 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>,
    			  <&gpio0 1 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>,
    			  <&gpio0 5 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>,
    			  <&gpio0 6 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>,
    			  <&gpio0 7 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>,
    			  <&gpio0 8 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>,
    			  <&gpio0 9 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>,
    			  <&gpio0 10 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;       
    
    		vsync-gpios = < &gpio0 15 (GPIO_PULL_UP | GPIO_ACTIVE_LOW) >;
    
       		hsync-gpios = < &gpio0 14 (GPIO_PULL_UP | GPIO_ACTIVE_LOW) >;
    
       		pclk-gpios = < &gpio0 13 (GPIO_PULL_UP | GPIO_ACTIVE_LOW) >;
    
       		xclk-gpios = < &gpio0 12 (GPIO_PULL_UP | GPIO_ACTIVE_LOW) >;
    	};
    };
    description: OV7670 CMOS video sensor
    
    compatible: "ovti,ov7670"
    
    properties:
        reset-gpios:
          type: phandle-array
          required: false
          description: |
            The RESETn pin is asserted to disable the sensor causing a hard
            reset.  The sensor receives this as an active-low signal.
        
        data-gpios:
          type: phandle-array
          required: false
        
        vsync-gpios:
          type: phandle-array
          required: false
        
        hsync-gpios:
          type: phandle-array
          required: false
        
        pclk-gpios:
          type: phandle-array
          required: false
        
        xclk-gpios:
          type: phandle-array
          required: false
    
    include: i2c-device.yaml

  • I am sorry, Due to start of holiday season and my travel  I could not respond to you meanwhile, I will try to respond to you by Friday.

    Thanks for your patience

  • I have reviewed your changes and nothing seems to comeout as the culprit for this behavior.

    if you have "zephyr_library()" in your CMakeLists.txt file, and check if your driver is properly initialized. You can do this by starting your program in the debug mode to see if the driver exits with no errors.

  • Turns out I was missing an external clock for the camera

Related