Hi, I’m having trouble running my camera from Python. I can’t change the exposure, focus, or the ISP settings unless I open the GUI and change them from there. When I try to do it through the Python demo / config file, the config file seems like it’s not being loaded at all, or it just isn’t taking effect. Has anyone run into this? I feel like I’m missing something obvious.
Hi, happy to help. To narrow this down, can you tell me which camera shield model you’re using and which platform you’re on? Also, which demo/instructions are you following? That way I can point you at the right config file and registers.
Sure. The board is a USB3.0_UC-593 Rev.C (USB Camera Shield).
I’m testing on both:
- Windows 10
- Raspberry Pi 4 4GB running RaspiOS 64-bit
I’m following the demo here:
I already tried changing the cfg_mode param in the cfg file from 0 (UI) to 1 (This cfg file), thinking it would force it to use my file. But nothing works. I also opened a forum topic about it earlier:
Thanks, that helps a lot. Here’s the key thing for the USB3.0 camera shield board: it has an ISP module, but the sensor itself is a raw sensor. Because of that, it is NOT correct to use the ISP to control the exposure time. In ArduCam’s config file, the exposure line register is wired to control the exposure time directly, not through the ISP.
So what you want to do is:
- Open the config file.
- Find the relevant exposure register.
- Write your value to that register to control the exposure time directly.
Don’t try to drive exposure through the ISP — since the sensor is raw, exposure is handled by writing straight to the exposure line register in the config file. Give that a shot and let me know if you need more help.
That worked — I can now change the exposure and gain through the config file using that register, thank you.
A couple more things I’m stuck on:
- You mentioned the ISP has its own module. How do I access / modify that register?
- I also looked at the board parameters for focus adjustment — how do I modify that one?
I noticed that the ISP and Focus settings both call the same function, SendVR(), and I’m not sure how to change them separately (the setFocus and ISPs sections). This is honestly my first time working with a script/cfg that involves registers/addresses, so I’m a bit lost on where the values actually go.
Great to hear exposure/gain are working now.
On your first question: the ISP and Focus paths both funnel into SendVR() because that’s just the transport function that pushes a value to a register/slave address — it doesn’t by itself decide whether you’re touching the ISP block or the focus block. The difference is in the arguments you pass (which register address and which value), not in the function.
So think of it like this:
- SendVR(slave, register, value) is the generic “write” call.
- The ISPs section builds a call to SendVR() with the ISP register address.
- The setFocus section builds a call to SendVR() with the focus register address.
If you want to modify the ISP register, you change the register address/value used in that ISPs call; if you want to change focus, you edit the address/value in the setFocus call. They share the function, but the addresses are what tell the board which block you’re writing to.
Can you paste the snippet where SendVR() is defined and where setFocus / ISPs call it? I’ll point out exactly which numbers to change for each.
Ah, that makes more sense — I was assuming the function itself was being shared differently.
Here’s the function as it’s called by both ISP and Focus:
SendVR()
And it’s referenced in both the setFocus and ISPs sections. So if I understand you right, I need to change the register address/value in each of those calls, not the function itself? I just want to make sure I edit the right numbers so I don’t break the exposure setting that’s finally working.
Exactly right — leave the SendVR() function definition alone and edit the register address/value at each call site.
To keep your working exposure setting safe:
- The exposure fix you already made lives in its own register line in the config file. Don’t touch that one.
- For the ISPs section, change the register address/value passed into that specific SendVR() call to target the ISP block.
- For the setFocus section, change the register address/value in that specific SendVR() call to target the focus block.
Since both call the same helper, the only thing that distinguishes an ISP write from a focus write is the address (and the value) you hand it. That’s also why editing the function itself won’t help — it has no idea which block you mean.
If you paste the actual setFocus and ISPs blocks (the lines around each SendVR() call), I can tell you which field is the address and which is the value for each, and you can change them one at a time and re-test. I’ve also sent you a couple of reference files privately to compare your config against — check your messages.
Quick summary of where we are: your exposure/gain now work by writing directly to the exposure register in the config file (not via the ISP, since the sensor is raw). For ISP and focus, edit the address/value at the respective SendVR() call sites rather than the shared function. Send those two blocks over and we’ll map the exact fields. If it’s easier, you can also reach us at [email protected].