OV9281 (UC-599) not being detected, need help

Hi Everyone,

I’ve bought an Arducam OV-9281 module with MIPI connection and am using it with a Raspberry Pi version 3.

I have followed the following steps and reached a dead end, I need help capturing images, any help about what I am doing incorrectly or am missing would be highly appreciated.

I have git cloned https://github.com/ArduCAM/MIPI_Camera.git (87774fc0d1f77b79e1de7909ec1f10da9eb5743a)

running ./capture:

./capture

Open camera…
init camera status = -1

I am using a raspberry pi: (from dmesg)

Raspberry Pi 3 Model B Rev 1.2

Ubuntu xenial, uname -a:

kernel version Linux dynamic 4.4.0-1118-raspi2 #127-Ubuntu SMP Tue Jul 30 16:43:05 UTC 2019 armv7l armv7l armv7l GNU/Linux

Via strace I see the following: (select output lines to show things are installed and devices are available)

open("/usr/lib/libarducam_mipicamera.so", O_RDONLY|O_CLOEXEC) = 3
open("/dev/vcsm", O_RDWR|O_LARGEFILE) = 3
Open camera…
open("/dev/vchiq", O_RDWR|O_LARGEFILE) = 4
[pid 1437] stat64("/usr/sbin/i2cdetect", {st_mode=S_IFREG|0755, st_size=13924, …}) = 0
[pid 1438] execve("/usr/sbin/i2cdetect", [“i2cdetect”, “-y”, “0”], [/* 29 vars */]) = 0
[pid 1438] open("/dev/i2c-0", O_RDWR) = 5

I enabled the vc i2c bus:

cat /boot/firmware/config.txt

gpu_mem=128
enable_uart=1
kernel=uboot.bin
device_tree_address=0x02008000
dtparam=i2c_vc=on
disable_splash=1

I can see the device after boot:

ls -l /dev/i2c-0

crw-rw---- 1 root i2c 89, 0 Feb 11 2016 /dev/i2c-0

dmesg | grep -i i2c

[ 2.870514] i2c /dev entries driver
[ 8.171671] bcm2708_i2c 3f205000.i2c: BSC0 Controller at 0x3f205000 (irq 83) (baudrate 100000)

 

I can see some devices with i2cdetect.

i2cdetect -y 0

0 1 2 3 4 5 6 7 8 9 a b c d e f
00: – – – – – – – – – – – – –
10: – – – – – – – – – – – – 1c – – –
20: – – – – – – – – – – – – – – – –
30: – – – – – – – – – – – – – – – –
40: – – – 43 – – – – – – – – – – – –
50: – – – – – – – – – – – – – – – –
60: – – – – – – – – – – – – – – – –
70: – – – – – – – –

Running the utility in MIPI_Camera/RPI/util gives the following:

bash camera_i2c

setting GPIO for board revsion: a02082
Raspberry Pi3B / Pi3B+ / 3A / 4B(1G/2G/4G)
Set state of 133 to 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: – – – – – – – – – – – – –
10: – – – – – – – – – – – – 1c – – –
20: – – – – – – – – – – – – – – – –
30: – – – – – – – – – – – – – – – –
40: – – – 43 – – – – – – – – – – – –
50: – – – – – – – – – – – – – – – –
60: – – – – – – – – – – – – – – – –
70: – – – – – – – –

I have a bare raspberry pi with the UC-599 connected via the bus. I’ve double checked the ribbon connection. The board works with another non global shutter camera via the same MIPI connector, ruling out a problem with the RPI itself.

I am left with either a problem with my configuration, the connection, or the arducam itself.

Thanks in advance for any help,

Alon

Replying to myself, and to anyone seeing the same problem:

Trying with bionic mate everything works as advertised.

Now I’m left to figure out the difference compared to my xenial image.

I think it will be firmware - since the error is early on, no i2c device detected.

When everything works it appears as address 60.

I’m going to copy the firmware from the bionic to the xenial and see if that solves the issue.

Alon

linked to : https://github.com/ArduCAM/MIPI_Camera/issues/16

@alon

The OV9281 module has a power enable pin which is controled by the CSI-2 port GPIO.

In our library, it will be pulled high to enable the camera first and then bring up the camera.

So you can not simplely using i2c-detect to detect the camera module if it is not running.

Thanks, that makes sense.

Meanwhile I got my 16.04 working by doing a rpi-update (install and then run). It remained with the previous kernel & initrd.img but updated apparently enough (dtb at the minimum since I saw it’s size change, maybe other files) to get everything working.

So I consider this issue closed.

@alon

Good to hear that it starts working now. Let us know if you need more help from us.

Hi Lee,

 

I’d appreciate your further help with a new board, Balena FIN v1.1, based on the compute module 3 (CM3).

