View Full Version : Teensy 3.0: USB interface dead?

09-23-2013, 10:34 PM
Hi to everybody.
Since I cut the USB power from the battery power (as explained in this post) I have a really big issue with my Teensy 3.0.
It simply doesn t work.
Putting both power I can see the led blinking (because it was so in the last program I could upload), but I m no more able to communicate to the board.

Im using Linux (debian) and when I insert the USB cable into the PC I can see the board:

wilhem@U-2:~$ lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 002: ID 046d:c31c Logitech, Inc. Keyboard K120 for Business
Bus 002 Device 003: ID 046d:c05a Logitech, Inc. Optical Mouse M90
Bus 002 Device 004: ID 16c0:0483 VOTI Teensyduino Serial

but in the serial folder I cannot find it anyway:

wilhem@U-2:~$ ls /dev/tty*
/dev/tty /dev/tty14 /dev/tty20 /dev/tty27 /dev/tty33 /dev/tty4 /dev/tty46 /dev/tty52 /dev/tty59 /dev/tty8
/dev/tty0 /dev/tty15 /dev/tty21 /dev/tty28 /dev/tty34 /dev/tty40 /dev/tty47 /dev/tty53 /dev/tty6 /dev/tty9
/dev/tty1 /dev/tty16 /dev/tty22 /dev/tty29 /dev/tty35 /dev/tty41 /dev/tty48 /dev/tty54 /dev/tty60 /dev/ttyS0
/dev/tty10 /dev/tty17 /dev/tty23 /dev/tty3 /dev/tty36 /dev/tty42 /dev/tty49 /dev/tty55 /dev/tty61 /dev/ttyS1
/dev/tty11 /dev/tty18 /dev/tty24 /dev/tty30 /dev/tty37 /dev/tty43 /dev/tty5 /dev/tty56 /dev/tty62 /dev/ttyS2
/dev/tty12 /dev/tty19 /dev/tty25 /dev/tty31 /dev/tty38 /dev/tty44 /dev/tty50 /dev/tty57 /dev/tty63 /dev/ttyS3
/dev/tty13 /dev/tty2 /dev/tty26 /dev/tty32 /dev/tty39 /dev/tty45 /dev/tty51 /dev/tty58 /dev/tty7

so I cannot connect to the /dev/ttyACM0 as requested by Teensyrduino.
Of course rebboting didnt help.

What could I do? What could I check?

09-25-2013, 08:12 PM
I think I found a bug.
I just must admit, I was writing a program using the protocol I2C but I didn't connect any sensor to the bus, because it is still on the way (I ordered while writing the code).
So I just removed the library "Wire.h" from all the source files and now the Teensy works perfectly and it is seen by the PC.

Maybe some HW problems?


09-25-2013, 08:29 PM
Did you have pullup resistors connected?

Did the code have Wire.begin() or any other actual usage of the library?

09-25-2013, 08:36 PM
Did you have pullup resistors connected?

Did the code have Wire.begin() or any other actual usage of the library?
yes, but I left it commented (it was not compiled)

Ok, tomorrow I will try connecting pull up resistors and compiling the library
Anyway the Teensy works now.

09-25-2013, 08:51 PM
Very interesting. I don't know why it would hang by just including the Wire.h header.

I just tried this. It blinks and does not seem to hang.

#include <Wire.h>
int led = 13;
void setup() {
pinMode(led, OUTPUT);
int count=0;
void loop() {
Serial.print("test ");
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second

As usual, I'll investigate it you post code that reproduces the problem. I tried to make it happen here with only the info you gave, but that code does not hang when I run it. I was also able to open the serial monitor and see it printing the numbers.

09-25-2013, 08:58 PM
try to disconnect and connect your board before starting the serial monitor!

09-25-2013, 09:09 PM
try to disconnect and connect your board before starting the serial monitor!

Ok, just tried that. Seems to work fine.

To be more specific, I clicked upload in Arduino. Teensy Loader reprogrammed the board. Then I physically unplugged the USB cable, waited about 1 second, then plugged it back in. About 2 seconds later, I clicked the serial monitor button in Arduino. The serial monitor opened, and it seems to be working perfectly.

Here's what I'm seeing on my screen right now:


09-25-2013, 09:37 PM
If you're using Windows, the USB drivers within Windows (I believe the hub driver) can add several seconds of delay to re-detect the device. It's explained here (http://blogs.msdn.com/b/usbcoreblog/archive/2009/10/31/how-does-usb-stack-enumerate-a-device.aspx) in the the "Duplicate Device Detection" section at the end.

Somehow Mac and Linux deal with detecting device removal and reconnection without this delay. But on Windows, it can really add some substantial time where it seems like the device isn't working.

09-25-2013, 09:52 PM
But I m using only Linux!!!
Anyway...tomorrow I m going to take a long break and try different configuration (with library, with/without resistors, ...) and I will post your my result.
Could you me please confirm I should connect the 4,7kOhm pullupresistors for SDL and SDA to the 3,3V on the board?

09-25-2013, 10:16 PM
Could you me please confirm I should connect the 4,7kOhm pullupresistors for SDL and SDA to the 3,3V on the board?

Yes, confirmed.

09-26-2013, 10:14 PM
I found it out.
It is true that the problem is the Wire.h library but because it tries to interrogate a sensor that is not there (physically) [at least in my experiments].
I did many tests and at the end T3 stucks every time I tried to run the code. I realized that this part of code the problem was:

void Accel_Init( void ) {


// check if the version used is compatible with the device used LSM303DLHC_DEVICE
if( compass.getDeviceType() == LSM303DLHC_DEVICE ) {

compass.writeAccReg( LSM303_CTRL_REG1_A, 0x47 ); // normal power mode, XYZ axes enabled, 50 Hz sample time: from DATASHEET
compass.writeAccReg( LSM303_CTRL_REG4_A, 0x28 ); // 8g full scale: FS = 10 on DLHC, high resolution output mode: from DATASHEET

} else {

compass.writeAccReg( LSM303_CTRL_REG1_A, 0x27 ); // normal power mode, all axes enabled, 50 Hz: from DATASHEET
compass.writeAccReg( LSM303_CTRL_REG4_A, 0x30 ); // 8g full scale: FS 11 on DLH, DLM: from DATASHEET



The I2C communication bus asks the sensor without receiving answer.
The effect is that the program runs once and then if you try to run it again there is no link to the /dev/ttyACM0 for uploading the code into T3.
After that the only way to save your board is to load (just verify in Arduino and then click on the black button on the board) a simple blink program. Then the PC will recognize your board as USB device again.

I m pretty sure, the same happened to poltergeist here (http://forum.pjrc.com/threads/24283-Arduino-1-0-5-Teensy-3-I2C-not-working)
Maybe in his code there was a problem on the bus and the I2C didn t comunicate with the sensors very well.

So, I hope it will help other people for similar problems in the future.

09-26-2013, 10:17 PM
Ah! Of course 4,7kOhm resistor and
Wire.begin() command were during the tests implemented.