Minimum framerate and maximum exposure time on Arducam IMX462 PiVariety

  1. Where did you get the camera module(s)?
    On UCTronics store

  2. Model number of the product(s)?
    IMX462 arducam-pivariety 10-000c

  3. What hardware/platform were you working on?
    Raspberry 4

  4. Instructions you have followed. (link/manual/etc.)
    manual

  5. Problems you were having?
    I would like to confirm mini framerate and max exposure time possible

  6. The dmesg log from your hardware?

  7. Troubleshooting attempts you’ve made?

  8. What help do you need?
    Could you please tell me what are the minimum framerate and maximum exposure time possible on IMX462 arducam-pivariety 10-000c. Thanks

Just to clarify my question, I know that it is stated on Arducam website that PiVariety IMX462 has minimum framerate of 5 fps so it means that I could not get more than 200 ms of exposure, but would like to know if it is a driver limitation rather than technical limitation. Because IMX462 can support far longer exposure like 10 000 ms or more, so it means that I could be able to get framerate of 0.1 fps. Is there any way to modify this : personnalize driver, access to camera through other API than Libcamera ?
Thanks a lot for your help.

I checked, the current limitation is in the firmware of the Pivariety adapter board. The firmware limits the minimum frame rate to 5fps. For the general version (non-customized version) we can only reduce the minimum frame rate to 1fps, if you want to get a lower frame rate, you can send a custom request to [email protected].

Thanks a lot for your reply Wong. I just send an email to sales. So I should receive a new release of the driver ?

What you want is a firmware with a minimum frame rate of 1fps, right?
We haven’t started to modify it. Normally, we don’t need to update the driver, but we need to update the firmware on the Pivariety adapter board.

Hi Wong, yes that’s exactly what I need. If you modify the firmware, can I upload it by myself on the board ? And it also means that max exposure will be 1 000 000 microsec ?
I found this in the driver code, don’t know how what it means and if it must be modified ?
#define arducam_EXPOSURE_MAX 65535

@wong, do you know if the firmware also limit the analog gain and if by updating the firmware it is possible to get higher analog gain ? Best regards

You don’t need to modify it, this is the maximum value of the exposure register and does not represent the exposure time.

The maximum gain is not limited, it is the maximum multiple that we have tested.

Yes, when we have finished modifying the firmware, we will provide a firmware update tool. (Firmware modification will take some time, our engineers I have notified, I will notify you when the firmware is complete)

Hi Wong is the source code of libcamera.cpython-37m-arm-linux-gnueabihf.so available somewhere ?
thanks

We have not yet decided whether to open source it (and the code has not been cleaned up), can you tell me what you need it to do?

Hi @watchever
The firmware of IMX462 has been modified and can now support a minimum of 1fps.
You can tell me your email address, and I will send the update tool via email.

Good news, it was fast. My email xxxxxxxxx Thanks.

Correctly receive firmware upgrade. Will you integrate it by default in the new IMX462 release ?

Regarding the python binding code, it is quite useful for me. I was already trying to bind function from libcamera to python, but it takes time and yours is far more well made. I have tested it for my purposes and it works great and very easy to use. So I hope you will continue to maintain it. If you ever decide to open the code please let me know.

Best regards

@wong, upgrade successful. Thanks a lot.
Just one more question, when I push analog gain to very high level (let’s say 5000), the first few captured frames cleary take into account this higher level of analog gain, but then after few frames the analog gain seems to decrease as if there was an automatic algorithm in the camera firmware that auto adapt the analog gain to come back to a maximum level of analog gain.
Any idea where it could come from ?
Thanks

We need more testing and we will integrate it into the release version after confirming that there is no problem.

I’m not sure whether to open source or not, I will check with my colleagues.

Any test steps? We can refer to your steps for testing.

@wong, you can test following python program and input several value for Analog Gain. You will see that if you input for example 500 for analog gain, the first frames displayed seem to take into account the value of analog gain but then it seems to come back automatically to lower value. Test must be done under very low light.

import libcamera
import cv2
from time import sleep
import threading

class Camera:

    def __init__(self):
        self._cam = libcamera.libcamera()
        ret = self._cam.initCamera(640, 480, libcamera.PixelFormat.RGB888, buffercount=4, rotation=0)
        
        if not ret:
            ret = self._cam.startCamera()
            self.setAutoExposure(False)
            self.setExposureTime(200000)
            self.setAnalogGain(100)            
         
    def startCamera(self):
        while True:
            ret, data = self._cam.readFrame()

            if not ret:
                continue

            frame = data.imageData
            cv2.imshow("image", frame)
            key = cv2.waitKey(50)
            self._cam.returnFrameBuffer(data)
            
    def setAnalogGain(self, ag):
        self._cam.set(libcamera.AnalogueGain, ag)
        
    def setExposureTime(self, et):
        self._cam.set(libcamera.ExposureTime, et)
        
    def setAutoExposure(self, ae):
        self._cam.set(libcamera.AeEnable, False)

if __name__ == "__main__":
        camera = Camera()
        
        camera_thread = threading.Thread(target=camera.startCamera)
        camera_thread.start()

        sleep(5)
        while True:
            rep = input("Enter AnalogGain : ")
            camera.setAnalogGain(int(rep))

@wong, just find in the source code of driver following line :

#define arducam_ANA_GAIN_MAX 232

So maybe for a technical reason there is a limit to set analog gain ?

Hi @watchever

We just tested,
One thing to confirm, the analog gain range of IMX462 is 1.0 ~ 200.0 (v4l2-ctrl -l sees the range divided by 100)
After our testing, it turns out that the first few frames with the gain set are indeed brighter, but can confirm that the brightness is different between 10.0 and 100.0, not sure why this happens, but I think it may just be set Jitter, and finally a steady brightness should be correct.

Anyway, I have reported this issue to our relevant engineer who will look into this issue further.

Ok thanks a lot for your quick reply @wong. Keep me in touch.

@wong do you get any feedback from your engineer regarding the issue on analog gain (if I push analog gain above 100, the frames are brighter for few ms and then become darker.
Thanks