Same symptoms: no i2c bringup.

Verified voltage via the board: 3.325 V (between VCC and GND holes)

Same board as this thread, just changed the RPI board to Balena FIN and CM3.

Using raspbian:

pi@balenabr:~/MIPI_Camera/RPI $ uname -r 4.19.66-v7+ pi@balenabr:~/MIPI_Camera/RPI $ cat /etc/debian_version 9.11 pi@balenabr:~/MIPI_Camera/RPI $ dmesg | head -5 [ 0.000000] Booting Linux on physical CPU 0x0 [ 0.000000] Linux version 4.19.66-v7+ (dom@buildbot) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611)) #1253 SMP Thu Aug 15 11:49:46 BST 2019 [ 0.000000] CPU: ARMv7 Processor [410fd034] revision 4 (ARMv7), cr=10c5383d [ 0.000000] CPU: div instructions available: patching division code [ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache pi@balenabr:~/MIPI_Camera/RPI $ i2cdetect -y -r 0 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- 6c -- -- -- 70: -- -- -- -- -- -- -- --

pi@balenabr:~/MIPI_Camera/RPI $ cat /boot/config.txt | grep -v ‘#’ | uniq

dtoverlay=balena-fin-updated

dtparam=i2c_vc=on
start_x=1


Any help appreciated,

Alon

Hi,

The CM3 is different from the Pi 3 module, Using CM3 module, you should config the i2c pin in the dtb file visiting https://www.raspberrypi.org/documentation/hardware/computemodule/cmio-camera.md

Then using our demo for CM3 herehttps://github.com/ArduCAM/MIPI_Camera/blob/master/RPI/preview-camera0.c

Hi,

I’ve since gotten the RPi camera to work on the Balena Fin v1.1 that I am using. The shutdown/power and the LED pins are at GPIO 44 and 45 respectively.

 

With the arducam I got it to appear on the I2C bus scan once I drove 44 up (power enable), and I got your utilities with the following change to pass arducam_init_camera2, but I could not take an image.

 

I know that the board is fine and that the MIPI is hooked up to the CM3 correctly because I managed to take an image using the raspberry pi camera.

 

So I am left trying to figure out why I cannot with the arducam. I would appreciate any help in the matter.

 

Here are more details:

The Balena Fin v1.1 is wired as the following:

MIPI 15 pin connector - pin 11 = CAM1_IO0_EXT = CAM1_IO0 = GPIO 44 (pin 82) - pin 12 = CAM1_IO1_EXT = CAM1_IO1 = GPIO 45 (pin 84) - pin 13 = CAM1_SCL_EXT = I2C0_SCL = GPIO 1 (pin 5) - pin 14 = CAM1_SDA_EXT = I2C0_SDA = GPIO 0 (pin 3)
I am using the following raspberry pi firmware (start_x.elf and fixup_x.dat):
$ strings /boot/firmware/start_x.elf | grep -E '(VC_BUILD_ID_VERSION)|(VC_BUILD_ID_TIME)' VC_BUILD_ID_TIME: 16:45:17 VC_BUILD_ID_TIME: Nov 19 2019 VC_BUILD_ID_VERSION: 2354eac70a98807e06bed2149bc0c5613e751c15 (clean)
The relevant output from gpio readall and from i2cdetect -y 0:
$ gpio readall | sed -e 's/| |/|\n|/' | grep -E '( 0 | 1 |44|45)' | 0 | ALT0 | High | | 1 | ALT0 | High | | 44 | OUT | High | | 45 | OUT | High | robot@brapchi:~/MIPI_Camera/RPI/utils$ i2cdetect -y 0 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: 60 -- -- -- -- -- -- -- -- -- -- -- 6c -- -- -- 70: 70 -- -- -- -- -- -- --
My camera_interface in capture_raw.c:
struct camera_interface cam_interface = { .i2c_bus = 0, // /dev/i2c-0 or /dev/i2c-1 .camera_num = 0, // mipi interface num /* timeout */ .sda_pins = {0, 2}, .scl_pins = {1, 3}, .led_pins = {45, 2}, .shutdown_pins ={44, 3},

};


 

The output from camera_raw:

Hardware Platform: a020a0 Found sensor ov9281 at address 60 Setting the resolution... Can't open the file mmal: Failed to fix lens shading, use the default mode! Current resolution is 1280x800 Capture image 1280x800.raw... capture timeout. Close camera...
As you can see I get a capture timeout.

Some more notes:

I found documentation of the ov9281 in the open in the form of linux kernel driver source for the Tegra from Nvidia:

https://gitlab.incom.co/CM-Shield/android_kernel_nvidia_quill.git

