micropy/SX126X (LoRa) memory allocation error on PyBoard but not Pico #15180
-
Whilst trying to import SX126X LoRa module drivers [https://github.com/ehong-tl/micropySX126X] into an original PyBoard v1.1 I get a memory allocation error. Previously I had no problems with a RP2040 based Pico with this same LoRa module. I'm guessing it is because Pico has 264k whilst the PyB has 192k. It doesn't sound quite right to me that the reference board doesn't have enough RAM to compile this module. Could this be the case? There is no other code in main.py and the boards were reset prior to test. MicroPython v1.22.2 (double precision version) on 2024-02-22; PYBv1.1 with STM32F405RG
MicroPython v1.20.0 on 2023-04-26; Raspberry Pi Pico with RP2040
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You could try to pre-compile the module using mpy-cross. That save a little bit of RAM during import. The other option is to embed the LoRa module as frozen bytecode, requiring to build you own version of the firmware. Then the driver code remains in flash and does not use RAM. Note: PyBoard was the first device used for implementing MicroPython more then 10 years ago. If the RP29040 would have existed at that time, it might have been chosen instead as a platform. Today, PybBoard D devices are the better reference in the PyBoard range of boards. |
Beta Was this translation helpful? Give feedback.
You could try to pre-compile the module using mpy-cross. That save a little bit of RAM during import. The other option is to embed the LoRa module as frozen bytecode, requiring to build you own version of the firmware. Then the driver code remains in flash and does not use RAM.
Note: PyBoard was the first device used for implementing MicroPython more then 10 years ago. If the RP29040 would have existed at that time, it might have been chosen instead as a platform. Today, PybBoard D devices are the better reference in the PyBoard range of boards.