Below is a
repost of something I wrote a couple years back - this and many other troubleshooting tips are here on the Forum.
Teensy Fails to Upload or to Blink or run, Wonder if it got bricked?
** TeensyDuino 1.42 or later has an updated interface shown on the "Tools / Port" menu item where a "Teensy" specific section will show a connected Teensy when present in Bootloader or other USB state if running and on a good cable.
Steps to get a fresh blink upload to your Teensy
*Setup IDE* {section below}
Unplug your Teensy
Close Teensy Loader.
make sure : Tools / USB Type: is "Serial"
Open and compile a sketch like below in the IDE.
When it fails to find the Teensy and says press button.
On the unplugged Teensy press and hold the button
Plug the Teensy in - Pause - release the button.
Wait and watch Teensy Loader - perhaps open the : Help / Verbose Info window.
{ allow 5-10 seconds for Windows(other) to see the device if it programmed - if it is installing the driver don't interrupt it }
Ideally that will upload a USB sketch that is properly recognized. The LED will blink and Windows will recognize the Teensy on USB and you can open the Serial Monitor [check Tools/Port] to watch it print dots. Edit the Code somewhat to alter the USB printing and Try a normal upload with a single Teensy connected.
If that fails Unplug and repeat those steps as needed - but plug into a different USB port, or a HUB, or cable.
Windows USB can go to an odd(er) place when it sees a series of insert/removals that are not properly resolved. Once this works you should not see this again as Windows will have the working driver associated with Teensy.
I've not 'damaged' a Teensy - and these steps have gotten me through the software connect confusion states that have shown in different ways on Windows.
> If you have a second working Teensy connect it once and download this sketch to see your system work, then retry the steps above.
>
Have a good USB cable - not a charge only cable, good cables can go bad.
> If this fails, restart your machine with Teensy unplugged and begin again above.
This updated version of the old sketch will print data sent from the SerMon - and sending 's' will print the File and compile info.
Code:
#define qBlink() (digitalWriteFast(LED_BUILTIN, !digitalReadFast(LED_BUILTIN) )) // Pin13 on T3.x & LC
void setup() {
Serial.begin(38400);
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, HIGH);
while (!Serial && (millis() <= 4000))
{ qBlink(); delay(50); }
Serial.print("\nSetup() OK :: millis()==");
Serial.println(millis());
Serial.println("\n" __FILE__ " " __DATE__ " " __TIME__);
}
elapsedMillis emilBlink; // Teensy way to delay action without delay()
int8_t loopCount = 0; // Print a NewLine periodically
#define MAX_LOOP 60
void loop() {
if ( emilBlink > 1000 ) {
qBlink();
emilBlink = 0;
Serial.print(".");
loopCount += 1;
if ( MAX_LOOP <= loopCount ) {
loopCount = 0;
Serial.println("!");
}
}
char cc;
while ( Serial.available() ) {
Serial.print( cc = Serial.read() );
if ( 's' == cc ) Serial.println("\n" __FILE__ " " __DATE__ " " __TIME__);
loopCount = MAX_LOOP;
}
}
*Setup IDE*
> Make sure you have a supported
version of the Arduino.cc IDE installed
> Perhaps Download the current ZIP and unzip to a fresh directory
> Have a
current version of TeensyDuino Installed
> In process BETA versions typically listed here :
forum.pjrc.com/forums/6-Announcements
> A failure during install may mean some software element is stuck in memory, restart the machine and do setup again.
> Under IDE : Tools /Board - make sure
your Teensy model is selected
> Under IDE : Tools /USB Type - make sure the setting is >
USB Type: "Serial"
> Under IDE : Tools /CPU Speed - make sure chosen speed is
not marked (No USB)
>
** More than one IDE install is possible. Make sure the IDE running is the same one the TeensyInstaller updated.
--> See
'Help / About' from the IDE for the version of Teensyduino associated with that IDE. If not check the 'shortcut/link' used
>
Other standard Troubleshooting tips here: http://www.pjrc.com/teensy/troubleshoot.html
General notes:
> Teensy Button takes it OFFLINE into
Program mode, it is
not a Reset button.
> Factory blink is nice, but it will not show up as USB like the above sketch. { Though with TD 1.42 (or later) the
Tools / Port / Teensy will show it online as "
RawHID" }
> If Teensy doesn't run right when not connected to PC USB - in setup() check for "while( !Serial );" This won't timeout, but the above code does.
Alternate Serial Monitor:
I generally use
TyCommander for USB Serial debugging interface: It is more robust and has added Teensy Specific features ( GUI Reset and Upload and connectivity information Serial and HID )
> If you have TyCommander questions or issues please read/post on that thread.