How to acquire and upload demo app?



  • Not sure if I damaged the unit trying to learn micropython on this thing: TFT screen just won't display anything.

    Thought to upload back the original demo app that comes with stock units. Does anyone know where I can download it, and upload back to my m5stick to test it out?



  • @jhfoo the demo is preinstalled in the firmware



  • So is the original firmware available to download, and upload back into the device?



  • Use M5Burner found in the downloads section of the main website. create a folder called M5Burner, download and put the program in to the folder, open the program and you will presented with a list of firmwares available to download and install into M5Stack and stick devices.



  • This was helpful. I use M5Burner to install uiflow v1.4.5.1. Using the web editor I was able to quickly learn some basic python commands.

    I notice after installing uiflow I am unable to connect via COM6. Is this normal? How can I do advanced python development without uiflow overheads eg. splitting into multiple files/ modules?



  • @jhfoo said in How to acquire and upload demo app?:

    This was helpful. I use M5Burner to install uiflow v1.4.5.1. Using the web editor I was able to quickly learn some basic python commands.

    I notice after installing uiflow I am unable to connect via COM6. Is this normal? How can I do advanced python development without uiflow overheads eg. splitting into multiple files/ modules?

    To directly program the M5Stack,
    Restart the M5stack and click the right hand button to enter settings, go to "switch to USB mode" and click the middle button.

    Micropython mode can allow you to write more advanced code but I recommend Mu or VCode with the micropython plugin.



  • @ajb2k3 Thanks I'm using M5StickC. What is the equivalent steps?



  • @jhfoo use the big button on the front and the small button on the right hand side.



  • @ajb2k3 has this been tested? On the screen with the APIKEY I pressed Button A and Button B and various permutations, and none of them switches the screen to Settings, or allow me to switch to USB.



  • @jhfoo if the api screen is showing, you missed the menu.
    the stick can be an problem in the older firmware as the menu appeared and dissapeared to quick. the stick doesn't have the demo as the demo is only for the core but the menu is there.



  • @jhfoo
    On the m5stickC, hold down the A button immediately after boot/power-on to access the menu. Then you use the B and A buttons to navigate and select.



  • @world101 It worked! Very cool. Let me play with this some more.



  • @world101 said in How to acquire and upload demo app?:

    @jhfoo
    On the m5stickC, hold down the A button immediately after boot/power-on to access the menu. Then you use the B and A buttons to navigate and select.

    Thanks mate, I could not remember the sequence.



  • @world101 I'm almost there with USB-mode control. I can switch to USB mode. Using Windows Visual Code (Pymakr extension) I am unable to get the >>> prompt. The only way I get the prompt is when the built-in 'test' app is run.

    So I wrote a simple hello world app and managed to run it on the M5StickC without first saving the file in the stick. Trying to write the file results in an error and failed.

    My question is: what apps are expected to work in USB mode (since Visual Code REPL doesn't work), and how can I manage the files inside?



  • @jhfoo

    I'm on a Mac and I use the OSX Terminal and the screen utility to access the REPL. On Windows, you might need to use Putty or something similar. With the uiFlow firmware burned to your m5stickC you can access the REPL.

    screen /dev/tty.usbserial-514A6FFF41 115200

    Once I'm in the screen session, I press Ctrl+C a few times to get to the REPL prompt. In the output below, I'm pressing Ctrl+C after it says "start m5ucloud monitor":

    MPY: soft reboot
    I (683470) [TFTSPI]: attached display device, speed=8000000
    I (683470) [TFTSPI]: bus uses native pins: false
    [ M5 ] node id:d8a01d698f30, api key:6501754B
    start m5ucloud monitor
    
    Unhandled exception in thread started by <bound_method>
    Traceback (most recent call last):
      File "flowlib/lib/time_ex.py", line 69, in timeCb
    KeyboardInterrupt: 
    Traceback (most recent call last):
      File "flow_usb.py", line 28, in <module>
      File "flowlib/m5ucloud.py", line 45, in run
      File "flowlib/lib/time_ex.py", line 69, in timeCb
    KeyboardInterrupt: 
    MicroPython v1.11-321-gac7da0a70-dirty on 2020-02-25; ESP32 module with ESP32
    Type "help()" for more information.
    >>> 
    >>> 
    >>> import os
    >>> os.listdir()
    ['image_app', 'flow_usb.py', 'config.json', 'main.py', 'res', 'boot.py', 'img', 'config.py', 'flow.py', 'blocks', 'apps', 'debug.py']
    >>> 
    >>> f = open('main.py')
    >>> f.read()
    'from m5stack import *\nfrom m5ui import *\nfrom uiflow import *\n\nsetScreenColor(0x111111)\n\nlabel1 = M5TextBox(24, 70, "TEST", lcd.FONT_Default,0xFFFFFF, rotate=0)'
    >>> 
    >>> f.close()
    >>> 
    >>> 
    

    In the above example, I open the main.py file (which is the 'test' app I think you are referring to) and read it to the REPL output. You can use other text editors to create your MicroPython programs and upload them to the m5stickC using ampy or another utility. Just save the file as main.py, upload it to the m5stickC and it will run after boot.py.

    Here is a good resource to look through.



  • @world101 said in How to acquire and upload demo app?:

    115200

    I followed your tip and got the prompt now! My mistake (habit of ESP8266 days) was thinking 9600 is a safe speed, which apparently isn't. Also didn't know about Ctrl-C until you mentioned it.

    What do you use to transfer files both ways?



  • @jhfoo said in How to acquire and upload demo app?:

    What do you use to transfer files both ways?

    I use Adafruit ampy because it supports get and put to transfer files both ways. You could also try the Thonny IDE that @lukasmaximus mentioned in the other thread. I haven’t tried that yet.

    I did try Mu IDE today with an m5stickC running the mainline MicroPython v1.12 firmware, but I wasn’t successful getting the REPL to work. It didn’t seem to detect the serial port connection to the m5stickC. However, Mu REPL did work for me with an M5Stack core running uiFlow v1.5.0 though.



  • @world101 I got Visual Code (pymakr) to do some form of upload/ download. It's a big buggy; 'Upload current file only' feature crashes but 'upload project' is fine. The latter is not preferred because it uploads EVERYTHING in my project folder.

    Will try ampy, thanks much!


  • M5Stack

    Upyloader, Mu and Thonny are all great tools with a nice GUI that you can use to transfer files to and from the flash of your device