Board overlay for OV7670

Hi, 

I've trying to get the Omnivision OV7670 to work with the nRF52840-DK. I'm not completely sure whether I've configured it correctly. My pin assignments are adapted from the arduino tutorial: 

and my board overlay is as follows:

 &i2c0 {
	compatible = "nordic,nrf-twi";
	status = "okay";
	ov7670: ov7670@21 {
		compatible = "ovti_ov7670";
		reg = <0x21>;
		label = "ov7670";
		dio: dio {
   			data-gpios = <
						&gpio0 0 (GPIO_PULL_UP | GPIO_ACTIVE_LOW) /* D0 P1.01 */
						&gpio0 1 (GPIO_PULL_UP | GPIO_ACTIVE_LOW) /* D1 P1.02 */
						&gpio0 5 (GPIO_PULL_UP | GPIO_ACTIVE_LOW) /* D2 P1.03 */
						&gpio0 6 (GPIO_PULL_UP | GPIO_ACTIVE_LOW) /* D3 P1.04 */
						&gpio0 7 (GPIO_PULL_UP | GPIO_ACTIVE_LOW) /* D4 P1.05 */
						&gpio0 8 (GPIO_PULL_UP | GPIO_ACTIVE_LOW) /* D5 P1.06 */
						&gpio0 9 (GPIO_PULL_UP | GPIO_ACTIVE_LOW) /* D6 P1.07 */
						&gpio0 10 (GPIO_PULL_UP | GPIO_ACTIVE_LOW) /* D7 P1.08 */
					 >;
   			label = "dio";
   		};
		vsync: vsync {
   			gpios = < &gpio0 15 (GPIO_PULL_UP | GPIO_ACTIVE_LOW) >; /* GPIO P0.00 */
   			label = "vsync";
   		};
   		hsync: hsync {
   			gpios = < &gpio0 14 (GPIO_PULL_UP | GPIO_ACTIVE_LOW) >; /* GPIO P0.00 */
   			label = "hsync";
   		};
   		pclk: pclk {
   			gpios = < &gpio0 13 (GPIO_PULL_UP | GPIO_ACTIVE_LOW) >; /* GPIO P0.00 */
   			label = "pclk";
   		};
   		xclk: xclk {
   			gpios = < &gpio0 12 (GPIO_PULL_UP | GPIO_ACTIVE_LOW) >; /* GPIO P0.00 */
   			label = "xclk";
   		};
	};
};

Is this correct?

Parents Reply
  • I'm still trying to solve this problem. It seems when

    drv_data->i2c = device_get_binding(DT_INST_BUS_LABEL(0));
     
    in the ov7670_init_0 function is executed and its not NULL then the rest of the code is skipped and it goes back to main. So 
    drv_data->i2c_addr = DT_INST_REG_ADDR(0);
    return ov7670_init(dev);
    aren't executed. But when it is NULL the error condition is triggered so the rest of the code in ov7670_init_0 is also not executed. Either way the code after
    drv_data->i2c = device_get_binding(DT_INST_BUS_LABEL(0));
    doesn't run. Is that normal?
Children
  • That seems strange. Are you able to run driver api functions after i2c is not NULL in the init function? After calling device_get_binding?

    The init function will be called before main automatically, then device_get_binding() will just get you a pointer. This pointer is used to access the driver api. You should not be entering the init function when you call device_get_binding in your application.

Related