Teensy 3.1 USB Serial not communicating

Status
Not open for further replies.

dvdfreitag

New member
I just received my OSHPark edition Teensy 3.1 in the mail, and there seems to be an issue. As this is my first foray into the Teensy world, I thought I'd load up the USB_Serial -> HelloWorld example, but I can't get it to communicate.

- I am running Windows 7 x64
- The device is enumerated as "Teensy USB Serial" in the device manager
- I have tried a few different unused COM ports
- There are no external connections to the teensy apart from the usb cable
- The code is the "USB_Serial->HelloWorld" example, but here it is if you simply must see it:
Code:
void setup() {
  Serial.begin(9600);
}

void loop() {
  Serial.println("Hello World");
  delay(1000);
}

- The blink example works as expected, and the board programs successfully. I have also verified there are no shorts or jumpers or any debris on the board that could be causing issues
- I have tried a modified version of the blink example using the Serial.dtr() functionality in an attempt to do some debugging, which appears to be hanging at the while loop:
Code:
const int ledPin = 13;

void setup() {
  Serial.begin(9600);
  pinMode(ledPin, OUTPUT);
}

void loop() {
  while (!Serial.dtr());
  Serial.println("Hello World");
  digitalWrite(ledPin, HIGH);
  delay(1000);
  digitalWrite(ledPin, LOW);
  delay(1000);
}
- I have tried the Serial Monitor built in to the Arduino software as well as TerraTerm 4.76
- I have also tried 115200 baud
- As a final effort, I also tried using 72MHz instead of the 96MHz optimized OC

- The configuration in the Tools menu:
teensy_tools.png
- The entry in device manager:
teensy_cm.JPG

There did not appear to be any errors during the installation of the teensyduino software. I did notice that the teensy enumerated as COM3 when I initially programmed it which is the same as another port I was using at the time, and that port needed to be re-opened. It does not appear that this unit is damaged/faulty in some way since the other USB functions still operate correctly, but I am unsure as to how to continue. Any ideas?

Edit: I am using Arduino software version 1.6.5
 
Last edited:
I can't say I've heard of that Serial.dtr() function before.
Where is it defined? Seems likely it's just the simple case that it's never returning true, hence your loop.

What are you trying to achieve with it?

Remove that while() statement and I should imagine it will work fine.
 
I can't say I've heard of that Serial.dtr() function before.
Where is it defined? Seems likely it's just the simple case that it's never returning true, hence your loop.

What are you trying to achieve with it?

Remove that while() statement and I should imagine it will work fine.

The Serial.dtr() function was documented on this page. As I said before, I tried just the basic USB Serial Hello world without the while loop, and it did not work.
 
Okay, well do me a favour and remove that line for now anyway.

Does the LED flash with the sketch running (without the while() expression)?
 
Hi

I have another problem, may be related

If I use Arduino (with Teensy's addon), the Serial Port appears in Device Manager dialog. However, if I use other library, such as mbed, the Serial Port disappears. What is the to enable that?

Regards
Yoonghm
 
If you search qBlink you'll see I love to post this code. It will wait a bit (up to 3 secs as written) for the PC to connect to the Teensy - then I changed your loop to result in the same net effect - it works on my LC with USB or on battery. It uses WriteFast() and will play on the LED while waiting for USB to connect waiting in setup().

Code:
#define qBlink() (digitalWriteFast(LED_BUILTIN, !digitalReadFast(LED_BUILTIN) ))

void setup() {
  digitalWriteFast(LED_BUILTIN, 0);
  pinMode(LED_BUILTIN, OUTPUT);
  Serial.begin(9600);  // USB
  qBlink();
  while (!Serial && millis() <= 3000) if (!(millis() % 200))  qBlink();
  Serial.print("Hello World! ... ");
  Serial.println(millis());
  digitalWriteFast(LED_BUILTIN, 1);
}

void loop() {
  Serial.println("Hello World");
  delay(1000);
  qBlink();
  delay(1000);
  qBlink();
}
 
Last edited:
The Serial Port will appear in the Device Manager dialog box even if you have empty block in the loop () and init () functions. What make Teensy appear as serial port by the boot loader inside the teensy?
 
The Teensy startup code initializes the selected USB type, enables USB inerrupts and creates the the USB object, like Serial (SeraialUSB) or usbMIDI before calling main(), and setup() and loop() functions. So the USB will enumerate even if the setup and loop functions are both empty.

Using mbed or some other library will of course be different.
 
In the IDE there is a selection for "Tools / USB Type" defaults to 'Serial' making that show up even if not used.
 
Its not the bootloader that does this, as said before, it is done by the Teensy initialisation code, and configured by the settings in the IDE.
The bootloader simply loads the code which then sets up the USB and clock modes.
 
Yes, the led will flash if I remove the while loop, but still no communication.

First, reboot your computer. Windows 7 sometimes gets confused, where a reboot solves things. Do this first!

Unplug the Teensy. Run Arduino and look at the Tools > Ports menu. Make a mental note of the list. Earlier COM10 was believed to be Teensy. Make sure COM10 is NOT in the list while the Teensy is unplugged.

Plug Teensy in again. Wait a few seconds, since Windows 7 & 8 can sometimes be slow to detect USB devices (Mac and Linux are much better). Make sure the LED is blinking, so you know it's running that program you loaded with blinks AND prints.

Then look at Tools > Ports again. Now you should see a new COM port. Hopefully it's COM10. But if Windows is actually assigning some other COM port number, this is your opportunity to learn which port really is Teensy. Repeat with Teensy unplugged and reconnected if necessary, until you are sure you know which port is disappearing when you unplug Teensy and reappears when it's plugged back in and running that program.

During all this, do NOT press the button on Teensy. The button puts Teensy isn't programming mode. In that mode, Teensy appears as a USB HID device. It's not a COM port at all while programming. If you look for COM ports in programming mode, based on a common misunderstanding that a COM port must exist for programming, you'll probably end up mistaking some other COM port on your system as Teensy. The programming is always done using HID protocol, so there's never a COM port while uploading your code.

With Teensy running the program blink+print program, make sure the COM port for Teensy is selected in Tools > Ports. Then open the Arduino Serial Monitor. You should see the messages printing every second.
 
I saw this the other week - and it wasn't something I had seen before - that was when it looked as below in DevMan:

I did notice that the teensy enumerated as COM3 when I initially programmed it which is the same as another port I was using at the time, and that port needed to be re-opened.

This was the clue to REBOOT - or kill all the devices in DevMan.

In my case the device came and left and got under another port that was hiding it and DevMan showed as below when multiple teensy units were powered.

TYQT gives a decent map of active devices and can point out orphaned ports that won't work, I had seen orphaned ports before, but about the time of 1.6.5 they turned into Zombie ports.

twin_com3.png

I only setup one Win10 preview and it was this wimpy netbook. I'll do more after a trip Aug 3 and see how it looks. I didn't want to re-install the way prior betas needed - this time they just updated to the release build.
 
Status
Not open for further replies.
Back
Top