Page 1 of 1

[teensy41] help getting started

Posted: Fri Mar 04, 2022 7:45 pm
by ryanGT
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

Re: [teensy41] help getting started

Posted: Fri Mar 04, 2022 10:12 pm
by ryanGT
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?

Re: [teensy41] help getting started

Posted: Fri Mar 04, 2022 10:32 pm
by ryanGT
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.

Re: [teensy41] help getting started

Posted: Sat Mar 05, 2022 7:13 am
by Roberthh
You can specify the proper port with mpremote:

mpremote connect <port_name> mount .

Try mpremote --help for some usage hints.

Re: [teensy41] help getting started

Posted: Sat Mar 05, 2022 3:14 pm
by ryanGT
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

Re: [teensy41] help getting started

Posted: Sat Mar 05, 2022 3:57 pm
by Roberthh
You can get the most recent mpremote version directly from the micropython repository at https://github.com/micropython/micropyt ... s/mpremote

Re: [teensy41] help getting started

Posted: Sun Aug 28, 2022 9:29 am
by mathieu
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.

Re: [teensy41] help getting started

Posted: Sun Aug 28, 2022 9:41 am
by Roberthh
You should be able to write:

mpremote connect /dev/cu.usbmodem14401 mount .

or whatever the port name is.

Re: [teensy41] help getting started

Posted: Sun Aug 28, 2022 11:24 am
by jimmo
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?