First of all, thanks a lot for your work here on the USB shields. Some context : I have a USB2 shield (UC-391 rev.D), working like a charm with the USB test GUI on windows. I’m using it with the AR0134 sensor for its good the sensitivity. My hope is to have a live stacking program for astro photos.
I’m quite use to Java, so before switching to unknown territories with python or C++, I’m trying to access the ArduCamLib with JNA. Which seems to work:
I can scan and autoopen the device, I can write to sensor register and re-read them correctly. This by using the functions defined in ArduCamLib.h
If I understood correctly the C and python code, I proceed as the following :
ArduCam_autoopen
ArduCam_getUsbType (get dev 2 and inf 2)
ArduCam_setboardConfig (according the cfg file entries, 6 settings on 0xD7 and one array[3] on 0xF6)
ArduCam_writeReg_16_16 (according the cfg file entries)(16bit as it is the AR0134)
ArduCam_setMode (continuous, 0x02)
Then I create 2 threads.
Capture thread with:
ArduCam_beginCaptureImage (once)
ArduCam_captureImage (repeatedly)
ArduCam_endCaptureImage (to end)
Reading thread with:
ArduCam_availableImage
ArduCam_readImage (if available image is >0)
It goes all through with no error coming on the return of the ArduCam functions. I can even read correctly the sensor register I set with Java, on the USBtest program.
However, I always get zero on ArduCam_availableImage, and the ArduCam_captureImage function returns 0xFF26, which means USB_CAMERA_USB_TIMEOUT_ERROR according common.h.
Here is the code I wrote so far. It’s really draft and settings are static.
If we manage to have a Java access, I hope it can serve you as well. I’ll try to make a Jar as close as possible to your SDK libs, and examples using the same configuration files.
Oh wow, this is it! Thanks a lot really !
My mistakes were :
Line 65: Confusing with the 12 bits and 8 bits configuration files (0x85 -> 0x05)
Line 108: Register 0x3012 is the integration time, it was too large
Line 192: And of course I should NOT have put a sleep() on the CaptureImage thread ! (I was worried about saturating a thread).
I will now work on correctly use ArduCam_readImage() and not just dump the bytes.
Thank you very much for your efficient support! I will update with my progress.
Have a very nice day!
Hi!
Sure, I would be glad to.
For the moment I should spend a bit of time to better understand the pointer/reference of structures on the JNA side. I can somehow see image data, but I’m making a mistake with ArduCamOutData* &pstFrameData.
But I’m close, and looking forward to write a proper example:
Sorry if I’m a bit too enthusiastic, but I found my mistake and got nice images:
I used a wrong type, so it shifted the value of the image byte array pointer value, thus the incoherent data.
I’m now more confident to continue with config files and raw to color conversion.
Oh, my post was not against you, I knew I did a mistake somewhere. I was very happy to get images and could not resist to share it here
You yet helped me a lot, and in only few a days! I’m really thankful !
I will try to make progress on a proper example. Have a nice day!
I paused the work on it, but not gave up. I was trying to use the AR0134 sensor for astro-photography due to his high pixel sensitivity. I mounted the board on an adapter to use Canon EF prime lens, everything mounted on an equatorial motorized mount. As the aim is to make picture stacking, I then realize how bad my cheap mount is when I tried to integrate pictures for more than 5 minutes. So I need a better hardware setup, however the camera board works like a charm. If I put the integration time to the maximum (around 2 seconds if I remember correctly), I can display in real time the Andromeda galaxy.