1

I want to make a standalone programmer for Teensy-LC in windows 8.1.

So basically I have provided the board to a client of mine and now I want to change the program loaded into the Teensy-LC board.

But the solution available right now is to send the Teensy Loader and send the hex file. But the teensy LC board is packed inside a device. So reset button cannot be pressed.

Also it would be better if this code can be burned in an installer format instead of the Teensy Loader.

Is there any way to make this work?

EDIT

My Teensy.exe does not have the option for program or reboot The icons are not accessible

Teensy.exe

Does that mean my interrupts are disabled or there might be something else I am doing wrong? My program loads on pressing the reset button but I cannot press the program button inside Teensy.exe

If I turn off the Auto Mode, all icons go grey.

AutoMode turned off

2 Answers 2

3

Paul Stoffregen (Teensy creator) has released a command line version of the Teensy Loader which can be found on his website. However, this program appears to be Linux only, so unless your client has Linux, that may be a non-starter. The source code for the program is available, so you might be able to work out the logic and port it over to whatever platform you are wanting this to work on (just make sure you comply with the source code license).

All that being said, pressing the reset button is not necessary for programming. The Teensy loader should be able to trigger a reset over USB all on its own. So unless the current program on the device disables interrupts that are necessary for the USB port to function, or it was programmed with the USB port disabled (by selecting "No USB" in the USB Type menu), physically pressing the reset button isn't necessary for programming. For more details you can see this forum post.

Loading Firmware Without Pressing the Button

When programming via Arduino, it does a lot of things for you automatically. To replicate that manually, follow these steps:

  1. Connect the Teensy to the computer via USB.
  2. Run teensy.exe (found in C:\Program Files (x86)\Arduino\hardware\tools)
  3. Click the button on the left to select the hex file to load.
  4. Go ahead and leave Auto enabled (this actually doesn't matter).
  5. Run teensy_reboot.exe (also found in C:\Program Files (x86)\Arduino\hardware\tools, this will restart the Teensy, as if you had pressed the button, and automatically start the programming process.)
6
  • I have editted my question explaining the problem I am facing. It would be great if you could help me out with what I am doing wrong in my present method.
    – newbie2015
    Jan 22, 2016 at 19:41
  • @newbie2015 They are disabled because you have auto mode turned on. Click the green auto button and they will enable.
    – Jake C
    Jan 22, 2016 at 19:43
  • I turned off the auto mode. Now all the icons go grey
    – newbie2015
    Jan 22, 2016 at 19:47
  • @newbie2015 I have added instructions, I was trying to describe it from memory (as I didn't have a Teensy handy) and I got it wrong. I got a hold of one and the correct process is described above.
    – Jake C
    Jan 22, 2016 at 20:24
  • Works perfect with this But is it possible to make a bootloader without opening the Teensy.exe? Like it is possible that I send an installer from my end like a software update and the client does not have to go through loading the hex file himself. Have the hex file embed in the installer that I sent. Is that possible?
    – newbie2015
    Jan 23, 2016 at 14:03
1

Sadly the accepted answer is incomplete and requires manual steps.

The reason why your "Auto" button is greyed out is that you did not execute the second executable that is required for that: "Teensy_Reboot.exe". You find it on your disk if you have installed TeensyDuino.

First kill Teensy.exe if it is running (Important)

Then you write path and file of your Hex file into the registry:

HKEY_CURRENT_USER\Software\PJRC\teensy\dir
HKEY_CURRENT_USER\Software\PJRC\teensy\file

Then you start Teensy.exe

Then you start Teensy_Reboot.exe as a hidden process.

That is the solution of your problem!

It is a shame that Paul does not document his stuff.

NOTE: If you have previously loaded a sketch into the Teensy that was compiled with "USB Type: No USB" the reboot will not work and the button on the board must be pressed manually, but Teensy_Reboot.exe is still usefull because it enables the green "Auto" button in Teensy.exe.

NOTE: Teensy_Reboot.exe has a severe bug: If the Teensy.exe is not successfull because another program still had the Teensy CDC COM port open while you started Teensy.exe, the Teensy_Reboot.exe may run eternally consuming 100% CPU under some circumstances. I reported that bug in the forum of Paul but he never answered to my posting.


PLAN B:

The disadvantage of using teensy_reboot.exe is that you don't know if the programming was successful or not because sadly teensy_reboot does not return any usefull exit code.

So the better option (which requires more code) is to instruct Teensy.exe directly from your program. Therefore you need a TCP connection to localhost.

You find more details in this thread: https://forum.pjrc.com/threads/38684-How-does-Teensy-Reboot-exe-communicate?p=120443 where Paul (once again) did not answer my question.


PLAN C:

You can even replace Teensy.exe with your own code. Have a look at this project: https://github.com/Koromix/ty Sadly this code depends on the huge QT library. Apart from that it may not work with future versions of Teensies.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.