PDA

View Full Version : teensy 2.0 self-powered usb serial port problem



ancc
12-06-2012, 05:23 PM
I'm building usb self powered device on teensy 2.0. I need keyboard&mouse&serial support. Also I need that device started to work immediately after power connection. Important notice, when teensy is powered, USB host system is powered off. It start to work later.

I isolated VBUS and UVCC from VCC as described in http://pjrc.com/teensy/external_power.html [Option #1: Cut "5V" Pads Apart] and I have a problem.

When I try to use serial port(Serial.begin(115200);) in my code I get a 1-2 second delay after powering a board. So after I apply power to the board the board hang us for 1-2 second and then starts to work normally. If I try not to use serial port in my project, a board starts function immediately after applying a power. Here is the sample code:

In this case I have a delay after applying power


int led = 11;
void setup() {
Serial.begin(115200);
pinMode(led, OUTPUT);
}
void loop() {
Serial.print(".");
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(500); // wait for a second
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
delay(500); // wait for a second
}


In this case All working fine


int led = 11;
void setup() {
pinMode(led, OUTPUT);
}
void loop() {
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(500); // wait for a second
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
delay(500); // wait for a second
}


Where it can be a problem?