Teensy 4.0 & 4.1

Discussion and questions about boards that can run MicroPython but don't have a dedicated forum.
Target audience: Everyone interested in running MicroPython on other hardware.
User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Teensy 4.0 & 4.1

Post by Roberthh » Sat Jul 17, 2021 8:13 pm

Thanks for confirming that things run well. There are still a lot of peripherals to support. Next on my list is PWM. I2C looks, good, CAN as well. FLEXIO is also a very interesting I/O device. Or support for SPIRAM or additional Flash Memory. Especially helpful for Teensy.
USB host is surely another interesting topic. I did not have it on my list yet, but will add it. I did not look into the details yet and do not know, how difficult the implementation is.
You can build the Ethernet Version from the branch link in my previous post. That should work the same as building it from the master branch. Functionally it should be complete. Only the RAM organization should be changed for the MIMXRT1020 board.

dshriver
Posts: 3
Joined: Mon Jul 19, 2021 10:17 am

Re: Teensy 4.0 & 4.1

Post by dshriver » Mon Jul 19, 2021 10:24 am

The dual core i.MX RT1170 MCU runs on the Arm® Cortex®-M7 core at 1 GHz and Arm Cortex-M4 at 400 MHz should be a nice follow-on to this Teensy work. It seems to be already shipping but backorder at most places like Mouser.

Shards
Posts: 39
Joined: Fri Jun 25, 2021 5:14 pm
Location: Milton Keynes, UK

Re: Teensy 4.0 & 4.1

Post by Shards » Tue Jul 20, 2021 11:58 am

From a recent post by @Roberthh:
I have a branch about to be submitted as PR for Ethernet support at https://github.com/robert-hh/micropytho ... mimxrt_lan. It is based on the current master. In order to us Ethernet with the Teensy 4.1, you have to connect a RJ45 jack to it. PJRC is offering a small Breakout for a few $.
I can confirm that the Ethernet works fine. I tested it by getting the uftpd module working with LAN rather than WLAN. This only required some simplification of the 'start' function. LAN is really nicer to use than WLAN and should be stabler and faster. FTP was fine both from the command line and using Filezilla, OS is Linux Mint. The PJRC Ethernet breakout requires a bit of soldering but nothing at all tricky.

My only issue was with building the Ethernet supporting teensy 4.1 firmware. I followed Roberts link above and it took me to the Ethernet branch of his micropython fork. However, the 'clone' link on that page cloned Roberts root i.e. no network code. Downloading the zip gave me the Ethernet version. I fudged things by copying the mimxrt specific code from the zip over the clone, assuming only that would have changed and it then built fine. I assume there is some way to clone Roberts fork but my knowledge of git / github is limited.

Teensy 4.1 is looking rather good as a micropython board. I don't think my skills stretch to working on the codebase but I'd be happy to test where it would help and to work on the documentation.

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Teensy 4.0 & 4.1

Post by Roberthh » Tue Jul 20, 2021 1:34 pm

Thanks for testing: I used uftpd as well for testing, and a simple udp echo server (script below), and ping in and out.. I did not find a similar host for further testing. For uftpd, you had to remove or change the LAN object instantiation, since it is already present before starting uftpd.

About git: if you have already a copy of MicroPython, you can add my repository as additional remote and then fetch the branch from it. That works usually well. We did not make a PR yet, since we want to rearrange the RAM usage a bit. It is fine for Teensy, but a little bit tight and unbalanced for MIMXRT1020.

UDPTEST:

Code: Select all

import socket
UDP_IP = "68.228.188.226"
UDP_PORT = 17
MESSAGE = b' '
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.settimeout(5)
def run():
    print(s.sendto(MESSAGE, (UDP_IP, UDP_PORT)))

    data, address = s.recvfrom(1024)
    print(data.decode())

run()

androiddrew
Posts: 18
Joined: Sat Jan 23, 2021 7:24 pm

Re: Teensy 4.0 & 4.1

Post by androiddrew » Sun Jul 25, 2021 1:59 pm

I had never compiled Micropython from source before this Teensy port became available. I documented my experience on my blog https://androiddrew.github.io/2021/07/b ... teensy-4x/. I hope this helps people like me who are just getting started. If there are corrections/edits to make please let me know.

Thanks for all the great work people. This board is a perfect target for Micropython.

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Teensy 4.0 & 4.1

Post by Roberthh » Sun Jul 25, 2021 3:05 pm

A daily build is supposed to be at https://micropython.org/download/all/. Obviously that does not contain the features that are under construction.

androiddrew
Posts: 18
Joined: Sat Jan 23, 2021 7:24 pm

Re: Teensy 4.0 & 4.1

Post by androiddrew » Sun Jul 25, 2021 7:56 pm

Roberthh wrote:
Sun Jul 25, 2021 3:05 pm
A daily build is supposed to be at https://micropython.org/download/all/. Obviously that does not contain the features that are under construction.
Thanks, @Roberthh. When I wrote this I had no idea that there were binaries for all the ports. I've changed the intro of my article accordingly.

androiddrew
Posts: 18
Joined: Sat Jan 23, 2021 7:24 pm

Re: Teensy 4.0 & 4.1

Post by androiddrew » Sun Aug 01, 2021 12:26 am

@Roberthh

Could you provide some instruction on how to use the .bin file you referenced in the downloads like above with my teensy 4.0 board? I built the port from source and used the .hex file that was produced, but I can't seem to find anything on uploading a .bin to a Teensy 4.x board.

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Teensy 4.0 & 4.1

Post by Roberthh » Sun Aug 01, 2021 6:02 am

You cannot upload .bin files to the Teensy devices, since the built-in loader (call Half-Kay loader by PJRC) expects the .hex transfer format. The loader will convert that to binary, such that in the end all load formats create the same binary image in the MCU memory.

androiddrew
Posts: 18
Joined: Sat Jan 23, 2021 7:24 pm

Re: Teensy 4.0 & 4.1

Post by androiddrew » Thu Aug 05, 2021 11:56 pm

Roberthh wrote:
Sun Aug 01, 2021 6:02 am
You cannot upload .bin files to the Teensy devices, since the built-in loader (call Half-Kay loader by PJRC) expects the .hex transfer format. The loader will convert that to binary, such that in the end all load formats create the same binary image in the MCU memory.
Ok, yeah I couldn’t find any documentation on using .bin files. The downloads link you provided above only includes the .bin files for the teensy’s processor.

Post Reply