Auto-Updating Teensy 3.2 firmware

Status
Not open for further replies.

greg

Well-known member
Hi,

So, the day has come for us that we need to ship our Teensy3.2-based devices to end users. Its a Windows 10 + teensy device (an entertainment robot) that has a bunch of Windows-side software interfacing with firmware on Teensy 3.2 (using Raw HID).

The software is going to evoelve - we know that, and we know how to do the updates. But how do we deal with updating teensy firmware to match the changes in software? Of course, every attempt is made to "future proof" the firmware, but realistically, we know it is going to happen at some point that we would like to flash a new firmware as part of our auto-update.

Any tips on how that can be done?
 
Any tips on how that can be done?

The windows way:
- provide hex file and teensy.exe in a zipped directory to your user.
- let it unzip into directory of choice.
- let user open teensy.exe
- let user select hex file "file -> open hex file", which should be in same directory
- let user press button on teensy,
then program should be loaded onto teensy.

It cannot be simpler than that for both sides.

Caveat: needs access to program button (either on teensy or brought out of the box)

Variation (TBC by Paul):
ship also the two programs: teensy_reboot.exe and teensy_restart.exe
then you should be able to do everything via the teensy.exe menu (without button press, if teensy is running)

Alternative.
ship .hex file with teensy_loader_cli.exe and prepare a bat command file that has the proper instruction programmed in
and ask user only to execute the bat file.
Caveat: I use this with my mods of the cli https://github.com/WMXZ-EU/teensy_loader_cli, but I'm not sure about Paul's original.

PS: In how far Ty Commander (aka TyQ) is suited I don't know.
 
TyCommander should work as well - the command line version could be batch file driven. As a HID device on any OS - not sure it would need any drivers to be seen and programmed by TyComm - program button access makes it a sure thing being visible.
 
Interesting ...

Thanks!

I'm really looking for something that would not require user pressing the rest button on the teensy. The electronics are deep inside the device we sell.

So, this seemed promising:

Alternative.
ship .hex file with teensy_loader_cli.exe and prepare a bat command file that has the proper instruction programmed in
and ask user only to execute the bat file.
Caveat: I use this with my mods of the cli https://github.com/WMXZ-EU/teensy_loader_cli, but I'm not sure about Paul's original.

Awesome! This would be the way to go for us, since we could run the batch file automatically as part of our overall system update. However, after playing with teensy_loader_cli, seems the user still needs to press the reset button on the teensy? https://www.pjrc.com/teensy/loader_cli.html (Unless we add a second teensy just to enable the 'hands free" option?) Or am I missing something?
 
The Teensy 'button' is Program not Reset. Look at TyCommander to see if it better fits your needs (formerly TYQT).
 
Sorry, I typed up my response to WMXZ before reading your suggestion wrt TyCmd. Its exactly what I needed, works like a champ. Thanks so much defragster!
Do I need to have Teensy/Teensyduino installed on a PC from where I'm going to run the tycmd? We will be flashing the latest FW version before shipping, would prefer the PC to have the least amount of necessary pre-reqs (but still able to run fully automatic FW updates).

Thanks again.
 
Thanks!

I'm really looking for something that would not require user pressing the rest button on the teensy. The electronics are deep inside the device we sell.

So, this seemed promising:



Awesome! This would be the way to go for us, since we could run the batch file automatically as part of our overall system update. However, after playing with teensy_loader_cli, seems the user still needs to press the reset button on the teensy? https://www.pjrc.com/teensy/loader_cli.html (Unless we add a second teensy just to enable the 'hands free" option?) Or am I missing something?

That is why I modified the loader_cli to find teensy, put teensy into program mode and reset teensy after reprogram. (I give my GitHub)
Edit: must check if the GitHub has really the complete program, if not will update soon)
Edit: should be latest: needs -s flag to go into program mode

I know similar things were done by Koromix (TyCommander). We were using the same original programs. Koromix developed a new system, I tried to modify the original as minimal as possible.
Anyhow, the possibility and information is out there.
 
Last edited:
Sorry, I typed up my response to WMXZ before reading your suggestion wrt TyCmd. Its exactly what I needed, works like a champ. Thanks so much defragster!
Do I need to have Teensy/Teensyduino installed on a PC from where I'm going to run the tycmd? We will be flashing the latest FW version before shipping, would prefer the PC to have the least amount of necessary pre-reqs (but still able to run fully automatic FW updates).

Thanks again.

AFAIK - TyCmd can run stand alone - given the exe file - just open the zip and run it and it will see your Teensy.
 
Just wondering out loud, are there any distributions of TyCmd as part of a product? Not that it matters to me as I only do stuff for my own fun.
 
It is open source - under this license

Note sure if that covers all or not?

This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means. ...
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ...
 
Fast off-topic question: When you deliver the hex file, how can you know that someone won't copy your board, upload your hex on a new teensy, plug it to your board and finally clone your project?
 
Fast off-topic question: When you deliver the hex file, how can you know that someone won't copy your board, upload your hex on a new teensy, plug it to your board and finally clone your project?

Let the program read the unique Id of each teensy board. If it is not the one your update is aimed for, erase the flash and you create a crash.
(there is one satanic option, you should even not think about, as it will hurt your self while testing the program)
 
That's a very, very good solution! Do you have any link/tutorial/example I could look at so not more of me disturbing the topic? Thanks!
 
I'm using this simple batch file to (remotely) upload new firmware to a Tennsy 3.2 connected to a Raspberry Pi (running raspbian linux).

Code:
#! /bin/sh
stty -F /dev/ttyACM0 speed 134
sleep 1
/path/to/teensy_loader_cli -v -mmcu=mk20dx256 /path/to/your/firmware.hex

.. where "/dev/ttyACM0" is the serial port (a hint for Windows users only).

Obviously, you don't need to push any reset/programming button.
 
Fast off-topic question: When you deliver the hex file, how can you know that someone won't copy your board, upload your hex on a new teensy, plug it to your board and finally clone your project?

That'a a great question. The main value of the product is not the firmware, its the software running on the PC and the service that the software is using located in the cloud.
 
Status
Not open for further replies.
Back
Top