I recently got my OV5640 camera working with an orange pi PC board, but I've found that after a while of leaving it powered on unused, I'm unable to access /dev/video0.
When it's in this non-working state, trying to access /dev/video0 results in the following in dmesg:
[ 99.571841] [OV5640@lex]CSI_SUBDEV_STBY_OFF!
[ 99.608221] [OV5640@lex]enable oe!
[ 99.609039] [OV5640@lex]sensor write retry=2
[ 99.609050] [OV5640@lex]error at sensor_write_array
[ 99.609058] [OV5640@lex]enable oe falied!
[ 99.609847] [OV5640@lex]sensor write retry=2
[ 99.609856] [OV5640@lex]error at sensor_write_array
[ 99.609864] [OV5640@lex]soft stby off falied!
[ 99.620049] [OV5640@lex]sensor_init 0x0
[ 99.620901] [OV5640@lex]sensor read retry=2
[ 99.620911] [OV5640@lex]error at sensor_detect
[ 99.620919] [OV5640@lex]chip found is not an target chip.
[ 99.620929] [VFE_ERR]sensor initial error when selecting target device!
I've tried toggling many different combinations of the pins that are connected to the CSI port in an attempt to power cycle or reset the camera; RESET, STDBY_EN, CSI_PWR_EN (AVDD), CSI_EN (DVDD), DOVDD (AFCC_EN), the i2c pins, camera clock pins, and data lines. Plus rebooting the pi as well. Nothing seems to get the camera working again. When the pi boots up again, dmesg shows the following, which appears promising:
[ 56.367129] [OV5640@lex]init_sensor - frame_rate: 0, max_win_size: 11
[ 56.442539] [ISP] isp platform_id = 5!
[ 56.462290] [OV5640@lex]CSI_SUBDEV_PWR_ON!
[ 56.530043] [OV5640@lex]sensor_init 0x0
[ 56.570376] [OV5640@lex]CSI_SUBDEV_STBY_ON!
[ 56.570397] [OV5640@lex]sensor_s_release_af
[ 56.582757] [OV5640@lex]disalbe oe!
[ 56.607058] [OV5640@lex]CSI_SUBDEV_STBY_OFF!
[ 56.642114] [OV5640@lex]enable oe!
[ 56.654668] [OV5640@lex]sensor_init 0x0
[ 56.694904] [OV5640@lex]sensor_s_ctrl id: 9963797 - value: 0
[ 56.694924] [OV5640@lex]sensor_s_ctrl id: 9963796 - value: 0
[ 56.695437] [OV5640@lex]CSI_SUBDEV_STBY_ON!
[ 56.695449] [OV5640@lex]sensor_s_release_af
[ 56.707808] [OV5640@lex]disalbe oe!
but then trying to access /dev/video0 results in the same dmesg output as the first; "chip found is not an target chip." etc.
I've also tried physically unplugging the power to the whole orange pi for a minute, and replugging it in, to hard reset the camera, but even this doesn't solve the problem. I actually have to unplug the camera and replug it again for it to work. Frankly this makes no sense to me, the only reasoning I can come up with is the camera cable is getting knocked loose and needs to be reseated, but that's unlikely as this has happened several times to me, and the orange pi & camera sits up high on a shelf, untouched by anyone.
Does anyone have any ideas?
In the mean time I think I'll try to see if the problem still occurs if I'm using the camera continuously; perhaps the camera is entering some kind of standby mode that I can't get it out of again.
Thanks