Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 7 of 7

Thread: Serial port emulation problems (Teensy 3.1)

  1. #1
    Junior Member
    Join Date
    Mar 2014
    Posts
    7

    Serial port emulation problems (Teensy 3.1)

    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.

  2. #2
    Junior Member
    Join Date
    Mar 2014
    Posts
    7
    ... teensy appears as "Unknown Device" in Device Manager.

  3. #3
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,755
    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.

  4. #4
    Junior Member
    Join Date
    Mar 2014
    Posts
    7
    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 by bambuk; 03-24-2014 at 03:56 AM.

  5. #5
    Junior Member
    Join Date
    Mar 2014
    Posts
    7
    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?

  6. #6
    Junior Member
    Join Date
    Mar 2014
    Posts
    7
    Ok, figured it out. I had -D__MK20DX128__ in my Makefile instead of -D__MK20DX256__.

  7. #7
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,755
    Quote Originally Posted by bambuk View Post
    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....

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •