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

    Core2 vs. Core

    Scheduled Pinned Locked Moved Micropython
    3 Posts 2 Posters 10.8k Views
    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 Offline
      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 Offline
        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 Offline
          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

          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

          With your input, this post could be even better 💗

          Register Login
          • First post
            Last post