[teensy41] help getting started

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.
Post Reply
ryanGT
Posts: 24
Joined: Fri Jan 28, 2022 12:15 am

[teensy41] help getting started

Post by ryanGT » Fri Mar 04, 2022 7:45 pm

I am having trouble getting started with upython on my teensy 4.1. I can connect to it and use the repl in either rshell or using the command:
mpremote connect /dev/tty.usbmodem14401

But I don't know how to copy a python script onto it. If I try

mpremote mount .

it hangs forever. If I do a keyboard interrupt to get out of the infinite hang up, this is the traceback:

^CTraceback (most recent call last):
File "/usr/local/bin/mpremote", line 8, in <module>
sys.exit(main())
File "/usr/local/lib/python3.9/site-packages/mpremote/main.py", line 468, in main
pyb.enter_raw_repl()
File "/usr/local/lib/python3.9/site-packages/mpremote/pyboard.py", line 337, in enter_raw_repl
data = self.read_until(1, b"raw REPL; CTRL-B to exit\r\n>")
File "/usr/local/lib/python3.9/site-packages/mpremote/pyboard.py", line 303, in read_until
data = self.serial.read(min_num_bytes)
File "/usr/local/lib/python3.9/site-packages/serial/serialposix.py", line 565, in read
ready, _, _ = select.select([self.fd, self.pipe_abort_read_r], [], [], timeout.time_left())
KeyboardInterrupt

As I read that, it looks like it is trying to wait for a response, but not getting the response it expects.

Any suggestions on how to copy a *.py file to a teensy 4.1 running upython?

Thanks,
Ryan

ryanGT
Posts: 24
Joined: Fri Jan 28, 2022 12:15 am

Re: [teensy41] help getting started

Post by ryanGT » Fri Mar 04, 2022 10:12 pm

Not sure if this is related to my problem or not, but if I try mpremote without any arguments, I get this response:

$mpremote
Connected to MicroPython at /dev/cu.Bluetooth-Incoming-Port

So, the default device is not my teensy (/dev/cu.usbmodem14401 or /dev/tty.usbmodem14401). So, if I try to do "mpremote mount ." but cannot specify a device, is it trying the Bluetooth port?

ryanGT
Posts: 24
Joined: Fri Jan 28, 2022 12:15 am

Re: [teensy41] help getting started

Post by ryanGT » Fri Mar 04, 2022 10:32 pm

So, I can copy code using rshell. So that solves my immediate issue. Not sure why mpremote doesn't work for me, but I am guessing rshell is able to find the correct port while I suspect that mpremote does not.

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

Re: [teensy41] help getting started

Post by Roberthh » Sat Mar 05, 2022 7:13 am

You can specify the proper port with mpremote:

mpremote connect <port_name> mount .

Try mpremote --help for some usage hints.

ryanGT
Posts: 24
Joined: Fri Jan 28, 2022 12:15 am

Re: [teensy41] help getting started

Post by ryanGT » Sat Mar 05, 2022 3:14 pm

mpremote --help doesn't work on my version. I installed from pip.

I really did try to find a way to combined the proper port with the mount command, but I only tried to pass the portname as an extra parameter to mount; I never tried connect and mount in the same command.

Your command works perfectly.

Thanks again,
Ryan

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

Re: [teensy41] help getting started

Post by Roberthh » Sat Mar 05, 2022 3:57 pm

You can get the most recent mpremote version directly from the micropython repository at https://github.com/micropython/micropyt ... s/mpremote

User avatar
mathieu
Posts: 88
Joined: Fri Nov 10, 2017 9:57 pm

Re: [teensy41] help getting started

Post by mathieu » Sun Aug 28, 2022 9:29 am

ryanGT wrote:
Fri Mar 04, 2022 10:12 pm
Not sure if this is related to my problem or not, but if I try mpremote without any arguments, I get this response:

$mpremote
Connected to MicroPython at /dev/cu.Bluetooth-Incoming-Port

So, the default device is not my teensy (/dev/cu.usbmodem14401 or /dev/tty.usbmodem14401). So, if I try to do "mpremote mount ." but cannot specify a device, is it trying the Bluetooth port?
I'm getting the same behavior (on a Mac). Is there any simple way to tell mpremote to ignore this port (obviously not a micropython board)? The promise of autoconnecting to several boards using just the "mpremote" command sounds great.

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

Re: [teensy41] help getting started

Post by Roberthh » Sun Aug 28, 2022 9:41 am

You should be able to write:

mpremote connect /dev/cu.usbmodem14401 mount .

or whatever the port name is.

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

Re: [teensy41] help getting started

Post by jimmo » Sun Aug 28, 2022 11:24 am

We should definitely improve the port-autodetection on macOS. (Someone with a Mac, please send a PR if possible! :) )

We definitely need to improve the documentation about the way the command chaining works.

The other option is to add an alias to the mpremote config file (e.g. ~/.config/mpremote/config.py). Is the numeric part of /dev/tty.usbmodem14401 constant or does it change every time you plug the same device in?

Post Reply