AR1820 on Raspberry Pi 4

I’m using a raspberry pi 4, and running the included examples for testing a new AR1820 board. I can talk to the camera over I2C, but collecting an image fails.

./list_formats gives the following:

Hardware Platform: c03111
Found sensor ar1820 at address 37
mode: 0, width: 640, height: 480, pixelformat: pgAA, desc: (null)
mode: 1, width: 1232, height: 920, pixelformat: pRAA, desc: (null)
mode: 2, width: 1920, height: 1080, pixelformat: pRAA, desc: (null)
mode: 3, width: 2456, height: 1842, pixelformat: pRAA, desc: (null)
mode: 4, width: 4912, height: 3684, pixelformat: pRAA, desc: (null)
index: 0, CID: 0x00980914, desc: V4L2_CID_HFLIP, min: 0, max: 1, default: 0, current: 0
Get ctrl V4L2_CID_VFLIP fail.
index: 1, CID: 0x00980915, desc: V4L2_CID_VFLIP, min: 0, max: 1, default: 0, current: 0
index: 2, CID: 0x00980911, desc: V4L2_CID_EXPOSURE, min: 0, max: 65535, default: 1606, current: 1000
index: 3, CID: 0x00980913, desc: V4L2_CID_GAIN, min: 1, max: 16, default: 16, current: 2
Get ctrl V4L2_CID_RED_BALANCE fail.
index: 4, CID: 0x0098090E, desc: V4L2_CID_RED_BALANCE, min: 0, max: 511, default: 64, current: 0
Get ctrl V4L2_CID_BLUE_BALANCE fail.
index: 5, CID: 0x0098090F, desc: V4L2_CID_BLUE_BALANCE, min: 0, max: 511, default: 64, current: 0
close camera status = 0

./python/capture_raw.py yields:

Open camera…
Hardware Platform: c03111
Found sensor ar1820 at address 37
Setting the resolution…
mmal: Failed to start sensor.
mmal: Failed to enable camera
set_resolution: Unexpected result.

Is this likely a connection issue and I should just keep trying to re-seat the ribbon cable?

Thanks.

 

Hi,

Sorry to hear your problems. We have tested our SDK and It can works normally.

Please try to re-seat the ribbon cable and restart again .

I’ve still failed to get the board to connect.

I also have a USB3.0 shield with an AR0135 monochrome attached. This combination works well. I can find the config file for the USB2.0 camera shield MIPI connection to the AR1820HS, but I don’t see a version for the USB3.0 camera shield. Will the AR1820HS not work with a USB3.0 shield?

I’ve tried two cables and no luck. Also swapped out for a PiCamera V2. That operates. So I know the PI is in good shape.

Hi,

Sorry to hear your problems. Yesterday, I have the same problems with you.

I have optimized our mipi camera library please download our new MIPI_Camera and make install again to try.
Let me know if you need more help. Don’t worry , I will try my best to help you.

 

 

 

Thank you. I appreciate the help.

I downloaded the new version. I still get a similar error. Although now the python capture_raw gives me a nice error return.

Python capture_raw

Open camera…
Hardware Platform: c03111
Found sensor ar1820 at address 37
Setting the resolution…
mmal: Failed to start sensor.
mmal: Failed to enable camera
set_resolution: Unexpected result 3.

./capture_raw

Open camera…
Hardware Platform: c03111
Found sensor ar1820 at address 37
Setting the resolution…
Can’t open the file
mmal: Failed to fix lens shading, use the default mode!
mmal: Failed to start sensor.
mmal: Failed to enable camera
set resolution status = 3

./arducamstill -t 0 -m 1 -awb 0 -ae 0 -rgain 0 -bgain 0

Open camera…
Hardware Platform: c03111
Found sensor ar1820 at address 37
mode: 0, width: 640, height: 480, pixelformat: pgAA, desc: (null)
mode: 1, width: 1232, height: 920, pixelformat: pRAA, desc: (null)
mode: 2, width: 1920, height: 1080, pixelformat: pRAA, desc: (null)
mode: 3, width: 2456, height: 1842, pixelformat: pRAA, desc: (null)
mode: 4, width: 4912, height: 3684, pixelformat: pRAA, desc: (null)
index: 0, CID: 0x00980914, desc: V4L2_CID_HFLIP, min: 0, max: 1, default: 0, current: 0
index: 1, CID: 0x00980915, desc: V4L2_CID_VFLIP, min: 0, max: 1, default: 0, current: 0
index: 2, CID: 0x00980911, desc: V4L2_CID_EXPOSURE, min: 0, max: 65535, default: 1606, current: 1000
index: 3, CID: 0x00980913, desc: V4L2_CID_GAIN, min: 1, max: 16, default: 16, current: 2
index: 4, CID: 0x0098090E, desc: V4L2_CID_RED_BALANCE, min: 0, max: 511, default: 64, current: 64
index: 5, CID: 0x0098090F, desc: V4L2_CID_BLUE_BALANCE, min: 0, max: 511, default: 64, current: 64
mmal: Failed to start sensor.
mmal: Failed to enable camera
set resolution status = 3

./list_format

