If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Button, timeout and boot

I would like to request a feature or enhancement, for the function of the button on the Teensy.

After pushing the button, if a connection is not found to an instance of the Teensy Loader (on the host computer) within some timeout (let's say 10 seconds), the Teensy reboots with the program that it is already stored.

We can add a feature to this, and say if it does not have a program stored already, then it does not timeout. It just continues to wait.

I believe this would be a big help for those of us who would like to productize something that we built using a Teensy.

As one can see in many threads of these forums, there is a general misconception about that button which is erroneously seen as a reset knob. Thus, defaulting to reset/reboot after a timeout sounds like a very good idea!

I am considering a change to Teensy Loader, where the window would automatically raise to the front during programming and for the ~1.5 seconds after rebooting, where it should "Reboot OK". Then, if it has not been on the top of other windows, it would try to lower itself back to the same relative level it had been.

This risks annoying people. Windows that "pop up" can appear to be too aggressive, like web advertising of the late 1990.

But the plus side might be better awareness than pressing the button is causing the board to be reprogrammed, and the reboot behavior isn't actually from the button but a side effect of the reprogramming. As we have things today, especially with many Windows users on laptops or other machines with small screens, they tend to maximize 1 window and the tiny Teensy Loader window stays unseen during programming & rebooting.

I see the problem rather with a Teensy which is deployed within a custom device. Imagine that the end user is not aware of the fact that it's a program button and tries to use it as a reset button. Result is, the Teensy would wait to be re-programmed forever and the client would panic. If - without re-programmation after a timeout - the Teensy would reboot afterwards, the button would have had its new secondary function as a reset knob as expected by the naive end user.

The bootloader can ping the host, and if there is no teensyloader that responds within a short time just reset.. for all the cases where the teensyloader is not running or USB not even connected it would be a plus.

Paul: I like the 'short pop to front' idea - you are correct that TeensyLoader gets buried - even with two large screens - but it is comforting to get confirmation of the upload. I often leave my sound off so I don't get the Chime out/in on the USB detect.

Finding a way to overload the Program Button to reset would be nice. Though I regularly tap the button to stop the blinking lights - or when I know the code has run adrift and want it to pause and be ready for the next Upload. I need to do that at times when I Fault the MCU - which I do on purpose - and the CPU would otherwise fail the subsequent upload notice from the PC. So simply putting a 'one press with timeout' would run afoul of my current process expectations. Likewise TeensyLoader in AUTO mode doesn't let me do that - so that is another reason I like TyCommander as it takes a button press as a bootloader request without then forcing an upload - until the builder tells it to, or I hit its GUI reset. So perhaps a short [<0.5 sec] then longer press [>1 sec] of Program - [within 1 second of each other?] - might equate to a reset - or maybe a longer press and then a short press. It would take a proper choice to have the Teensy know whether or not to trigger TeensyLoader to Upload [go to Program] or Reset without Upload. If something could work out it would be nice not to have to unplug/repower the Teensy to get a reset - and I'd hope that would be under control of the bootloader MCU.

To be honest when I started here 4 yrs back it took some time for somebody to actually communicate to me that that was not a reset button. Perhaps because "it seems to do a reset" where TeensyLoader quickly reprograms and restarts the Teensy. Until that one frustrating upload that hangs the MCU, and the reset just uploads the same code to hang once again.

Hi Paul, the need for a more deployable function for the button, has come up again. Is there still not adequate time or interest for this? Again, we need that the button result in a time out and restart when the teensy is not able to connect to a teensyloader.

+1 on being able to reset via the program button. This is particularly problematic with teensy 4.0 as there's no external reset pin. AFAICT, if you accidentally hit the program button when no programmer is available, you are stuck until you can power cycle the device.

There are risks to changing the existing behavior of the button for existing designs. I'm wary of timeouts and double-tap behaviors breaking existing workflows.

I think the least risky new behavior would be a press-and-hold for a full second to reboot the device.

That is good news that it recovers after cycling power. At least it's not a total brick at that point. Apart from that, I think we have a different context for what is risky and what is normal, though I do agree on one point, that a double tap, is not a good idea.

That said, for a commercial product that would use the teensy, the risky, and unusual behaviour is that it hangs until it finds a programmer or gets power cyled.

The safe, and more normal looking behaviour, is button push and if there is no programmer, timeout after some 10-20 seconds, and reboot.

Press-and-hold would be okay also, but not en-lieu of the timeout as a guaranteed return to operation.