ehong-tl / micropySX126X

Semtech SX126X LoRa driver for Micropython and CircuitPython.
MIT License
89 stars 20 forks source link

Memory allocation problem with Raspberry pico w #27

Open Patxi080 opened 1 month ago

Patxi080 commented 1 month ago

I wanted to use the library in a project but when when the library sx1262 is imported this error happens:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/lib/sx1262.py", line 2, in <module>
MemoryError: memory allocation failed, allocating 176 byte

I created a new file to check if it was the library with only: import sx1262 And it keeps happening. Here is an image: image

ehong-tl commented 1 month ago

Hi,

This could be due to insufficient RAM in Pico W than in standard Pico.

One thing you can try is to compile the library into .mpy bytecode.

Sorry that I can't give you a complete solution as I have no experience in using Pico / Pico W.

Ruben0595 commented 1 month ago

sx1262_mpy_lib.zip

Here are mpy files of the library. just replace the current sx1262/126x .py files with these and should work fine.