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 » Fri Aug 06, 2021 5:46 am

The Teensy 4.x builds listed here https://micropython.org/download/all/ are hex files. Look down the page for files starting with the string "TEENSY".

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 Aug 10, 2021 8:54 am

@RobH I ran the pystone test on a MIMXRT1050_EVKB board. The i.MX 1052 MCU on that board has the same core as the Teensy boards, with less RAM: But the Flash chip on the board is different. It's a so-called Hyperflash device. Pystone test: ~4900.
The MIMXRT1050 board is also equipped with a 32MB SDRAM chip. If I use that one for the Python heap, the Pystone result is ~5700.
So I assume that most of the speed degradation we have seen on the Teensy board is related to the flash chip and the increasing cache misses, as the firmware size increases. The Hyperflash runs at higher speed and 8 bit bus width. And so cache misses do not hurt that much.

User avatar
RobH
Posts: 91
Joined: Fri Mar 23, 2018 3:37 pm
Location: Netherlands
Contact:

Re: Teensy 4.0 & 4.1

Post by RobH » Tue Aug 10, 2021 5:48 pm

@Roberthh: Thanks for reporting! Nice to have some comparison material!
I continued running the pystone program on newer firmware versions. The fastest I found was 1.16-98: 3810. Since then it went gradually down to about 3250 for 1.16-194. There seems no relation with the code size: it hardly grew.

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

Re: Teensy 4.0 & 4.1

Post by dshriver » Tue Aug 10, 2021 9:57 pm

I received the MIMXRT1170-EVK a bit earlier than expected. At 1Ghz, it is rated more than twice the CoreMark of the Teensy 4.0/4.1. Wonder how difficult it would be to add to the list of supported Teensy processors 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 » Wed Aug 11, 2021 6:26 am

I have to look for the differences between the boards. At a first glance, it seems that is uses the QSPI chip by default. I have to look into the data sheets and schematics for further details, but you may be able to run a MIMXRT1050_EVK (NOT EVKB!) build. That will not provide a lot of features. And especially features like WiFi are not supported. Lacking a board, I cannot test it. And It's unlikely that I will purchase a board just for verification of a port.
You could start adding the board to the repository, by adding the respecitve files for the MCU in the mimxrt/boards directory, which is however a lot of work.

alphaFred
Posts: 31
Joined: Wed Apr 15, 2020 6:47 pm

Re: Teensy 4.0 & 4.1

Post by alphaFred » Sat Aug 14, 2021 4:36 pm

Maybe I should lurk around here a bit more often in the future. Now I know where @Roberthh get‘s all his great insights into the MicroPython community from :D.

The biggest hurdle I see for (sup)porting MIMXRT117x is upgrading the submodule with the NXP libraries. We have discussed about this and I hope we will find a solution which does not create too much of an overhead. The second interesting question for me is how we would like to incorporate the CM4 controller.

alphaFred
Posts: 31
Joined: Wed Apr 15, 2020 6:47 pm

Re: Teensy 4.0 & 4.1

Post by alphaFred » Sat Aug 14, 2021 5:05 pm

RobH wrote:
Sun Jun 27, 2021 6:04 pm
The ST7789 TFT display works fine and much faster with the new hardware SPI!
I'm looking forward to support VfsFat to be able to drive an SD card! ;-)
@RobH the SDCard support is currently in review. I have to thank @Roberthh again for his support. I am quite sure that it is working stable now but more test exposure especially in real life scenarios is always appreciated.

https://github.com/micropython/micropython/pull/7608

hybotics
Posts: 33
Joined: Tue Apr 03, 2018 2:58 am
Contact:

Re: Teensy 4.0 & 4.1

Post by hybotics » Sat Aug 21, 2021 6:30 pm

Hi,

I just built and deployed the latest v1.16 version of Micropython to a Teensy4.0.

I2C seems to be working.
I can do i2c.scan() and detect all devices on the bus.

Code: Select all

# Import all board pins.
from machine import SoftI2C, Pin

TP_SDA = Pin(18)
TP_SCL = Pin(19)

# Create the I2C interface.
i2c = SoftI2C(sda=TP_SDA, scl=TP_SCL, freq=400000)

print()
print("Simple I2C bus scanner")
print()

#while not i2c.try_lock():
#	pass

scan = i2c.scan()

if scan:
	print("Devices on the I2C bus:")

	for addr in scan:
		print("\tDecimal: {0:3d}, Hex: {1}".format(addr, hex(addr)))
else:
  print("There are no devices on the I2C bus")

print()
Problem: Does not find libraries in /lib. I had to put them in the root.

8-Dale

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 Aug 21, 2021 6:38 pm

You can alway add lib to sys.path in your main.py.

import sys
sys.path.append("/lib")

Pre-Built versions are available at the Micropython web site under the "all" link: https://micropython.org/download/all/
At my or alphaFred's repository there are a few branches for features not yet merged. see:
https://github.com/robert-hh/micropython and https://github.com/alphaFred/micropython.

hybotics
Posts: 33
Joined: Tue Apr 03, 2018 2:58 am
Contact:

Re: Teensy 4.0 & 4.1

Post by hybotics » Sat Aug 21, 2021 8:43 pm

Roberthh wrote:
Sat Aug 21, 2021 6:38 pm
You can alway add lib to sys.path in your main.py.

import sys
sys.path.append("/lib")
That is not working.

8-Dale

Post Reply