🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Core2 vs. Core

    Micropython
    2
    3
    9.0k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      marcvl
      last edited by marcvl

      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.

      1 Reply Last reply Reply Quote 0
      • M
        marcvl
        last edited by

        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?

        1 Reply Last reply Reply Quote 0
        • R
          Russ
          last edited by

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

          import gc
          gc.mem_free()

          And it will print the available free memeory

          gc.collect()

          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 https://docs.micropython.org/en/latest/library/gc.html?highlight=gc#module-gc

          1 Reply Last reply Reply Quote 0
          • First post
            Last post