Questions that will help me:

  1. Is it possible to see the cause of the camera timeout?

  2. How can the regular camera work but the arducam not work? is it possible that the 44 & 45 GPIO I’m using are not taken into account somehow?

  3. How can I get more information on the specific failure?

Note that I have a serial port connection and that I’ve enabled debug in bootcode.bin, and I’m not seeing any messages.

Here is vcgencmd get_camera and raspistill output when using the raspberry pi camera (not the arducam), so I know the hardware (the Balena Fin v1.1) is working (dtb/dtbo correctly configured)

$ sudo vcgencmd get_camera supported=1 detected=1 $ sudo raspistill -o 20191119.png # serial MESS:00:01:21.349965:0: gpioman: gpioman_get_pin_num: pin FLASH_0_ENABLE not defined MESS:00:01:21.356019:0: gpioman: gpioman_get_pin_num: pin FLASH_0_INDICATOR not defined MESS:00:01:21.483557:0: Using RPI AWB # nothing on stdout $ ls -l 20191119.png -rw-r--r-- 1 root root 2157478 Jan 16 18:48 20191119.png
Hope you can show me the way,

Alon

Hi,

Thanks for choosing Arducam camera. Don’t worry and I will try my best to help you.

For the capture time out, it is due to the CSI interface does not get the camera’s data,

Have you tried to re-connected the ribion cable to CSI interface? It seems the hardware connection exist some problems.

For the second question 2. How can the regular camera work but the arducam not work? is it possible that the 44 & 45 GPIO I’m using are not taken into account somehow?

Sorry I can’t understand it clearly. Using the CM3 board, You should notice two tips:

Firstly, Using our ov9281 sensor, you should use our MIPI Cmera library and notice the hardware connection. For our demo, we use the 28,29,30 for the camera0 and use 0,1,2 for the camera1.

IF you want to use the 44 and 45, you should modify the code and hardware connection.

Notice, for 9281, the official RPI camera does support it .

 

Hi bin,

 

Thanks for the fast response. Let me answer your questions

  1. Maybe the connection is bad? I did my best to rule this out: I reconnected twice, connecting the RPi camera in between: RPi camera works captures (looked at the result to verify it is the expected image), the arducam times out. And I’ll repeat that I know the arducam is ok because I used it successfully with the same ribbon on a RPi 3B board.

  2. Second question not understood, and suggestion to modify the code: I did modify the code as you suggested, I sent the diff. This is how I got to the timeout - otherwise the arducam library fails the arducam_init_camera2 call.

  3. “Notice, for 9281, the official RPI camera does support it .” - you mean I can use raspistill to take a picture? All I get when I try is:

mmal: Cannot read cameara info, keeping the defaults for OV5647

<cut out more failure messages>


a. Can you provide more information on what exactly the arducam library do before the timeout?

b. Maybe there is something I can do on the Raspberry pi firmware side to provide more information that will help you debug this?

c. is the raspiraw library any help here?

d. Is it helpful that the source for the I2C commands for the OV9281 is out in the open?

Just to be clear, I didn’t respond to the image you posted: I am not using the CM3-IO board, I am using a different board, which is why I am constrained to use pins 44 and 45 - that’s the way the board is wired.

 

The board is the Balena Fin v1.1, and it has open schematics you can see here:

https://github.com/balena-io/balena-fin/blob/master/documentation/PDF/balenaFin/v1.1/schematics/20173009_balena-fin_v10.pdf

Hi,

Sorry for my typo. The official raspistill doesn’t support ov9281.

Great to ensure the ribon cable is normal and the camera is normal.

You can detected the i2c address which means the i2c signal is normal.

Have you tested arducam camera using the official IO board?

Have you tried our preview-camera0 demo on your board? (Downloading here:https://github.com/ArduCAM/MIPI_Camera/blob/master/RPI/preview-camera0.c).

From a phenomenon point of view, it seems the CSI interface does not receive any image data.

Will it convenient for you to measure the MIPI signal?

 

Hi,

 

It is not easy for me to check the MIPI signals, I am not proficient with this and the pin sizes are small (i have an oscilloscope but no suitable connectors). I will try. I agree with your conclusion that the MIPI bus is dormant, would like to check it.

I have opened a thread on the balena forum as well, perhaps you can chime in:

 

https://forums.balena.io/t/arducam-b0165-not-working-on-balena-fin-v1-1-the-raspberry-pi-camera-module-v1-does/58751/13

Hi,

OK. We are in Chinese New Year’s holiday. After we come back to company, I will help you test it again and reply you as soon as possible.

 

Hi,

I have a suggestion, you can use raspberrypi Mode 3B to test the camera, because using the mode 3B, you don’t need to configure the dts. We can check if the sensor or your CM3 mode is defective.