-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for teensy_ports
tool
#36
Comments
This stuff isn't really documented anywhere, so here's a bit of attempt to help... The old way, and still the default, is teensy_reboot tries to find a Teensy connected to your system and send it the reboot request. This really only works well if you have a single Teensy connected. If you have 2 or more, which one will reboot (so you can program code) is pretty much random. Using teensy_ports, you can get a list of every Teensy. The list gives you a unique identifier and a human readable description. On Linux the identifiers are sysfs pathnames. On Mac, they're Mac IOKit USB location numbers. On Windows, they're a "path" of numerical hardware addresses. For example, here is the output of "./teensy_ports -L" with 3 boards connected:
You can use these identifiers with teensy_reboot. You need to use "-port={identifier} -protocol=Teensy". You'll also want to use "-s" for stand alone mode, where it simply sends the USB message to the board without trying to coordinate with the GUI-based Teensy Loader application. For example, if you want to reboot the Teensy 3.5 from those 3 lines above, you would use this command:
Teensy Loader (GUI) and teensy_loader_cli are still designed to deal with only 1 Teensy at a time. Someday they may be updated. Until then, the intended usage is to avoid leaving any Teensy in bootloader mode. When you send the reboot message with teensy_reboot, only 1 board should be in bootloader mode, and then Teensy Loader will find and program that board. If you only use 1 board at a time, you don't need all this new stuff. It's meant to allow using more than 1 Teensy connected to your system, where you can control exactly which board reboots and will be found by Teensy Loader (assuming no others are already in bootloader mode). Remember, teensy_reboot is not guaranteed to succeed. Because the Teensy has only a single native USB port, its ability to hear the reboot request depends on the code running to be listening to the USB. If you program a Teensy with code that turns off the USB port, or keeps interrupts disabled, or stays in a deep sleep mode, or otherwise interferes with the USB, then teensy_reboot can not communicate with your Teensy. Every board has a Program (not Reset, but Program) button to force is to reboot into programming mode, allowing recovery from bad programs which do not respond to USB communication. These command line parameters are pretty much undocumented. Well, until now. This message is the documentation! |
@PaulStoffregen thank you so much for the detailed explanation!!! |
Teensyduino 1.42 also now comes with a teensy_serialmon program. It is intended to implement "serial monitor" communication with Teensy. You run it with "./teensy_serialmon {identifier}". The communication between teensy_serialmon and an IDE is done on stdin and stdout, and it sends you status messages on @stderr. Of course you can communicate with Teensy as a serial device, if you have programmed it with the code configured to implement USB serial. But teensy_serialmon adds many nice features, which are very hard to implement. If you configure the code to implement HID, Audio, MIDI or other modes without Serial, teensy_serialmon can automatically detect these. It also knows how to detect USB device removal and connection. If you have a Teensy programed as Audio, it will connect to the extra emulated serial interface. If you then upload Serial code, it will automatically close the connection when the device disconnects (either a physical unplug or running teensy_reboot), and will be able to reconnect to it using the different protocol for whatever code you have just programmed. |
It seems that |
Yes, it solves the serial monitor issue in #6. Of course you must compile the code with the correct -D args. For Serial, you compile with -DUSB_SERIAL. If you want to give users MIDI, you must change the compiler flags to use -DUSB_MIDI. After programming, which Teensy begins running the freshly built code, it will turn Teensy's USB port back on. Your PC does USB enumeration to detect the USB device. Then teensy_serialmon can automatically detect which USB option you used and start giving you the communication on its stdin/stdout. You can leave teensy_serialmon running while programming code. Unlike normal serial usage, where you must close the port, teensy_serialmon does all that internally, even if you program new code with a different USB type! |
Not sure if this is the proper place to report but the update hum looks like it's working fine, was missing the
Same thing for serialmon:
|
What happens when you use Arduino 1.8.5 with Teensyduino 1.42? Can you upload programs from Arduino? If not, please use Teensy Loader's Help > Verbose Info window to capture the log of events. Everything I see here looks perfectly fine. Looks like Teensy is connected to your Mac and running as a USB serial device. When you press the button on your Teensy, running these should find the device in bootloader mode, and running teensy_loader_cli should be able to program it. Again, if things aren't working and you want support from me, the path for "official" support involves running Arduino and capturing that event log from the gui version of Teensy Loader. |
@PaulStoffregen everything is working fine on the Arduino side with 1.8.5&1.42 (upload via teensy-gui), for the Only thing is |
Run it like this:
(or substitute whatever location string teensy_ports actually found) |
The important point is Teensyduino is moving away from device names like "/dev/cu.usbmodem3872730" and now using location strings which precisely define the actual physical USB port. If you change Tools > USB Type (in Arduino, or whatever equivalent menu/setting PlatformIO provides) to something like Audio or RawHID, the device names are completely differeny but the location string remains the same as long as you're physically plugged into the same USB port (and hub, if using hubs). |
@PaulStoffregen understood, in my case though I don't have any output either:
|
Try running "teensy_ports -L" (without -v). What does it actually print? Maybe you need "teensy_serialmon usb:14130000"? The teensy_serialmon program is expecting the same string teensy_ports -L gives you. |
The stings are different on all 3 platforms, and may change (especially on Macintosh, when/if Apple changes IOKit). The only thing you can assume about the location string is no white space. |
@PaulStoffregen I can confirm that |
See https://forum.pjrc.com/threads/52525-Teensyduino-1-42-Beta-6
The text was updated successfully, but these errors were encountered: