-
Notifications
You must be signed in to change notification settings - Fork 5
USB Serial Communication
Uploading Firmware
- Cables
- Did you check your cable? There are a lot of charge only cables out there which have no communication lines. NOTE: good cables can go bad.
- Teensy 4.x uses 480 Mbps USB unlike prior Teensys that work at 12 Mbps. So, cheap/bad cables which worked fine with a T3.x might fail with a T4.x.
- Sketch
- Did you wait for an established USB connection before sending data (see here for details)?
TBD
The code required for the printf type of functions gets very large when you use floating point numbers. If you set the Optimize option to 'Smallest Code', the linker uses a reduced sets of standard libraries which do not implement printf for floats.
Note: TeensyLC uses 'Smallest Code' as default.
https://forum.pjrc.com/threads/59851-Problem-with-compiler-optimisatioon-and-sprintf?p=231902#post231902
Windows stores some information like the port number it assigned to which combination of VID/PID/MI/SN of the device. This allows devices like Teensies to automatically get the same port number after rebooting or changing the hub port you connected it to. Sometimes (seldom) Windows screws up this information and gets confused.
- It might assign the same port number to more than one device
- It might not detect your device correctly.
Usually you can detect this error condition in the device manager where it marks those ports with a yellow warning sign. In those cases try to uninstall the device. Use the key combination WIN & BREAK to open control panel, look for the device in the device manager, right click and uninstall. After that remove the device from your usb hub and reconnect.
-
Yes, here you find some information about the usage and installation of the PJRC CLI. Sources can be found here.
Note: Looks like the CLI can only program Teensies in usb serial mode without pressing the program button. For other USB modes you need to first start the bootloader by pressing the programming button. (Please remove this remark if it is fixed already) -
TyTools also contain a CLI version.
TBD
For Win10 applications there is TeensySharp which provides some helper classes to handle the following common tasks:
- Finding all Teensies on the USB tree (get a list with entries for each found board containing its serialnumber and the name of the COM port to which it is connected)
- Provide information when a Teensy is connected or removed from the USB Tree
- Uploading of firmware (hex files) from within the user application.
GitHub: https://github.com/luni64/TeensySharp
Nuget package: https://www.nuget.org/packages/lunoptics.TeensySharp/
No
Usually you don't need to press the program button if you use the stock Teensy uploader or external uploaders like TyTools. Here some trouble shooting recommendations:
-
Make sure you don't have 'No-USB' selected in the USB-Type options. With this setting your Teensy does not appear on the USB bus and can not be reprogrammed without pressing the button.
-
Make sure you don't have another uploader or any other program grabbing the port running in the background. E.g. if you normally use TyCommander and have Teensy.exe running in the background, Teensy.exe will detect a changed firmware and starts uploading it immediately which blocks TyCommander from accessing the board of course.
-
Make sure your sketch doesn't crash the USB Stack. To check, press the button and upload a known good sketch (e.g. blink.ino). If, after you uploaded blink.ino, uploading works without button, it is likely that something is wrong with your sketch.
- Uninstall ALL serial and ALL HID ports that are not active to get rid of screwed-up ports. (Obviously with Teensy disconnected). See here for details.
- If you set the USB-Type to 'Serial' you need to make sure to have the Serial driver installed (https://www.pjrc.com/teensy/td_download.html). Otherwise, the uploader can not switch your Teensy to bootloader mode. If you don't want to install the driver you need to choose any other USB-Type to allow uploading without pressing the button.
Arduino - SD shields often have level converters builtin. These are a) not needed as all Teensy 3.x + teensy 4 work with 3.3V and b) lead to problems because the level converters are usually too slow for Teensy.
With the SD Library, use BUILTIN_SDCARD as "pin":
const int chipSelect = BUILTIN_SDCARD;
Try to re-format the SD card with the official formatter: https://www.sdcard.org/downloads/formatter/
Teensy is a PJRC trademark. Notes here are for reference and will typically refer to the ARM variants unless noted.