PDA

View Full Version : Newbie: Question about the "Teensy Loader"



Dirk67
11-21-2012, 05:17 PM
Hi,
I'm just a newbie to the arduino- and/or teensy -"world"

I played around already a lot with the C-language, Atmel Studio 6 and flashing AVR's the classical way with the "AVRISP mkII".

Now I found your teensy series of boards and see a lot of advantages for me (maybe... in future...)

Now my Questions about the "Teensy Loader" (mainly about Teensy 2.0):

- It would be important for my planned projects in future
that laymen can update the firmware of the boards (just with their own PC and a simple USB Cable)
This is possible if I understood the "Teensy Loader" concept right... (?)

- The second thing is that the same laymen should also be able to upload new EEPROM contents (EEPROM-Hex-file) by the bootloader.
(I saw this possibility on other bootloaders --> e.g. this one --> http://download.chip45.com/chip45boot2_infosheet.pdf )
is this possible with the "Teensy Loader" as well ?

- can the "Teensy Loader" be used for the teensy 3.0 as well ?

- does the Teensy board (the HalfKay) "wait" (for the "Teensy Loader") after each reboot* some seconds before the user program starts to run ?
*(each reboot = no matter if power-up-event or (reset-)pushbutton)
or the same question the other way around:
- does the HalfKay "distinguish" if the reset comes from a regular power-up-event or from the pushbutton ?


Thanks in advance for your patience ... :o

JBeale
11-21-2012, 07:33 PM
Teensy 3 does not work quite the same way as Arduino. Note that the pushbutton on the Teensy 3 is actually a "program" button, not just "reset", so it starts up the bootloader which is in the secondary ARM chip on the Teensy 3, and waits for the PC to send it a new software load (eg. hex file). There is a reset line brought out to the edge pin, but you have to add your own pushbutton to short it to ground for a reset. With that reset line there is no bootloader in the way, your own program starts running immediately.

PaulStoffregen
11-21-2012, 10:14 PM
The startup behavior - which program runs when - is documented on the Getting Started page.

http://www.pjrc.com/teensy/first_use.html

On both Teensy 2.0 and 3.0, your program runs when the board powers up. The bootloader does not run unless you push the button, or your program explicitly attempts to jump to the bootloader code.

The Teensy Loader has an undocumented feature, currently only on Teensy 2.0, where it looks for EEPROM data in a corresponding .elf file. If an elf file with the same name as your hex file is found, and it contains the same binary firmware image, and if it has eeprom data embedded, the Teensy 2.0 gets its eeprom memory written with that data. This feature is not yet supported for Teensy 3.0, but I plan to add it in a few months.

Dirk67
11-22-2012, 06:01 AM
thanks for you answers.

So I understand, that it's not possible to upload the eeprom data (e.g. special machine parameter sets) separate from the firmware,
one can upload only firmware and eeprom data in one common step.

[Edit]
is it possible for the teensy 2.x boards to work with the atmel factory configured USB bootloader
and atmel "flip" application (or compatible like e.g. http://dfu-programmer.sourceforge.net/ )
instead of HalfKay/Teensy Loader?
--> http://www.atmel.com/Images/doc7769.pdf
--> http://www.atmel.com/Images/doc7618.pdf
--> http://www.atmel.com/Images/doc8457.pdf
--> http://www.atmel.com/tools/FLIP.aspx?tab=overview

spencoid
11-22-2012, 06:42 PM
if i am using the stock Arduino IDE with the Teensy add on, how do i get the hex code to upload for firmware updates? when i compile and upload using the IDE there is no hex file saved anywhere unless there is an option of which i am not aware. it must be written to a temp location and then deleted. i want to make a very simple HID to use for a variety of data acquisition applications. i was previously using USB gamepads by making my own switches pots etc.

Nantonos
11-23-2012, 09:31 PM
if i am using the stock Arduino IDE with the Teensy add on, how do i get the hex code to upload for firmware updates? when i compile and upload using the IDE there is no hex file saved anywhere unless there is an option of which i am not aware. it must be written to a temp location and then deleted..
Yes, it is written to a temp location.
Some enhanced IDEs have options to tell you where and what filename.

spencoid
11-24-2012, 12:03 AM
Yes, it is written to a temp location.
Some enhanced IDEs have options to tell you where and what filename.

found this very useful link to specify the build folder which will contain the hex files.

http://www.thinkcreate.org/index.php/debug-arduino-with-proteus/

Dirk67
05-21-2013, 07:24 AM
sorry I have to ask that again:

is it possible for the teensy 2.x boards to work with the atmel factory configured USB bootloader
and atmel "flip" application (or compatible like e.g. http://dfu-programmer.sourceforge.net/ )
instead of HalfKay/Teensy Loader?
--> http://www.atmel.com/Images/doc7769.pdf
--> http://www.atmel.com/Images/doc7618.pdf
--> http://www.atmel.com/Images/doc8457.pdf
--> http://www.atmel.com/tools/FLIP.aspx?tab=overview[/QUOTE]

PaulStoffregen
05-21-2013, 09:11 AM
is it possible for the teensy 2.x boards to work with the atmel factory configured USB bootloader
and atmel "flip" application

The short answer: no, but maybe.

No, as shipped by PJRC, they definitely do not work with Flip.

Maybe they could be made to work, but you'd need to do to the trouble of soldering (or otherwise connecting) a 6 pin ISP cable and ISP programming Atmel's bootloader (do they still provide the .hex file?) Not only is this a time-consuming step, but you can never restore the board back to the Halfkay bootloader. So if you attempt this, please do so knowing it is permanent, and there is no guarantee it will even work. This is definitely not recommended.

But really, why would you want to use Atmel's Flip program anyway?

Dirk67
05-21-2013, 09:31 AM
The Teensy Loader has an undocumented feature, currently only on Teensy 2.0, where it looks for EEPROM data in a corresponding* .elf file. If an elf file with the same name as your hex file is found, and it contains the same binary firmware image, and if it has eeprom data embedded, the Teensy 2.0 gets its eeprom memory written with that data. This feature is not yet supported for Teensy 3.0, but I plan to add it in a few months.


But really, why would you want to use Atmel's Flip program anyway?

my intention is to enable a "layman" (=users of my application) to upload EEPROM-data to the board
and doing this separate from my normal firmware in flash (without 'touching' / overwriting my normal firmware) ...

*(my EEPROM files are not corresponding with my firmware-versions / are independent from firmware-versions)

this is the only reason for me to think about that...

Nantonos
05-21-2013, 03:55 PM
Why not make your program on Teensy capable of downloading and writing eeprom firmware on request?

PaulStoffregen
05-21-2013, 04:10 PM
I would agree with Nantonos, that coding this feature into your program is the best way.


my intention is to enable a "layman" (=users of my application) to upload EEPROM-data to the board
and doing this separate from my normal firmware in flash (without 'touching' / overwriting my normal firmware) ...


Teensy Loader has a feature where it will automatically program the EEPROM with any EEMEM variables from your program. It will automatically look for a .elf file in the same directory as your .hex file, and if it contains any EEPROM data, that data is indeed written to the EEPROM. This happens automatically and without clicking special dialog boxes or other stuff like in Flip.

pramilo
01-13-2017, 07:47 PM
Hi all

Although it may seem I'm reviving this old thread, the question at hand is actually quite pertinent.

We are building our boards using Teensy 3.2 and using our own programmed interface to load a number of information and parameters into the EEPROM.
It would be very useful to us, to have a way to load an OBJ file directly into the Teensy eeprom.

As an example, on other products (avr based) we use the Tinysafeboot bootloader:
with it, we can build a workflow where
- we dump a model EEPROM to an OBJ file once and then
- we then use a script that basically modifies the model OBJ dump with the parameters we need for each device being prepared
- finally load it directly into EEPROM.

This is significantly faster than what we currently do, by loading the firmware, booting, writing parameters, rebooting, ....

Also, because EEPROM dumps are typically written as a sequence of bytes corresponding to the sequence of EEPROM addresses they're quite easy to manipulate on the PC end and upload them to the board.

I understand this might not be on top of the To Do list but it's definitely something we'd like to see being supported by such an advanced bootloader, and the corresponding command line tools.

Looking forward for any of your comments,

Thank you
Pedro