Hi
Something in the v4.8.1 firmware seems to use more memory than before. Running below minimal script on a H7 with a MT9V034 GS sensor used to work perfectly fine with v4.7.0:
import sensor
sensor.reset()
sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.VGA)
sensor.set_auto_gain(False, gain_db=0)
sensor.set_auto_exposure(False, exposure_us=1000)
while True:
img = sensor.snapshot()
blobs = img.find_blobs([(255, 255)], merge=False)
With v 4.8.1 I’m getting a “sensor control failed” on the set_auto_gain() line. If I comment out both set_auto_gain() and set_auto_exposure() I get a “Frame buffer overflow, try reducing the frame size”, which I believe is the actual culprit here.
I haven’t seen any issues on the H7+, but obviously that one has way more memory.
I’m getting used to most firmware updates breaking all sorts of stuff that “just worked” before without any warning, but it’s still a bit annoying.
What do I have to do in the script or the firmware itself to get this working again?
Thanks
Best regards
Felix
This one is a bit trickier.
The frame buffer architecture was changed to just allocate frame buffers in a more sane way than before, which did all sorts of stuff to save RAM but made the code really hard to follow. The new format doesn’t do that anymore. In particular, we always reserve 2 bytes per pixel. For the H7… you don’t have enough RAM to store a 2-byte-per-pixel frame without cropping. So VGA is no longer available. We may re-enable this if it can be done and is maintainable. However, special bits for older cameras are not on our roadmap right now.
Anyway, you gotta crop the image with sensor_set_window or switch to QVGA.
If this is not acceptable, I can provide a firmware image that just works for grayscale by making the frame buffer code reserve only 1 byte per pixel instead of 2, so that you are unblocked.
Hi
Thanks for the fast reply.
Indeed, with QVGA it does work, I should have mentioned that.
However I definitely need VGA resolution. I’m even using the full 752 pixels of the GS sensor to have more HFOV (obviously only grayscale).
I appreciate the offer for a custom firmware image, however I have added / am adding my own functionality in the code, so I need to be able to compile myself. That also means it’s not a problem having to patch the code myself.
I looked at a diff between 4.7.0 and 4.8.1 trying to figure out where things have changed w.r.t the framebuffer allocation, but I wasn’t able to identify anything.
Can you point me to the changes I need to do, or send me a patch file for how to change this back to a single byte per pixel?
Thank you
Felix