I've been trying to use Zephyr RTOS and ov2640 cam sensor. I've found the implementation that allows to use this sensor but using espressif SDK, however, I would like to try this using Zephyr.
In general, there is an ov2640 driver sensor available in Zephyr SDK, but I have difficulties using it. I've properly configured a kernel, enabled the driver, and it compiles, but calling the function "device_is_ready" always returns false.
I've enabled the log subsystem and looking at the logs, it seems that the driver fails at early-stage initialization when it tries to read PID and VER registers - in general it's a first attempt to communicate with the sensor.
Here are the logs that are printed to the console when the driver is being initialized:
00:00:01.815,000] <err> i2c_esp32: I2C transfer error: -116
[00:00:01.820,000] <err> i2c_esp32: I2C transfer error: -14
[00:00:01.825,000] <err> i2c_esp32: I2C transfer error: -14
[00:00:01.830,000] <err> ov2640: failed to write 0x1 to 0xff
[00:00:01.830,000] <err> i2c_esp32: I2C transfer error: -14
[00:00:01.835,000] <err> i2c_esp32: I2C transfer error: -14
[00:00:01.841,000] <err> i2c_esp32: I2C transfer error: -14
[00:00:01.846,000] <err> ov2640: failed to read 0xa register
[00:00:01.846,000] <err> i2c_esp32: I2C transfer error: -14
[00:00:01.851,000] <err> i2c_esp32: I2C transfer error: -14
[00:00:01.856,000] <err> i2c_esp32: I2C transfer error: -14
[00:00:01.861,000] <err> ov2640: failed to read 0xb register
[00:00:01.861,000] <err> ov2640: OV2640 not detected
The explanation for error codes is as follows:
- -116 -> ETIMEDOUT
- -14 -> EFAULT
The device tree overlay I've created:
&pinctrl {
i2c_cam: i2c_cam {
pinmux = <I2C0_SDA_GPIO26>,
<I2C0_SCL_GPIO27>;
bias-pull-up;
drive-open-drain;
};
};
&i2c0 {
sda-gpios = <&gpio0 26 (GPIO_PULL_UP | GPIO_OPEN_DRAIN)>;
scl-gpios = <&gpio0 27 (GPIO_PULL_UP | GPIO_OPEN_DRAIN)>;
pinctrl-0 = <&i2c_cam>;
pinctrl-names = "default";
ov2640: ov2640@30 {
compatible = "ovti,ov2640";
status = "okay";
reg = <0x30>;
};
};
I don't expect this to be fully working, I would be satisfied if the sensor at least answered with something, then I would know that I'm on the right track, but now it seems that it doesn't respond at all.
I've tested it with Espressif and it works fine.
Does anyone have any idea what's wrong here?