Teensy 4.0

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
rcolistete
Posts: 179
Joined: Thu Dec 31, 2015 3:12 pm
Location: Brazil

Re: Teensy 4.0

Post by rcolistete » Mon Jan 13, 2020 1:02 pm

@Roberthh : there are many differences between CircuitPython x MicroPython :
https://circuitpython.readthedocs.io/en ... icropython
AFAIK, even v5.0.0 doesn't have interrupts and deepsleep, so I can't use CircuitPython in many projects.

And some features are simplified, e. g., "analogio.AnalogIn(pin)" doesn't allow to configure the ADC of each board (resolution, gain, etc).

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

Re: Teensy 4.0

Post by Roberthh » Mon Jan 13, 2020 3:41 pm

Yes. I gave it a short test. The core features seem to be there. I could run upysh and easily adapt the pye() Editor.
But with other test it simply stalls, like entering microcontroller.cpu.temperature
But they have added some functionality to disable concurrent access by the host and the module to the file system. No example yet how to disable host file access and keep USB REPL.

User avatar
rcolistete
Posts: 179
Joined: Thu Dec 31, 2015 3:12 pm
Location: Brazil

Re: Teensy 4.0

Post by rcolistete » Mon Jan 13, 2020 4:54 pm

Bugs so far :
- CircuitPython halts after :

Code: Select all

import microcontroller
microcontroller.cpu.temperature
Also pointed by @Roberthh;
- REPL disconnects after pasting more than approx. 4 lines in paste mode (CTRL+E). I have to disconnect from the USB port and connect to REPL work again.

User avatar
pythoncoder
Posts: 3867
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Teensy 4.0

Post by pythoncoder » Tue Jan 14, 2020 7:57 am

Roberthh wrote:
Mon Jan 13, 2020 7:19 am
...Porting driver code from Circuitpython to Micropython typically results in throwing away pretty many lines of code...
Indeed, I was amazed how many. I understand what they are trying to do: make the driver easily used by absolute beginners. In consequence the code is hard to follow and performance is sacrificed. Porting drivers from C is often simpler than porting them from CP.

I guess it's a matter of coding style but I assume drivers will be used by experimenters and aim to make their operation understandable.
Peter Hinch

User avatar
rcolistete
Posts: 179
Joined: Thu Dec 31, 2015 3:12 pm
Location: Brazil

Re: Teensy 4.0

Post by rcolistete » Tue Jan 14, 2020 3:29 pm

rcolistete wrote:
Mon Jan 13, 2020 4:54 pm
Bugs so far :
- CircuitPython halts after :

Code: Select all

import microcontroller
microcontroller.cpu.temperature
Also pointed by @Roberthh;
- REPL disconnects after pasting more than approx. 4 lines in paste mode (CTRL+E). I have to disconnect from the USB port and connect to REPL work again.
One new issue :
- ampy doesn't work with Teensy 4.0 #2516.

Neither 'mpfshell' and 'rshell', but they aren't compatible with CircuitPython boards. Ampy is from Adafruit and should work with all CircuitPython boards.

Mu Editor in CircuitPython mode works with Teensy 4.0.

User avatar
jimmo
Posts: 1021
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia

Re: Teensy 4.0

Post by jimmo » Thu Jan 23, 2020 1:54 am

I implemented the start of a basic port of MicroPython to the Teensy 4.0 -- PR at https://github.com/micropython/micropython/pull/5558

It's at the same level as the SAMD port in functionality (REPL over USB VCP), but it should be very straightforward to add basic Pin support.

One thing I noticed straight off the bat... as expected, this chip (the i.MX RT 1062) is _fast_. Power consumption is pretty low too, and it's very fast to flash firmware onto thanks to the way the loader works.

User avatar
rcolistete
Posts: 179
Joined: Thu Dec 31, 2015 3:12 pm
Location: Brazil

Re: Teensy 4.0

Post by rcolistete » Fri Jan 24, 2020 11:27 pm

jimmo wrote:
Thu Jan 23, 2020 1:54 am
I implemented the start of a basic port of MicroPython to the Teensy 4.0 -- PR at https://github.com/micropython/micropython/pull/5558
Thanks a lot ! Great to see MicroPython, as well as CircuitPython, on Teensy 4.0.

My 1st test :

Code: Select all

MicroPython v1.9.3-2582-g691ce3dd5 on 2020-01-24; Teensy 4.0 with MIMXRT1062DVJ6A
>>> import gc
>>> gc.collect()
>>> gc.mem_free()
774000
How-to-compile, worked for me (but I'm not sure if all the commands are needed) :

Code: Select all

$ git clone -b teensy40 --recurse-submodules https://github.com/jimmo/micropython.git 
$ cd micropython/mpy-cross
$ make -j 4
$ ./mpy-cross --version   # MicroPython v1.9.3-2582-g691ce3dd5 on 2020-01-24; mpy-cross emitting mpy v5
$ cd ../ports/mimxrt
$ make -j 4 submodules
$ make BOARD=TEENSY40 clean
$ make -j 4 BOARD=TEENSY40
MicroPython on REPL = only 55 mA. CircuitPython (firmware from 2020-01-18) on REPL = 91 mA.

Post Reply