Hardware Platform: c03111
Found sensor ar1820 at address 37
mode: 0, width: 640, height: 480, pixelformat: pgAA, desc: (null)
mode: 1, width: 1232, height: 920, pixelformat: pRAA, desc: (null)
mode: 2, width: 1920, height: 1080, pixelformat: pRAA, desc: (null)
mode: 3, width: 2456, height: 1842, pixelformat: pRAA, desc: (null)
mode: 4, width: 4912, height: 3684, pixelformat: pRAA, desc: (null)
index: 0, CID: 0x00980914, desc: V4L2_CID_HFLIP, min: 0, max: 1, default: 0, current: 0
index: 1, CID: 0x00980915, desc: V4L2_CID_VFLIP, min: 0, max: 1, default: 0, current: 0
index: 2, CID: 0x00980911, desc: V4L2_CID_EXPOSURE, min: 0, max: 65535, default: 1606, current: 1000
index: 3, CID: 0x00980913, desc: V4L2_CID_GAIN, min: 1, max: 16, default: 16, current: 2
index: 4, CID: 0x0098090E, desc: V4L2_CID_RED_BALANCE, min: 0, max: 511, default: 64, current: 64
index: 5, CID: 0x0098090F, desc: V4L2_CID_BLUE_BALANCE, min: 0, max: 511, default: 64, current: 64
close camera status = 0

I also have an image of my connection. I think its okay. https://drive.google.com/file/d/1C4ir5ybXwegGefxUb2fFFENGpyx4CW5w/view?usp=sharing

 

Thank again!

Hi,

Sorry for my later reply due to our Chinese New Year’s holiday.

After we tested, we find some AR1820 sensor, it need to use the hardware i2c bus.

Please try this lib.

I might have the same problem, what exactly do I do with this file to solve it?

Hi,

You just download it and unzip it. Then copy it to your MIPI_Camera/RPI/lib/ path

then run those commands:

> cd MIPI_Camera/RPI

> make install

 

I’m having the same issues as well. I’ve unziped and added the file to MIPI_Camera/RPI/lib/ path and then ran the make install.

Still not able to take a photo with mode 4.

All other modes work okay for me.

[email protected]:~/MIPI_Camera/RPI $ ./arducamstill -t 100 -m 4 -awb 0 -ae 0 -rgain 0 -bgain 0 -o test
Open camera…
Found sensor ar1820 at address 37
mode: 0, width: 640, height: 480, pixelformat: pgAA, desc: (null)
mode: 1, width: 1232, height: 920, pixelformat: pRAA, desc: (null)
mode: 2, width: 1920, height: 1080, pixelformat: pRAA, desc: (null)
mode: 3, width: 2456, height: 1842, pixelformat: pRAA, desc: (null)
mode: 4, width: 4912, height: 3684, pixelformat: pRAA, desc: (null)
index: 0, CID: 0x00980914, desc: V4L2_CID_HFLIP, min: 0, max: 1, default: 0, current: 0
index: 1, CID: 0x00980915, desc: V4L2_CID_VFLIP, min: 0, max: 1, default: 0, current: 0
index: 2, CID: 0x00980911, desc: V4L2_CID_EXPOSURE, min: 0, max: 65535, default: 1606, current: 529
index: 3, CID: 0x00980913, desc: V4L2_CID_GAIN, min: 1, max: 16, default: 16, current: 14
index: 4, CID: 0x0098090E, desc: V4L2_CID_RED_BALANCE, min: 0, max: 511, default: 64, current: 106
index: 5, CID: 0x0098090F, desc: V4L2_CID_BLUE_BALANCE, min: 0, max: 511, default: 64, current: 106
len = 4
name= test
Big resolution, set the cell_size to 128.
Failed to set focus, the camera may not support this control.
Failed to set focus, the camera may not support this control.
Start preview…
Current mode: 4, width: 4912, height: 3684, pixelformat: pRAA, desc: (null)
mmal: Enable JPEG encoder.

usrvcsm: [vcsm_malloc_cache]: [1288] [mmal_vc_port buffer]: ioctl mem-alloc FAILED [-1] (hdl: 0)
usrvcsm: [vcsm_vc_hdl_from_hdl]: [1288]: invalid device or handle!
usrvcsm: [vcsm_lock]: [1288]: invalid device or invalid handle!
mmal: mmal_vc_shm_alloc: could not allocate 54465280 bytes of shared memory (handle 0) - mem (nil), vc_hdl 00000000
mmal: mmal_vc_port_payload_alloc: vc.ril.image_encode:out:0(JPEG): failed to allocate 54465280 bytes of shared memory
mmal: mmal_pool_initialise_buffer_headers: failed to allocate payload 0/1
mmal: Failed to create isp output pool.
Segmentation fault

Hi it it due to the memory of the GPU is too small. Please try to resize the GPU memory. You can open the /boot/config.txt file and change the gpu memory following the user guide here https://github.com/ArduCAM/MIPI_Camera/tree/master/RPI

Thanks for that. Resizing the memory did the trick. I had it at 180 (recommended for the 16mp and above) but changing it to 360 made it work.

Thanks!

I applied the libarducam_mipicamera.so that was provided, and it worked like a charm.

Thanks for the help!

Hi,

Great to hear you have got good progress.