Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 5 of 5

Thread: Micropython on Teensy 4.1

  1. #1

    Micropython on Teensy 4.1

    Hi,

    I'm trying to get Micropython code to run on a stand alone Teensy 4.1.

    Why I say 'stand alone'? Well, I've got Micropython on it, wrote my code and it works as expected when started from within Thonny.
    There is one thing though: booting on it's own.

    I don't know if this is a question for the Teensy forum or the MicroPython forum.
    It is about booting but I don't know if it's the Teensy or the MicroPython firmware controlling the boot.

    I think the 'note to myself' below pretty much explains the situation.

    So my question is: How can the Teensy be booted from the flash?
    If you need more info, please let me know.

    Thanks


    My note to self:
    Code:
    Thonny shows :
    
    MicroPython device/sdcard
    MicroPython device/flash
    
    == Whithout a 'boot.py' file nothing is run
       main.py is not booted at startup
    
    
    boot.py WILL run startup if placed on the sd card
    boot.py loads and runs main.py by the 'import main' statement inside boot.py
    
    boot.py will NOT run at startup when it's inside the 'flash' directory
    
    
    For developing:
    - Place ALL code (boot.py, main.py, libraries, folders) in the 'flash directory'
    - This because Thonny f's up and corrupts files when uploading/saving to the sd card
      and it's dead slow
    - When you have a boot.py on the sd card when developing, Thonny cannot connect to the REPL
      rename it to boot.py.rename so it doesn't get booted
    
    For deployment:
    - Copy the contents of the 'flash' directory to your computer
    - Take the sd card out of the teensy, put it in your card reader 
      and copy the contents of the flash directory onto the sd card.
    - Put the sd card back in your teensy and it should boot: boot.py which loads main.py

  2. #2
    Can this topic be closed?

    I would like to ask my question at the MicroPython forum.
    Please don't reply here.

  3. #3
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    27,987
    Please post a link to the question on the MicroPython forum. Then this thread can be closed.

  4. #4
    Ok I will. But that would be in the next week or so.

  5. #5
    Ok, I didn't post on the MicroPython forum but I got it working.

    - On the Teensy's flash: main.py and all other code
    - On the SD card: boot.py, webserver files and log files

    boot.py has only one line of code: 'import main'. This loads and runs main.py from the flash.

    When programming I have to remove or rename boot.py on the SD.
    If not, Thonny can not connect to the Teensy over USB for programming.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •