pico micropython MemoryError: memory allocation failed, allocating x bytes #12680
-
Hi all ! With the new Pico-W MicroPython version - [v1.21.0 (2023-10-05) ], I'm trying to run a Waveshare Pico-ResTouchLCD 3.5 code and I get the following error: pico micropython MemoryError: memory allocation failed, allocating 153600 bytes With the previous version, no problem whatsoever. Here's the code (from Waveshare Pico-ResToch-LCD-3.5):
Thank you |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 5 replies
-
I've closed this because It's a problem that I was able to replicate also with the previous version - the one I was running .
Don't know why... |
Beta Was this translation helpful? Give feedback.
-
The line self.buffer = bytearray(self.height * self.width * 2) allocates exactly 153,600 bytes. This is a huge requirement for contiguous RAM and is only likely to succeed if performed very early, prior to other allocations. You might like to look at this doc for a driver form the 320*480 Pico Res Touch. The driver uses 4-bit pixels via a lookup table to get the driver down to a manageable size. |
Beta Was this translation helpful? Give feedback.
-
I have reopened this because in my view the RAM requirement of this Waveshare driver are excessive for its intended host. Users wishing to use this display with MicroPython should be prepared to adapt the driver to use a smaller buffer. |
Beta Was this translation helpful? Give feedback.
-
Thank you @peterhinch . Will try that driver you pointed out. It looks great. |
Beta Was this translation helpful? Give feedback.
I've opened a ticket with waveshare and their answer was that the Pico-ResTouch-LCD-3.5 does not work with the Pico W.
They have great products, but the support lacks sometimes..
Thank you.