Capture 'NULL pointer access' after first run - Camera not being released?

Reposting here from “Multi-Camera and Sync Stereo Camera HAT” sub, hoping someone in this community has an answer.

 

I’ve run into a curious problem in executing capture.py in the MIPI_Camera/RPI/python folder.

The first time I run it after a reboot the program works great and captures an image, with a “Close camera” message at the end (as expected). Consistently, this works after a reboot.

However, if I attempt to run the script a second (or more) time it invariably hangs and ends with a message of “NULL pointer access”. This message presents right after it enables AWB, and right after the normal system return of “mmal: Enable JPEG encoder.” However, no file is created on the second and subsequent runs. A reboot is required to make it work again, but it only works again once after the reboot.

After I get the NULL message, the command ‘arducamstill’ does not work from the command line either. Arducamstill either hangs right after trying to set the autofocus, or it returns an error code ‘init camera status = 4100″.

The NULL message is being thrown by capture.py when it commands ‘frame.as_array.tofile(name)’ in calling line 269 of arducam_mipicamera.py (the ‘def as_array(self)’ statement).

It is as if the camera is never fully released with the ‘camera.close_camera()’ command the first time I run capture.py, and the when I run it the second time (or when I try to run arducamstill) the script cannot initiate/access the cameras. I think this is causing the NULL error as there is no data in ‘frame’ to pass to the ‘as_array’ module since there is no data coming from the still open/frozen cameras in the second and subsequent attempts to run the script.

Since capture.py runs well so consistently AFTER a reboot, I do not think it is related to the data ribbons – though I have re-seated all of them.

Is there any way I can overcome this? If my theory is correct, is there another way to make sure that the cameras are fully closed/released at the end of capture.py?

 

1.Which seller did you purchase the product(s) from?
UCTRONICS
2.The Model number of the product(s) you have purchased?
B0265R Arducam 12MP*2 Synchronized Stereo Camera Bundle Kit for Raspberry Pi, Two 12.3MP IMX477 Camera Modules with CS Lens and Camarray Stereo Camera HAT
3.Which Platform are you using the product(s) on?
Raspberry Pi 4B 4gb
4.Which instruction are you following?
online
5.Has your product ever worked properly?
yes, intermittently
7.What attempts at troubleshooting have you already made?
various hardware and software troubleshooting changes/steps
8.How would you like us to help you?
Guidance on how to be able to run capture.py more than once between reboots
7.What attempts at troubleshooting have you already made?

8.How would you like us to help you?

yeah i have a similar issue and wouldve hoped there is a “reset camera” function wich could possibly solve that issue.

I’ve now swapped out the ribbon cable from the HAT to the Pi, and it provided no help.

It’s been nearly 4 weeks now and I have not seen a reply - is there another avenue which is better for receiving support on Arducam products?

Otherwise, I may be seeking my options in returning this hardware, as right now it is rather useless for programmatically capturing images and seems to only work if you want to manually type terminal commands to capture a single image after some delay.