Core2 vs. Core

  • I'm trying to get my Core2 micropython script to run on the Core. I'm gettin following error in Thonny:
    MemoryError: memory allocation failed, allocatin

    Any tips on how to fix this issue? My code is here. I was hoping that my code would run on both devices without having to make changes. Is that not the case?

    EDITED: corrected the Github link to point to the right repository.

  • I'm not sure if anyone from M5Stack is monitoring this forum, but would love their feedback.

    I think that the main difference between Core and Core2, as far as memory is concerned, is that the Core 2 has 8 MB of PSRAM (in addition to the 520KB SRAM of the ESP32), where as the Core only has the 520KB SRAM.

    That's a huge difference in available memory. Could this explain why my program runs out of memory on the Core (while running fine on the Core2)? How do I verify how much memory my program is using?

  • If the M5 firmware is close to the upstream MicroPython, you can:

    import gc

    And it will print the available free memeory


    Will run the memory garbage collection to free up memory that is no longer being used. You can gc.collect() somewhere in your main loop to make sure memory is kept tidy.

    See the gc module page for more information