Serial port emulation problems (Teensy 3.1)

Status
Not open for further replies.

bambuk

Member
When compiling and uploading code without using the Arduino/Teensyduino IDE, serial port emulation does not kick in for some reason. I use the Makefiles supplied with the Teensyduino (with some modifications). These are the last two commands executed:

teensy_post_compile -file=main -path=. -tools=c:/opt/TeensyTools
teensy_reboot -v -v -v -v -pmk20dx256 -chalfkay -P\\.\COM4 -b12000000 -D -Uflash:w:main.hex:i

I figured the last command has something to do with port emulation as it has "COM4" in it.

When uploading code using the Arduino IDE, serial port emulation usually works (it fails sometimes and then I just re-upload).

What may be the problem?

Thanks.
 
Run the Teensyduino installer. Just click "Next" twice. Click ok to install the driver (it should confirm the file is from PJRC). Then you can quit after it's install the serial driver.

You may need to unplug and reconnect Teensy, or go into the Windows Device Manager can right-click and choose to update the driver, to get Windows to actually use the freshly-installed driver.

The "driver" is actually just a INF that tells Windows to use its own usbser.sys driver. Microsoft's driver gets confused if you disconnect or reboot Teensy while another program has the COM port open. Typically you'll have to quit and restart that program, even though the COM port may show up correctly in the device manager. In some extreme cases, you may need to reboot. This is a known issue with Microsoft's driver... it gets confused if a program has the COM port still open when to unplug the cable or press the button on Teensy.
 
I did run the Teensyduino installer, and emulation works when I upload/reboot from Arduino IDE. However, serial emulation never works if I use the Makefile - Teensy just appears as Unknown Device in device manager.

I just rebooted my PC, and when I plugged Teensy, Windows pop up said that device is not recognized.
 
Last edited:
Looks like the problem is how the hex file is built.
If I take a hex file built in Arduino IDE and manually load it via teensy loader - COM5 appears after teensy reboot.
If I take a hex file built using the Makefile and load it via teensy loader - the program runs fine but COM emulation fails.

Am I not linking in some file that may affect this?
 
had -D__MK20DX128__ in my Makefile instead of -D__MK20DX256__.

Perhaps in 1.19 the sample Makefile should be updated to default to this?

It could also use quite a bit of other work to improve in small ways. I'm open to ideas. For quite some time, the makefile hasn't really received many attention....
 
Status
Not open for further replies.
Back
Top