Teensy 4.0 & 4.1
Re: Teensy 4.0 & 4.1
Just for a test, I made a version of mimxrt/machine_i2c.c, which supports the init() method with the keywords freq and drive. You 'll find it here: https://github.com/robert-hh/micropytho ... t_i2c_init. You can simply copy over the file mimxrt/machine_i2c.c for testing. Generally I would say that this is of almost no importance. One would usually instantiate an I2C bus with the right parameters. There is little use of changing them afterwards, since all devices on the bus must be capable of working with these settings.
Re: Teensy 4.0 & 4.1
Thanks for the explanation! I suppose there is (/was) a good reason for this design, but without this knowledge the docs should be a little clearer about differences and/or exceptions.
BTW I don't need to change freq in my project, I just noticed my issues with init() during experimenting...
BTW I don't need to change freq in my project, I just noticed my issues with init() during experimenting...
Re: Teensy 4.0 & 4.1
Tried your mod of machine_i2c.c. The init(freq=...) is now accepted.
It looks like 'freq' (and 'drive') can be changed, but at least frequency does not really (and no warning):
It looks like 'freq' (and 'drive') can be changed, but at least frequency does not really (and no warning):
Code: Select all
MicroPython v1.16-92-g98c570302-dirty on 2021-07-15; Teensy 4.0 with MIMXRT1062DVJ6A
Type "help()" for more information.
>>> from machine import I2C
>>> bus = I2C(0)
>>> print(bus)
I2C(0, freq=400000)
>>> bus.init(freq=100000)
>>> print(bus)
I2C(0, freq=400000)
Re: Teensy 4.0 & 4.1
That might be just the display, where the change has not be noted back to the config. Did you look at the bus?
Re: Teensy 4.0 & 4.1
File changed now to display the changed frequency.
-
- Posts: 18
- Joined: Sat Jan 23, 2021 7:24 pm
Re: Teensy 4.0 & 4.1
So, as of 07/15 how ready for the world is a Mircropython running on Teensy 4.x? Does anyone have a built binary they could share with instructions on uploading it?
Re: Teensy 4.0 & 4.1
After having stalled for a while, it is extended now. You can download actual builds from the MicroPython web site, at https://micropython.org/download/all/, which include quit a few of the machine class.
There is a PR for an initial documentation, which tell you which pins for which device, although that matches the Teensy Pin-Outs. 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 $.
There is support for the SD Card un der construction made by @alphaFred. You can get a copy of the actual branch at https://github.com/robert-hh/micropytho ... xrt_sdcard, which I use for testing with Teensy 4.1.
There is no combined branch for both SDCARD and Ethernet.
Not all options of MicroPython are yet enabled, but that's easy to add.
Code: Select all
>>> dir(machine)
['__class__', '__name__', 'ADC', 'I2C', 'LED', 'Pin', 'RTC', 'SDCard', 'SPI', 'Signal',
'SoftI2C', 'SoftSPI', 'Timer', 'UART', 'disable_irq', 'enable_irq', 'freq', 'idle', 'mem16',
'mem32', 'mem8', 'reset', 'time_pulse_us']
>>> help("modules")
__main__ machine uasyncio/funcs ujson
_boot math uasyncio/lock uos
_onewire micropython uasyncio/stream upysh
_uasyncio mimxrt ubinascii urandom
bme280 onewire ucollections ure
builtins pye_mp uctypes uselect
cmath uarray uerrno ustruct
ds18x20 uasyncio/__init__ uftpd usys
framebuf uasyncio/core uhashlib utime
gc uasyncio/event uio uzlib
Plus any modules on the filesystem
There is support for the SD Card un der construction made by @alphaFred. You can get a copy of the actual branch at https://github.com/robert-hh/micropytho ... xrt_sdcard, which I use for testing with Teensy 4.1.
There is no combined branch for both SDCARD and Ethernet.
Not all options of MicroPython are yet enabled, but that's easy to add.
Re: Teensy 4.0 & 4.1
Thanks for all your efforts on the Teensy port Robert! Really appreciated.
Re: Teensy 4.0 & 4.1
Cudos must go to @alphaFred, who started the effort. Without him I would not have considered working at that port, and would not have been able to do that. Being busy with his familiy and his daytime work, he might appear silent. But he is working on the port at every minute he can spare.
Re: Teensy 4.0 & 4.1
I can confirm both Teensy 4.0 and 4.1 both run micropython fine . I have been using both for the last couple of weeks and my standard UART (GPS) , i2C (display) SPI (mifare reader) programs all run fine with code just copied from pyboard or ESP versions. The boards are reasonably priced and seem well made. A small bonus is the nice printed pinout listing cards they come with.
I look forward to trying out the ethernet connection which should make the 4.1 ideal for a network connected hub application.
I've built the firmware from the micropython master with no issues, I use the teensy program provide by PJRC to upload the hex files, again without problems.
The 4.1 also has a USB host connection, any chance this will be supported in micropython?
I look forward to trying out the ethernet connection which should make the 4.1 ideal for a network connected hub application.
I've built the firmware from the micropython master with no issues, I use the teensy program provide by PJRC to upload the hex files, again without problems.
The 4.1 also has a USB host connection, any chance this will be supported in micropython?