Teensy 4.0 no longer found

Status
Not open for further replies.

Deane

Well-known member
My first efforts: I modified the Blink program that comes with it to shorten the on time to 100ms.
That worked OK so I added a few lines of code to send out a 1 microsecond pulse on another pin once a second.
Now the program compiles OK but upon upload I get a message "No Teensy boards found... Press the button...
Pressing the button does not help. Any ideas.
Code attached.View attachment Pulse_speed_test.ino
 
Better for forum review if short sketches are pasted into the post with CODE tags ( hit the # Hashtag icon on the bar above the message text )

If the sketch is compiled with USB - as all T4 sketches are so far - then it should work if the code is valid and doesn't corrupt the Teensy operation.

Ideas: Use an alternate cable to the Teensy, move the calbe to an alternate USB port.
 
This code at a glance looks like it should run okay:
Code:
/* LED Blink, Teensyduino Tutorial #1
   http://www.pjrc.com/teensy/tutorial.html
 
   This example code is in the public domain.
*/

// Teensy 2.0 has the LED on pin 11
// Teensy++ 2.0 has the LED on pin 6
// Teensy 3.x / Teensy LC have the LED on pin 13
const int ledPin = 13;
const int fastPin = 14;

// the setup() method runs once, when the sketch starts

void setup() {
  // initialize the digital pin as an output.
  pinMode(ledPin, OUTPUT);
  pinMode(fastPin, OUTPUT);
}

// the loop() methor runs over and over again,
// as long as the board has power

void loop() {
  digitalWrite(ledPin, HIGH);   // set the LED on
  delay(100);                  // wait for 100 ms
  digitalWrite(ledPin, LOW);    // set the LED off
  digitalWrite(fastPin, HIGH);   // Fast pulse test
  delayMicroseconds(1);
  digitalWrite(fastPin, LOW);
  delay(1000);
}
 
OK, I got it working. Thanks for the code review and other ideas. I tried loading the original Blink program but that gave me the same "No Teensy found..." message.
So I figured something had to be really wrong. I restarted the Arduino IDE program. No luck. I shut off the computer (Windows 10) and turned it back on. Immediatly I noticed something different. Now when I pushed the Program button on the 4.0 a small red LED near the USB socket came on and stayed on. What is that indicating? The program would load! Yay. After that I never had to push the button again. When loading a new iteration of the program (kept making the pulses shorter) the red led would just blink and everything worked. I now have 3 pulses in a row that are 1 microsecond long. Now I want to get down to 100 nanoseconds. Is there a new command for this board called delayNanoseconds(xxx) ? Where are these new commands listed if they exist? Thanks for your help.
 
The red LED means Teensy is in programming mode. It's dim while waiting for communication from your PC. It's bright red while actually writing data into the flash memory. When Teensy Loader runs in Auto (which is the default if Arduino has controlled it), the norm is the red LED turns on dim for about half a second while your PC is detecting the USB device, then bright red for a moment while Teensy Loader uploads the code Arduino compiled. When the red LED turns off, that means it has left programming mode and the board as rebooted to run your program.

If you go into programming mode but there is absolutely no PC communication (like auto-detecting the USB device, which every OS does automatically) the red LED blinks dim. That blink is a sure sign of USB communication problems, like use of a charge-only cable.
 
OK, I got it working. Thanks ...
Now I want to get down to 100 nanoseconds. Is there a new command for this board called delayNanoseconds(xxx) ? Where are these new commands listed if they exist? Thanks for your help.

For Teensy_4 there is a " static inline void delayNanoseconds(uint32_t) __attribute__((always_inline, unused)); "
> { Important for the best documentation is having a way to grep the installed sources }

The red LED means Teensy is in programming mode. It's dim while waiting for communication from your PC. It's bright red while actually writing data into the flash memory. When Teensy Loader runs in Auto (which is the default if Arduino has controlled it), the norm is the red LED turns on dim for about half a second while your PC is detecting the USB device, then bright red for a moment while Teensy Loader uploads the code Arduino compiled. When the red LED turns off, that means it has left programming mode and the board as rebooted to run your program.

If you go into programming mode but there is absolutely no PC communication (like auto-detecting the USB device, which every OS does automatically) the red LED blinks dim. That blink is a sure sign of USB communication problems, like use of a charge-only cable.

Paul - that is the best/first most complete RED LED define I've seen - that should get posted somewhere - Teensy 4 page under Memory or Maybe trouble shooting. Assuming it will be common to T_4.1 and after … Maybe add the 15 sec Restore reading of the RED LED too.

<EDIT> Add this today about 15 second Restore timing:
The red LED "blip", which marks the moment releasing the button will trigger restore, happens after 13 seconds.

After 17 seconds, releasing the button will not trigger a restore. So you have 4 seconds from the "blip" on the LED to release the button. If you release more than 4 seconds after the "blip", restore is not triggered and it's treated like an ordinary press of the button which puts Teensy 4.0 into bootloader mode.

These times can vary up to ±3%, since they've based on a non-crystal oscillator inside the MKL02 chip.
 
Last edited:
Thanks to both of you for the reply. And yes, Paul, that was a great explanation of the red LED. Perfect for a beginner like me.
Defragster, I don't understand this line. Can you link to details of this code that will explain what is going on here?

"For Teensy_4 there is a " static inline void delayNanoseconds(uint32_t) __attribute__((always_inline, unused)); "
> { Important for the best documentation is having a way to grep the installed sources }"

Also, what is grep?
 
Thanks to both of you for the reply. And yes, Paul, that was a great explanation of the red LED. Perfect for a beginner like me.
Defragster, I don't understand this line. Can you link to details of this code that will explain what is going on here?

"For Teensy_4 there is a " static inline void delayNanoseconds(uint32_t) __attribute__((always_inline, unused)); "
> { Important for the best documentation is having a way to grep the installed sources }"

Also, what is grep?
grep … Like a web search for your computer … web search for grep shows this ...
grep
NOUN
a Unix command used to search files for the occurrence of a string of characters that matches a specified pattern.

And the line of code is showing the prototype for delayNanoseconds(uint32_t).

Just like the delayMicroseconds(1); used above - that shows #1 - it exists and #2 - it takes an unsigned 32 bit count

The editor I'm using 'SublimeText' Allows pointing to a directory location and searching all files under that to quickly find what file or files contain a give 'search string'. Very handy for locating what exists and where.
 
Plase don't expect delayNanoseconds() to be exact. It can't be.
Best you can expect is +-40 or 50 nanoseconds. If it's better in your special case - be happy about it, but don't expect it to always be like this.
 
Sadly, I am back to the same problem I started out with again. This time rebooting the computer is not bringing back the red LED. It never comes on and pressing the button only stops the blink program from running. Here are the results logged by the small Teensy loader program that runs in the background:

16:55:00.249 (post_compile 1): Begin, version=1.48, high-res time
16:55:06.318 (loader): Teensy Loader 1.48, begin program
16:55:06.489 (loader): Listening for remote control on port 3149
16:55:06.489 (loader): initialized, showing main window
16:55:06.536 (loader): remote connection 988 opened
16:55:06.536 (loader): remote cmd from 988: "comment: Teensyduino 1.48 - WINDOWS (teensy_post_compile)"
16:55:06.536 (loader): remote cmd from 988: "status"
16:55:06.542 (post_compile 1): Sending command: comment: Teensyduino 1.48 - WINDOWS (teensy_post_compile)
16:55:06.552 (loader): HID/win32: vid:8087 pid:0A1E ver:0200
16:55:06.552 (loader): HID/win32: vid:8087 pid:0A1E ver:0200
16:55:06.552 (loader): HID/win32: vid:045E pid:0000 ver:0000
16:55:06.552 (loader): HID/win32: vid:045E pid:0000 ver:0000
16:55:06.552 (loader): HID/win32: vid:8087 pid:0A1E ver:0200
16:55:06.552 (loader): HID/win32: vid:8087 pid:0A1E ver:0200
16:55:06.552 (loader): HID/win32: vid:8087 pid:0A1E ver:0200
16:55:06.552 (loader): HID/win32: vid:8087 pid:0A1E ver:0200
16:55:06.552 (loader): HID/win32: vid:8087 pid:0A1E ver:0200
16:55:06.552 (loader): HID/win32: vid:8087 pid:0A1E ver:0200
16:55:06.568 (loader): HID/win32: vid:8087 pid:0A1E ver:0200
16:55:06.568 (loader): HID/win32: vid:8087 pid:0A1E ver:0200
16:55:06.568 (loader): HID/win32: vid:8087 pid:0A1E ver:0200
16:55:06.568 (loader): HID/win32: vid:8087 pid:0A1E ver:0200
16:55:06.568 (loader): HID/win32: vid:0000 pid:0000 ver:0000
16:55:06.568 (loader): HID/win32: vid:8087 pid:0A1E ver:0200
16:55:06.568 (loader): HID/win32: vid:8087 pid:0A1E ver:0200
16:55:06.568 (loader): HID/win32: vid:8087 pid:0A1E ver:0200
16:55:06.568 (loader): HID/win32: vid:8087 pid:0A1E ver:0200
16:55:06.568 (loader): remote cmd from 988: "dir:C:\Users\DW\AppData\Local\Temp\arduino_build_929689\"
16:55:06.568 (loader): remote cmd from 988: "file:pulse_speed_test.ino.hex"
16:55:06.577 (post_compile 1): Status: 0, 0, 0, 0, 0, 0, C:\Users\DW\AppData\Local\Temp\arduino_build_429372\, Pulse_speed_test.ino.hex
16:55:06.577 (post_compile 1): Sending command: dir:C:\Users\DW\AppData\Local\Temp\arduino_build_929689\
16:55:06.578 (post_compile 1): Sending command: file:pulse_speed_test.ino.hex
16:55:06.583 (loader): File "Pulse_speed_test.ino.hex". 12564 bytes, 1% used
16:55:06.599 (loader): remote cmd from 988: "status"
16:55:06.599 (loader): remote cmd from 988: "auto:eek:n"
16:55:06.611 (post_compile 1): Status: 1, 0, 0, 0, 0, 0, C:\Users\DW\AppData\Local\Temp\arduino_build_929689\, Pulse_speed_test.ino.hex
16:55:06.611 (post_compile 1): Sending command: auto:eek:n
16:55:06.613 (post_compile 1): Disconnect
16:55:06.630 (loader): remote connection 988 closed
16:55:06.929 (post_compile 2): Begin, version=1.48, high-res time
16:55:06.932 (loader): remote connection 1044 opened
16:55:06.932 (loader): remote cmd from 1044: "comment: Teensyduino 1.48 - WINDOWS (teensy_post_compile)"
16:55:06.932 (loader): remote cmd from 1044: "status"
16:55:06.932 (loader): remote cmd from 1044: "dir:C:\Users\DW\AppData\Local\Temp\arduino_build_929689\"
16:55:06.932 (loader): remote cmd from 1044: "file:pulse_speed_test.ino.hex"
16:55:06.936 (post_compile 2): Sending command: comment: Teensyduino 1.48 - WINDOWS (teensy_post_compile)
16:55:06.943 (post_compile 2): Status: 1, 1, 0, 0, 0, 0, C:\Users\DW\AppData\Local\Temp\arduino_build_929689\, Pulse_speed_test.ino.hex
16:55:06.943 (post_compile 2): Sending command: dir:C:\Users\DW\AppData\Local\Temp\arduino_build_929689\
16:55:06.944 (post_compile 2): Sending command: file:pulse_speed_test.ino.hex
16:55:06.947 (loader): File "Pulse_speed_test.ino.hex". 12564 bytes, 1% used
16:55:06.963 (loader): remote cmd from 1044: "status"
16:55:06.972 (post_compile 2): Status: 1, 1, 0, 0, 0, 0, C:\Users\DW\AppData\Local\Temp\arduino_build_929689\, Pulse_speed_test.ino.hex
16:55:06.972 (post_compile 2): Disconnect
16:55:06.994 (loader): remote connection 1044 closed
16:55:06.994 (loader): remote connection 1040 opened
16:55:06.995 (post_compile 3): Running teensy_reboot: "C:\Program Files (x86)\Arduino\hardware\teensy\..\tools\teensy_reboot.exe" teensy_reboot.exe "-board=TEENSY40" "-port=usb:0/140000/0/4" "-portlabel=(null)" "-portprotocol=(null)"
16:55:07.270 (reboot 4): Begin, version=1.48, high-res time
16:55:07.270 (reboot 4): location = usb:0/140000/0/4
16:55:07.270 (reboot 4): portlabel = (null)
16:55:07.270 (reboot 4): portprotocol = (null)
16:55:07.270 (reboot 4): LoadLibrary cfgmgr32 ok
16:55:07.270 (reboot 4): LoadLibrary ntdll ok
16:55:07.275 (reboot 4): nothing new, skipping HID & Ports enum
16:55:07.276 (loader): remote connection 1044 opened
16:55:07.282 (reboot 4): Disconnect
16:55:07.307 (loader): remote connection 1044 closed
16:55:07.307 (loader): remote connection 1040 closed
16:55:16.917 (loader): Verbose Info event
 
NEVER MIND. Found out the cable I grabbed is a charge-only! Too many USB cables kicking around.
I thought of what Paul wrote late last night.
 
This time rebooting the computer is not bringing back the red LED. It never comes on and pressing the button only stops the blink program from running.

Something is very wrong. Pretty the button on Teensy 4.0 should always cause it to go into bootloader mode, turning on the red LED.

But from the log file, this looks rather disturbing:

16:55:06.552 (loader): HID/win32: vid:8087 pid:0A1E ver:0200
16:55:06.552 (loader): HID/win32: vid:8087 pid:0A1E ver:0200
16:55:06.552 (loader): HID/win32: vid:045E pid:0000 ver:0000
16:55:06.552 (loader): HID/win32: vid:045E pid:0000 ver:0000
16:55:06.552 (loader): HID/win32: vid:8087 pid:0A1E ver:0200
16:55:06.552 (loader): HID/win32: vid:8087 pid:0A1E ver:0200
16:55:06.552 (loader): HID/win32: vid:8087 pid:0A1E ver:0200
16:55:06.552 (loader): HID/win32: vid:8087 pid:0A1E ver:0200
16:55:06.552 (loader): HID/win32: vid:8087 pid:0A1E ver:0200
16:55:06.552 (loader): HID/win32: vid:8087 pid:0A1E ver:0200
16:55:06.568 (loader): HID/win32: vid:8087 pid:0A1E ver:0200
16:55:06.568 (loader): HID/win32: vid:8087 pid:0A1E ver:0200
16:55:06.568 (loader): HID/win32: vid:8087 pid:0A1E ver:0200
16:55:06.568 (loader): HID/win32: vid:8087 pid:0A1E ver:0200
16:55:06.568 (loader): HID/win32: vid:0000 pid:0000 ver:0000
16:55:06.568 (loader): HID/win32: vid:8087 pid:0A1E ver:0200
16:55:06.568 (loader): HID/win32: vid:8087 pid:0A1E ver:0200
16:55:06.568 (loader): HID/win32: vid:8087 pid:0A1E ver:0200
16:55:06.568 (loader): HID/win32: vid:8087 pid:0A1E ver:0200

I'm guessing you don't actually have 16 identical USB HID devices plugged into your computer, whatever "vid:8087 pid:0A1E" is? (that's not Teensy, which always uses vid:16C0) Clearly something is going very wrong with your PC.

First you should try with another computer (not using the Arduino software) or even just plugged into a USB charger that can power Teensy. Try pressing the button and check if the red LED comes on. The goal is to check whether Teensy is still working properly.

If that doesn't work, one thing to check is whether Teensy has turned itself off. Normally that doesn't happen unless you connect a button or switch to the On/Off pin. Connecting that pin to GND for 5+ seconds is supposed to turn off the 3.3V power to Teensy. When off, pressing the button or connecting to GND for 0.5 sec is supposed to turn the 3.3V power back on.
 
Found out the cable I grabbed is a charge-only!

Any chance you could try again with that cable. You said there was no red LED. But with a charge only cable, the red LED is supposed to blink after you've pressed the button. The red is **NOT** supposed to remain off.
 
Plase don't expect delayNanoseconds() to be exact. It can't be.
Best you can expect is +-40 or 50 nanoseconds.

I ran a couple quick tests, with this code.

Code:
void setup() {
  pinMode(2, OUTPUT);
}

void loop() {
  noInterrupts();
  digitalWriteFast(2, HIGH);
  delayNanoseconds(20);
  digitalWriteFast(2, LOW);
  interrupts();
  delayMicroseconds(1);
}

Looks like it has pretty consistent ~22 ns overhead (including the digitalWriteFast lines), then produces the correct delay.

Here's my scope measuring 42.6 ns for delayNanoseconds(20);

file.png

The overshoot and undershoot is due to my use of an ordinary ground clip lead, rather than going through a lot more trouble for a short low-Z at high frequency ground connection.
 
Paul, that is what I see also: A 22ns overhead using this same code. I am shooting for 100 ns pulse width and I had to set the delay to 78 ns to achieve that. This is a bit annoying but if it remains consistent I can work with that. Thanks for the help. Nothing like bothering the chief engineer and CEO to get a basic problem solved for a newbie. Unbelievable customer service!
I think we are done with this thread unless someone has a better idea. Lesson learned on the correct cable.
 
Any chance you could try again with that cable. You said there was no red LED. But with a charge only cable, the red LED is supposed to blink after you've pressed the button. The red is **NOT** supposed to remain off.

Just for ref:
> Two T4's here on two diff battery packs doing a blink with a DATA USB cable (2 diff data cables)- i.e. no USB - Button press stops Blink, though does not show any RED LED on a short press, but as expected it does after 13 sec Hold.
> Same two T4's with Power/Charge cable - powers and blinks and then goes (dim) Red on Button press, same if connected to PC computer USB.
 
Status
Not open for further replies.
Back
Top