Put Teensy Into program mode from code.

Hi All,

I have a project where we have 10 Teensy 3.6 boards installed in a system and they work perfect however they are inside 3D printed cases with other parts and we have an external USB port on the case for each of the Teensy boards for serial Comms and the likes.

However when we make software changes we have to open the cases to push the button to allow the TeensyDuino software to upload the HEX files, is there a way to either mount an external Button on the box to replicate the onboard button with GPIO etc or a Serial Command I can send that will cause the board to enter the Programming mode?

Thanks

Cliff.
 
if you have USB connected and program is running, there is no need to press program button to download now code.
 
if you have USB connected and program is running, there is no need to press program button to download now code.

There is if the Teensy has gone to sleep or into some other non communicative condition, even if under program control!
 
If the conditions exist as explained in my post, the Teensy WILL NOT go into bootmode when the USB is connected ONLY when the button is pressed!!
 
The techs onsite don't have any IDE's installed on the machines only the TeensyDuino installed and they will have the HEX file from the Builds and it's this they need to load onto the board. They can plug a Serial cable into the Serial port so need a way for them to upload the HEX file but without being able to touch the board and push any button on the board.
 
I assume your techs will have a Laptop? If so, just install tyTools from here https://github.com/Koromix/tytools/releases/tag/v0.9.5 and use it to upload the firmware to your boards. As mentioned above, as long as the existing firmware doesn't have severe bugs which disable/disturb the USB connection you don't have to press the button for downloading. (But you wouldn't have installed such a bad firmware in the first place right?)
 
Last edited:
Doesn't asm("bkpt #251"); work anymore?
Or just setting the magic baudrate? (Forgot what is was.. 123 Baud or such... pretty low and no standard) You can find it the core code.
 
Doesn't asm("bkpt #251"); work anymore?
Or just setting the magic baudrate? (Forgot what is was.. 123 Baud or such... pretty low and no standard) You can find it the core code.

Magic baud number is == 134

The 1062 uses : asm("bkpt #251"); // run bootloader
 
FWIW, in the early days of Teensy, around 2008-2009, the drivers on most operating systems only allowed the baud rate to be set to specific known values. I did quite a lot of testing to find the list of baud rates Windows, MacOS and Linux all supported. 134 was chosen because it was the least commonly used number which worked on all 3 systems in those early days, when most PCs were running Windows XP service pack 2, and Apple still named their operating systems after big cats.

As far as standards are concerned (specific baud rates are de-facto standards), apparently some IBM Selectric terminal (basically a typewriter with serial port) used 134.5 baud, which is probably why 134 appears on the list of known baud rates on all systems.

Three years later in 2012, when Arduino made Leonardo (their first native USB board) they just chose 1200 baud to trigger reboot. I'm still a bit surprised they would choose a number which is easy to use accidentally from their own baud rate menu and GUI on most terminal emulator programs.
 
Back
Top