Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MemoryError MatrixPortal #6402

Closed
Craigxyzzy opened this issue May 16, 2022 · 8 comments
Closed

MemoryError MatrixPortal #6402

Craigxyzzy opened this issue May 16, 2022 · 8 comments
Assignees
Labels
Milestone

Comments

@Craigxyzzy
Copy link

CircuitPython version

Adafruit CircuitPython 7.3.0-rc.0 on 2022-05-15; Adafruit Matrix Portal M4 with samd51j19
Board ID:matrixportal_m4

Code/REPL

from adafruit_matrixportal.matrixportal import MatrixPortal as mp
m = mp(width=64, height=64, bit_depth=6)

# following lines are NOT needed to produce error
# error occurs with or without attached matrix
m.set_background("/bats.bmp")
while True:
    continue

Behavior

Traceback (most recent call last):
File "code.py", line 2, in
File "adafruit_matrixportal/matrixportal.py", line 97, in init
File "adafruit_matrixportal/graphics.py", line 67, in init
File "adafruit_matrixportal/matrix.py", line 192, in init
MemoryError:

Code done running.

Description

Works fine with cp725, fails with 730rc0

Additional information

MatrixPortal part 4745 & matrix part 3649
UF2 Bootloader v3.14.0 SFHWRO
Model: Matrix Portal M4
Board-ID: SAMD51J19A-MatrixPortal-v0

NINA firmware 174

@Craigxyzzy Craigxyzzy added the bug label May 16, 2022
@dhalbert
Copy link
Collaborator

@makermelissa Do you know why this might happen?

@Craigxyzzy so just

m = mp(width=64, height=64, bit_depth=6)

is enough to trigger it? Could you try some of the earlier 7.3.0 beta versions? Thanks.
https://adafruit-circuit-python.s3.amazonaws.com/index.html?prefix=bin/matrixportal_m4/en_US/

@makermelissa
Copy link
Collaborator

Maybe try decreasing the bit depth. This will reduce the number of possible colors, but also decrease memory usage. More information is available here: https://learn.adafruit.com/rgb-led-matrices-matrix-panels-with-circuitpython.

@Craigxyzzy
Copy link
Author

m=mp(width=64,height=64,bit_depth=1) works 730b0
m=mp(width=64,height=64,bit_depth=1) works 730b1
m=mp(width=64,height=64,bit_depth=1) works 730b2
m=mp(width=64,height=64,bit_depth=1) works 730rc0

m=mp(width=64,height=64,bit_depth=2) fails 730b0
m=mp(width=64,height=64,bit_depth=2) fails 730b1
m=mp(width=64,height=64,bit_depth=2) fails 730b2
m=mp(width=64,height=64,bit_depth=2) fails 730rc0

image looks improper on 64x64 matrix:
m=mp(width=32,height=32,bit_depth=1) works 730rc0
m=mp(width=32,height=32,bit_depth=2) works 730rc0
m=mp(width=32,height=32,bit_depth=4) works 730rc0
m=mp(width=32,height=32,bit_depth=6) works 730rc0

works perfectly with 725, should also with 730...
m=mp(width=64,height=64,bit_depth=6) works 725

library files 2022-MAY-15
adafruit_bitmap_font
adafruit_display_text
adafruit_fakerequests.mpy
adafruit_io
adafruit_matrixportal
adafruit_minimqtt
adafruit_portalbase

@makermelissa
Copy link
Collaborator

Yikes. Yeah, a bit_depth of 2 is very low and shouldn't be failing.

@dhalbert dhalbert self-assigned this May 17, 2022
@dhalbert dhalbert added this to the 7.3.0 milestone May 17, 2022
@dhalbert
Copy link
Collaborator

dhalbert commented May 17, 2022

This is failing really early, due to Protomatter (used by RGBMatrix) being unable to allocate a large enough supervisor_allocation. It's not due to the libraries. Still investigating.

@makermelissa
Copy link
Collaborator

I figured this was in the correct place. The libraries are only a wrapper for helping to initialize it.

@dhalbert
Copy link
Collaborator

It appears that there is more fragmentation starting in 7.3.0 than in 7.2.x. It is not clear why, but we started 7.3.0 immediately with the MicroPython 1.18 merge, and a build of the PR merge commit shows the problem.

@Craigxyzzy
Copy link
Author

Success with cp730rc1 - Thank You @dhalbert @tannewt @makermelissa Closing issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants