Closed PanzerPandaNinja closed 6 months ago
I'm facing the same issue. After searching for long, it does look like this comes from a memory problem. I am not completely certain, but it looks like I need about 60k bytes of RAM free to be able to be able to make an HTTPS request. I've read it would be enough if you had 40k-ish, but that has not been my experience (maybe you need 40k of continuos, non-fragmented space?)
You can try this to check if this is your problem (put this code right before the HTTPS request):
import gc
print("Available memory:", gc.mem_free())
In your particular case, it looks like you are loading a bitmap into memory. There are ways to just read them from disk, so it is an easy fix, hopefully. You can try commenting it out to see if you have enough memory then.
Remove the code that is not necessary, i.e. scanning networks and pinging google. I would also recommend to remove setting the time from ntp. Also, skip the call to minip.no. If you absolutely need that, query the http version instead of the https version of that service.
Hi, I kind of gave up since this was for a workshop and I could do the workshop without it. This ticket was more meant as a heads up to developers or whoever cares enough to fix it :) I am pretty sure I checked the gc.mem_free and I think there was enough. I'm still interested in getting evrything to work, but I will have to revisit this later. I thought maybe it was a collision with the libraries and not a memory problem. But I will test this later at some point. :) Thank you for the replies.
For whatever reasons, less free memory is showing at startup in CP 9 compared to CP 8:
Adafruit CircuitPython 8.2.10 on 2024-02-14; Raspberry Pi Pico W with rp2040
>>> import gc
>>> gc.mem_free()
142640
Adafruit CircuitPython 9.0.4 on 2024-04-16; Raspberry Pi Pico W with rp2040
>>> import gc
>>> gc.mem_free()
126160
This decrease in free memory was explored in https://github.com/adafruit/circuitpython/issues/9085. We turned off some new modules in 9.1.0-beta.1. Could you try that version and see if things improve?
Thanks for the reminder about #9085
9.1.0-beta.1 is the same as 9.0.4 on Pico W:
Adafruit CircuitPython 9.1.0-beta.1-10-gc92bb9b3cc on 2024-04-25; Raspberry Pi Pico W with rp2040
>>> import gc
>>> gc.mem_free()
126160
CircuitPython version
Code/REPL
Behavior
Description
SSL not working when importing Adafruit-azureiot on a rpPico W, I get this error when I try to reach a HTTPS-site. When I comment out "from adafruit_azureiot import IoTCentralDevice" and the code running it, it is working. It is also working if I get HTTP-site.
Not a big problem for me since I can use HTTP, but might be a problem someone wants to look at, when I googled it I found very little.
Additional information
No response