# Frame buffer overflow! How to adjust the Frame buffer without changing the code

**URL:** <https://forums.openmv.io/t/frame-buffer-overflow-how-to-adjust-the-frame-buffer-without-changing-the-code/11593>\
**Category:** OpenMV Boards\
**Created:** [April 12, 2026, 11:34am UTC](https://forums.openmv.io/t/frame-buffer-overflow-how-to-adjust-the-frame-buffer-without-changing-the-code/11593 "2026-04-12T11:34:42Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![tangtang](https://avatars.discourse-cdn.com/v4/letter/t/b38774/32.png) [@tangtang](https://forums.openmv.io/u/tangtang)\
**Post date:** [April 12, 2026, 11:34am UTC](https://forums.openmv.io/t/frame-buffer-overflow-how-to-adjust-the-frame-buffer-without-changing-the-code/11593/1 "2026-04-12T11:34:42Z")

</div>

I downloaded the firmware from [OpenMV · GitHub](http://github.com/openmv) for openmv4,and copied the main.py to the disk,The program is running normally.

but to freeze scripts to do the following:  
1 Add the boot.py to the libraries folder.  
2 Edit the manifest.py in the boards/OPENMV4,adding freeze (“$(OMV\_LIB\_DIR)/”, “boot.py”) to the manifest.py file  
3 generate the firmware image for your OpenMV Cam.

when use diy firmware,I got the error message from uart,“Traceback (most recent call last):  
File “boot.py”, line 85, in  
RuntimeError: Frame buffer overflow, try reducing the frame size.  
OpenMV 5fb041dc9a; MicroPython 7c5ab76686; OPENMV4 with STM32H743，”

How to adjust the Frame buffer of the openmv4 without changing the code from sensor.VGA to sensor.QVGA?

the codes of the boot.py is below:  
`import sensor, time`  
`sensor.reset()`  
`sensor.set_pixformat(sensor.GRAYSCALE)`  
`sensor.set_framesize(sensor.VGA)`  
`sensor.skip_frames(time=200)`  
`clock = time.clock()`  
`def find_light_spots(img):`  
`blobs = img.find_blobs([(200, 255)],`  
`area_threshold=20,`  
`merge=True,`  
`margin=2`  
`)`  
`lastBlobs = `  
`for blob in blobs:`  
`if (blob.area() < 400):`  
`if blob.roundness() > 0.4 and blob.density() > 0.5:`  
`lastBlobs.append(blob)`  
`detected = `  
`if len(lastBlobs) >= 1:`  
`lastBlobs.sort(key=lambda b: b.area(), reverse=True)`  
`detected = [(b.cx(), b.cy()) for b in lastBlobs[:min(2, len(lastBlobs))]]`  
`return detected`  
`def show_debug_info(img, spots):`  
`img.draw_string(5, 5, f"blob Num {len(spots)}“, color=255, scale=2)`  
`if len(spots) == 0:`  
`return`  
`colors = [255, 200]`  
`for i, (u, v) in enumerate(spots):`  
`img.draw_circle(int(u), int(v), 6, color=colors[i])`  
`img.draw_string(int(u)+5, int(v)-20, f"P{i}”, color=255)`  
`img.draw_string(5, 20+15`_`i, f"P{i}: ({spots[i][0]}, {spots[i][1]})“, color=200, scale=fontScale)`  
 `try:`  
 `while True:`  
 `img = sensor.snapshot()`  
 `spots = find_light_spots(img)`  
 `if debug:`  
 `show_debug_info(img, spots)`_  
`except KeyboardInterrupt:`  
`print(“\nsystem is stopped”)`

---

<div class="post-metadata">

**Author:** ![falthaus](https://avatars.discourse-cdn.com/v4/letter/f/91b2a8/32.png) [@falthaus](https://forums.openmv.io/u/falthaus)\
**Post date:** [April 12, 2026, 4:03pm UTC](https://forums.openmv.io/t/frame-buffer-overflow-how-to-adjust-the-frame-buffer-without-changing-the-code/11593/2 "2026-04-12T16:03:00Z")

</div>

Hi

I had the same issue with using grayscale VGA on the H7 a while ago. Seems the framebuffer architecture has been changed in a way that uses more memory now, which the H7 doesn’t have.

See details here: [V4.8.1. breaking VGA on H7](https://forums.openmv.io/t/v4-8-1-breaking-vga-on-h7/11475)

And this is the commit with the changes I’ve implemented on my fork to fix it: [Changed to fixed 1 byte/pixel framebuffer for H7 · falthaus/openmv@a004937 · GitHub](https://github.com/falthaus/openmv/commit/a00493763abb96f5b59288f976fd0bd8b3ff8bab)

Maybe this helps  
Felix

---

<div class="post-metadata">

**Author:** ![kwagyeman](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwagyeman/32/4_2.png) [@kwagyeman](https://forums.openmv.io/u/kwagyeman)\
**Post date:** [April 12, 2026, 7:24pm UTC](https://forums.openmv.io/t/frame-buffer-overflow-how-to-adjust-the-frame-buffer-without-changing-the-code/11593/3 "2026-04-12T19:24:21Z")

</div>

I’ve made a bug tracker for this issue: [Examine if using 1bpp is possible with new CSI FB Arch. · Issue #3103 · openmv/openmv · GitHub](https://github.com/openmv/openmv/issues/3103)

It might not be possible, but I will examine if it’s fixable. Note that this may not make it into the V5.0.0 release.

---

<div class="post-metadata">

**Author:** ![kwagyeman](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwagyeman/32/4_2.png) [@kwagyeman](https://forums.openmv.io/u/kwagyeman)\
**Post date:** [April 13, 2026, 4:57am UTC](https://forums.openmv.io/t/frame-buffer-overflow-how-to-adjust-the-frame-buffer-without-changing-the-code/11593/4 "2026-04-13T04:57:43Z")

</div>

I found an easy way to fix this with the new csi API: [modules: Add raw\_bpp control from py\_csi\_ng. by kwagyeman · Pull Request #3104 · openmv/openmv · GitHub](https://github.com/openmv/openmv/pull/3104)

---

<div class="post-metadata">

**Author:** ![tangtang](https://avatars.discourse-cdn.com/v4/letter/t/b38774/32.png) [@tangtang](https://forums.openmv.io/u/tangtang)\
**Post date:** [April 13, 2026, 7:26am UTC](https://forums.openmv.io/t/frame-buffer-overflow-how-to-adjust-the-frame-buffer-without-changing-the-code/11593/5 "2026-04-13T07:26:54Z")

</div>

thanks for your reply,It’s perfect.

---

<div class="post-metadata">

**Author:** ![tangtang](https://avatars.discourse-cdn.com/v4/letter/t/b38774/32.png) [@tangtang](https://forums.openmv.io/u/tangtang)\
**Post date:** [April 13, 2026, 7:28am UTC](https://forums.openmv.io/t/frame-buffer-overflow-how-to-adjust-the-frame-buffer-without-changing-the-code/11593/6 "2026-04-13T07:28:50Z")

</div>

> [@falthaus](#):
>
> Changed to fixed 1 byte/pixel framebuffer for H7

thanks for your reply,I changed 1byte/pixel for my H7
