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

    Pure Micro Python without Ui-Flow on my M5Stack core2

    Scheduled Pinned Locked Moved Micropython
    23 Posts 8 Posters 75.1k Views 5 Watching
    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.
    • D Offline
      dhed @favnec5
      last edited by

      @favnec5
      My workaround for this (known) problem:

      1. during boot mount the sdcard and load files to ram
      2. then unmout the sdcard
      3. initialize the display

      something like:

      import uos
      from machine import Pin, SDCard
      
      sdcard = SDCard(slot=2, sck=Pin(18), miso=Pin(38), mosi=Pin(23),  cs=Pin(4), freq=40000000)
      uos.mount(sdcard, '/sd')
      ...
      uos.umount('/sd')
      sdcard.deinit()
      

      before initializing the display:

      from ili9XXX import ili9341
      lcd = ili9341(spihost=1, mosi=23, miso=38, clk=18, dc=15, cs=5, invert=True, rot=0xC0, width=320, height=240, rst=-1, power=-1, backlight=-1)
      

      I'm loading weathericons to use with openweathermap that way.

      P 1 Reply Last reply Reply Quote 0
      • F Offline
        favnec5
        last edited by

        Hi, the problem is, for me, that i need to write files to the sdCard like a datalogger. I think old lobo’s version do the job but not lv_micropython… @m5stack : official pure m5stack needed to use the core 2 functionalities OR hidden start menu version of uiflow.

        Thomas

        J 1 Reply Last reply Reply Quote 0
        • J Offline
          Josef @favnec5
          last edited by

          @favnec5 Here is another Micropython port for the Core2. Already thried that with my core2: https://github.com/thuehlinger/micropython-core2

          Another note: you do not need to use another firmware, you can use Micropython directly by just not using uiflow. See my repo https://github.com/hjgode/m5home within the lv dir: lv_test.py
          Be warned, the LV Binding is not very well documented and often only links to the C API.

          1 Reply Last reply Reply Quote 0
          • P Offline
            purpledread @dhed
            last edited by

            @dhed

            I tried to get your compiled firmware, but that ZippyShare site keeps trying to download other things and I can't get it to download your file.

            Thanks,
            /Chris

            D 1 Reply Last reply Reply Quote 0
            • D Offline
              dhed @purpledread
              last edited by

              @purpledread That link still works for me, but here it is uploaded to an alternative.

              1 Reply Last reply Reply Quote 0
              • P Offline
                purpledread
                last edited by

                Thanks, the new upload link worked.

                /Chris

                1 Reply Last reply Reply Quote 0
                • P Offline
                  purpledread
                  last edited by

                  @dhed

                  That's all working now, including using ampy to copy files and run code.

                  I'm use to using Mu Editor with my other ESP32 boards.

                  Is there some way to run Python code and get back error messages if there is an issue in the code?

                  Thanks!
                  /Chris

                  D 1 Reply Last reply Reply Quote 0
                  • D Offline
                    dhed @purpledread
                    last edited by

                    @purpledread
                    I'm using VSCode with the PyMakr extension (see LeMaRiva's blog for install-instructions).
                    Nice IDE with integrated serial-console for REPL and up-/downloading of files.

                    But I guess any serial-console (i.E. PuTTY) should allow you to see error messages.
                    Also check micropython.org for instructions to get a REPL over the serial port.

                    P 1 Reply Last reply Reply Quote 0
                    • P Offline
                      purpledread @dhed
                      last edited by

                      @dhed

                      Actually, ampy is working fairly well.

                      Thanks,
                      /Chris

                      1 Reply Last reply Reply Quote 0
                      • P Offline
                        purpledread @dhed
                        last edited by

                        @dhed

                        I'm trying to read from the SD card on startup and then use the display.

                        If I access the sd card, the program runs with no errors, but nothing displays.

                        I tried initializing the display using the example you gave, but I get an error that there isn't enough DMA-able memory to allocate the display buffer.

                        /Chris

                        P 1 Reply Last reply Reply Quote 0
                        • P Offline
                          purpledread @purpledread
                          last edited by

                          @dhed

                          Sorry for the newbe questions. You've been a big help.

                          When you say you load files to ram from the boot.py file, how do you access that ram from the main.py file?

                          P 1 Reply Last reply Reply Quote 0
                          • P Offline
                            purpledread @purpledread
                            last edited by

                            @purpledread

                            Never mind. As simple Python code.

                            Thanks!

                            1 Reply Last reply Reply Quote 0
                            • S Offline
                              Snufkin1514
                              last edited by

                              Is it possible to use m5stack_ui here?
                              How do it?

                              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