0

How do I save RAM on my Qt Py?
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

How do I save RAM on my Qt Py?

by CapArcona on Fri Mar 26, 2021 8:01 pm

New to programming and arduino. I have a simple project that is meant to count up and down in two separate values. I keep crashing because python doesn't like using strings, apparently. Should I use a different language or display the count differently? I have just started on trying to use bitmap images of numbers to save RAM since I have ample storage, but it seems really clunky. I'll post code when I get home. Maybe is there a RAM add-on I can solder?

CapArcona
 
Posts: 15
Joined: Wed Mar 03, 2021 4:13 pm

Re: How do I save RAM on my Qt Py?

by mikeysklar on Fri Mar 26, 2021 8:09 pm

This the add-on flash you can add for additional storage. It won't make a difference for program space. You would have to upgrade to an M4 / nRF52 or other processor for more program memory.

https://www.adafruit.com/product/4763

mikeysklar
 
Posts: 4543
Joined: Mon Aug 01, 2016 8:10 pm

Re: How do I save RAM on my Qt Py?

by CapArcona on Tue Mar 30, 2021 5:15 pm

mikeysklar wrote:This the add-on flash you can add for additional storage. It won't make a difference for program space. You would have to upgrade to an M4 / nRF52 or other processor for more program memory.

https://www.adafruit.com/product/4763



okay, thanks. my device already had the chip on, I was just running out of RAM. I've stuck with the same hardware but completely altered my program to free up RAM. is there a better language than python for writing in? I discovered that python doesn't like to get rid of old strings in memory so I can't run the circuitpython libraries to simply display text. otherwise can I alter the libraries themselves to make things run smoother?

CapArcona
 
Posts: 15
Joined: Wed Mar 03, 2021 4:13 pm

Re: How do I save RAM on my Qt Py?

by mikeysklar on Tue Mar 30, 2021 6:30 pm

@CapArcona,

It would take a lot less memory to write the equivalent programs using the Arduino IDE (C++) format. Is that something you would be comfortable with?

https://learn.adafruit.com/adafruit-qt- ... -ide-setup

I tend to avoid the M0 based SAMD's as I prefer to write in CircuitPython, but due to the memory requirements I need to use the beefier processors. There are a number to choose from. I really like the RP2040s. We are just about to release QtPy formed model of that. It will come with 264 KB ram and 4MB Flash. The QtPy you are working with has 32KB ram so an 8x jump.

https://www.adafruit.com/product/4900

mikeysklar
 
Posts: 4543
Joined: Mon Aug 01, 2016 8:10 pm

Re: How do I save RAM on my Qt Py?

by CapArcona on Tue Mar 30, 2021 7:03 pm

mikeysklar wrote:@CapArcona,

It would take a lot less memory to write the equivalent programs using the Arduino IDE (C++) format. Is that something you would be comfortable with?

https://learn.adafruit.com/adafruit-qt- ... -ide-setup

I tend to avoid the M0 based SAMD's as I prefer to write in CircuitPython, but due to the memory requirements I need to use the beefier processors. There are a number to choose from. I really like the RP2040s. We are just about to release QtPy formed model of that. It will come with 264 KB ram and 4MB Flash. The QtPy you are working with has 32KB ram so an 8x jump.

https://www.adafruit.com/product/4900


I have a pretty smart brain so I can handle learning a new language if it means I accomplish my goals. My real focus is keeping the footprint really tiny, and the QT Py is just that. The screen I'm using is about as big as I want to go, so nothing larger than that is acceptable for the project. If the new QT Py is about the same size but still a little nugget, then I'll be first in line! 264kb will open many doors and make the process within our code much less hack-y (there were some ridiculous contortions to do what we want). We'll probably rewrite in C++ unless the new hardware proves to be so phenomenal that there's no need.

Thanks!!

CapArcona
 
Posts: 15
Joined: Wed Mar 03, 2021 4:13 pm

Re: How do I save RAM on my Qt Py?

by mikeysklar on Wed Mar 31, 2021 10:42 am


mikeysklar
 
Posts: 4543
Joined: Mon Aug 01, 2016 8:10 pm

Please be positive and constructive with your questions and comments.