Trinket: how to stop bootloader mode on power up?
Moderators: adafruit_support_bill, adafruit

Trinket: how to stop bootloader mode on power up?

by TheChicagoWay on Thu Sep 26, 2013 3:01 am

Hi,

I finally got the Trinket programmed (had to use Avrdude as Arduino IDE didn't work :x ). Anyway, I uploaded the NeoPixel strandtest and it works fine then I pulled power waited a few seconds and put the power back. Once power was applied the bootloader mode started and I had to wait the 10 seconds then the strandtest ran. How can I force trinket to only enter bootloader mode when the button is pressed? I do not want a 10 second delay every time.

I appreciate the assistance.

Cheers!
TheChicagoWay
 
Posts: 18
Joined: Fri Mar 22, 2013 1:08 am

Re: Trinket: how to stop bootloader mode on power up?

by adafruit on Thu Sep 26, 2013 10:26 am

The trinket does it's best to detect whether its connected to a computer, one thing that will help is making sure nothing is tied to #3 or #4 which can interfere with the detection :)
User avatar
adafruit
 
Posts: 11712
Joined: Thu Apr 06, 2006 4:21 pm
Location: nyc

Re: Trinket: how to stop bootloader mode on power up?

by TheChicagoWay on Mon Sep 30, 2013 3:27 am

So went to battery connection on the Trinket hoping that would eliminate the bootloader mode which it seems to do but there is still a 4 - 6 second delay before anything happens on the NeoPixel strip. This is kind of unfortunate since it doesn't meet my requirements. The Atmega32u4 Breakout Board http://www.adafruit.com/products/296 doesn't have this problem. But to keep the cost down I will try shrinkifying down to the ATtiny85 myself on the NeoPixel strip.

I hope to see updates to Future trinkets that don't have this issue.

Cheers!
TheChicagoWay
 
Posts: 18
Joined: Fri Mar 22, 2013 1:08 am

Re: Trinket: how to stop bootloader mode on power up?

by frank26080115 on Mon Sep 30, 2013 4:05 am

If you already own a ATmega32U4 and do not like the Trinket bootloader, you can turn the ATmega32U4 into an AVR programmer and then erase the bootloader from Trinket, then flash code without using the bootloader.

The bootloader timeout is an unfortunate necessity. Experimentation showed that some USB hosts take an extra long time to establish a connection, which is what the bootloader waits for during the first 4-6 second period. After that, if no host communication is detected, then the bootloader ends. If communication does occur, then the bootloader waits another 10 second waiting for AVRDUDE specific commands.

The reason why the ATmega32U4 can do this slightly faster is because that chip has a dedicated pin specifically to detect VBUS, so it can simply check the voltage instead of waiting for communication to start. Whereas we cannot sacrifice a GPIO on the ATtiny85 for this job.

If you really need instant startup, you should not use the bootloader.

Or... it is possible to hack the bootloader to require a button press on launch, are you interested in that? All it would take is to disable all the timeout code and then add a simple pin check in the beginning of the bootloader. There will still be a small delay but it will be milliseconds or microseconds.
frank26080115
 
Posts: 120
Joined: Fri Jun 15, 2007 1:04 am

Re: Trinket: how to stop bootloader mode on power up?

by pooldr on Mon Sep 30, 2013 9:15 am

I'm curious,

Have spent about 15 hours messing with the trinket, Two different computers, 4 different versions of IDE, two different usb cables, and what seems like a Trinket that won't leave bootloader mode, just keeps on going. Maybe that is what is supposed to happen ??

Anyhow, that's one issue. The other is that i just cant communicate to the damn thing, the last roadblock i have hit, is that the avrdude.conf has syntax errors, that just great. I haven't even started to code yet!

What does one have to do, it would seem that the instruction are very inconsistent, and i'm ready to chuck this thing away and just use a Flora.

Any help appreciated.

Doug
pooldr
 
Posts: 16
Joined: Mon Sep 30, 2013 8:56 am
Location: Philadelphia

Re: Trinket: how to stop bootloader mode on power up?

by adafruit_support_rick on Mon Sep 30, 2013 9:40 am

What kind of computer are you using, Windows? There is a known issue with Windows and the Trinket - you have to hit the bootloader timing just right on the first sketch upload. After you have a working sketch loaded, you should have no more bootloader problems.

Press and release the reset button on the Trinket just before the upload begins.

I'm not aware of any syntax errors with avrdude.conf. What errors are you seeing? Can you post the complete output from avrdude?

adafruit_support_rick
 
Posts: 12904
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: Trinket: how to stop bootloader mode on power up?

by TheChicagoWay on Mon Sep 30, 2013 2:47 pm

@frank26080115

Or... it is possible to hack the bootloader to require a button press on launch, are you interested in that? All it would take is to disable all the timeout code and then add a simple pin check in the beginning of the bootloader. There will still be a small delay but it will be milliseconds or microseconds.


What you have suggested above sounds exciting and sounds like it would solve the problem. If it can require to just press the button already on the board to go into bootloader mode that would be great. I am new to all of this so if you have some specific instructions to help me out, I would appreciate it.

Cheers!
TheChicagoWay
 
Posts: 18
Joined: Fri Mar 22, 2013 1:08 am

Re: Trinket: how to stop bootloader mode on power up?

by pooldr on Mon Sep 30, 2013 9:48 pm

for me its been a bad trip, why waste so much time with something that costs $8 (as an IDE user). I would rather have a larger footprint using a Flora (and spend $24) and have NO issues with comms. That way you can get directly going with what it is you intended to do, whatever it was, lol...(can't remember now,.)

Couldn't the flora be shrunk by another 8mm in diameter, make those pads a little smaller..

just another thought



Doug
pooldr
 
Posts: 16
Joined: Mon Sep 30, 2013 8:56 am
Location: Philadelphia

Re: Trinket: how to stop bootloader mode on power up?

by frank26080115 on Mon Sep 30, 2013 10:45 pm

TheChicagoWay wrote:What you have suggested above sounds exciting and sounds like it would solve the problem. If it can require to just press the button already on the board to go into bootloader mode that would be great. I am new to all of this so if you have some specific instructions to help me out, I would appreciate it.


I made a separate branch in https://github.com/adafruit/Adafruit-Tr ... activation

Make sure the branch is "button-boot-activation" before you download

Test it for me please?

Connect some sort of momentary switch between pin #3 and ground. To activate the bootloader, hold this new button while pressing reset and releasing reset. The logic is that, upon reset, if pin #3 is low, then start the bootloader.

But beware, you must also release the new button or else the USB bus won't start working!

The timeout is removed in this branch.

The maximum sketch size is bigger with this branch, because the bootloader is smaller, since the timeout tracking is disabled.

@pooldr can you please submit your issue in another topic? I'd like this thread to be organized about the bootloader.
frank26080115
 
Posts: 120
Joined: Fri Jun 15, 2007 1:04 am

Re: Trinket: how to stop bootloader mode on power up?

by adafruit_support_rick on Tue Oct 01, 2013 9:05 am

@pooldr - Sorry for the problems. They will be addressed in a future release of the Trinket. Meanwhile, you can contact support@adafruit.com with a link to this thread if you'd like a refund.

The Gemma looks like a shrunken Flora, but it operates the same way as the Trinket.

adafruit_support_rick
 
Posts: 12904
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: Trinket: how to stop bootloader mode on power up?

by mrburnette on Tue Oct 01, 2013 9:29 am

@ Frank Z:

The maximum sketch size is bigger with this branch, because the bootloader is smaller, since the timeout tracking is disabled.


Would this not necessitate a change in the Trinket boards.txt file in the hardware directory so that the GUI can get things correct at compile time? Or, have I totally missed the boat?

gemma/trinket3/trinket5.upload.maximum_size=5372


Thx,

Ray
mrburnette
 
Posts: 49
Joined: Tue Sep 10, 2013 9:15 pm

Re: Trinket: how to stop bootloader mode on power up?

by frank26080115 on Tue Oct 01, 2013 11:44 am

mrburnette wrote:Would this not necessitate a change in the Trinket boards.txt file in the hardware directory so that the GUI can get things correct at compile time? Or, have I totally missed the boat?

gemma/trinket3/trinket5.upload.maximum_size=5372


That's a minor detail I forgot to mention, sure, change it, you should.

I don't use Arduino's IDE so I tend to forget about these things. If you go over the code size limit, the bootloader will fail during the verification process, so I get lazy.
frank26080115
 
Posts: 120
Joined: Fri Jun 15, 2007 1:04 am

Re: Trinket: how to stop bootloader mode on power up?

by kscharf on Thu Oct 03, 2013 2:00 pm

Most of the AVR's should have a register that when read tells the source of the reset, IE: power up or reset pin. So a bootloader shouldn't have to read a pin, just this register. A powerup boot would bypass the bootloader, a reset pin boot would enter the bootstrap for 10-15 seconds.
User avatar
kscharf
 
Posts: 185
Joined: Wed Sep 10, 2008 10:29 am

Re: Trinket: how to stop bootloader mode on power up?

by pooldr on Wed Oct 09, 2013 9:52 am

Thanks for feedback.

I'm still stuck though. I gave up on IDE, as i have spent so much time messing with it, so i followed the AVRdude method, but i'm still pulling my hair out.

Following the instructions, on the trinket page, i hit the download AVRdude.conf blue button, however, this doesn't download the conf file, it just gives you the code. So, i found and edited the original .conf file, and replaced all the code, with the new code. file size is now 554Kb in size.

The next part of the instructions is to run 'avrdude -c usbtiny -p attiny85'

Doing this gives me yet another error, c:\WinAVR-20100110\bin\avrdude.conf:332 unrecognized character: "w"

so, i googled it and found this http://download.savannah.gnu.org/releases/avrdude/

and this

http://forum.arduino.cc/index.php?topic=74945.0

The second link gives reference to yet another AVRdude file.

http://download.savannah.gnu.org/releas ... -win32.zip
I have downloaded this and extracted to bin folder, replacing AVRdude.conf and avrdude.exe

Ran the DOS command again...!

Wow, this worked, and now i'm at the next stage in the instructions.

Ok, so next I tried the " avrdude -c usbtiny -p attiny85 -U flash:w:trinketblink.hex "
Nothing..!

Next, tried this " avrdude -c usbtiny -p attiny85 -D -U flash:w:trinketblink.hex "

The trinketblink.hex is working !! Wow, what a nightmare journey.

What now i ask myself, how am i going to write code in HEX ??

I found this statement, "For some users, they may want to program the Trinket directly with AVR-GCC as the compiler, vi/emacs as their editor and AVRdude as the uploader. That's easy to do!"

talk about going round in circles, What NOW???? (Nothing has been easy !)

a lesson i'm quickly learning, the instructions on adafruit are not sufficient, and are obviously outdated.
We can all google, but it would be helpful to not have a bunch of tabs open trying to figure out what half the terminology is, and what it is you need to do. Fine for those in the know, but not very intuitive for a first timer.

How do i take IDE code and use it with AVR, or convert it, or whatever it is you need to do ?

Any detailed advice on where or what to do now would be appreciated.
pooldr
 
Posts: 16
Joined: Mon Sep 30, 2013 8:56 am
Location: Philadelphia

Re: Trinket: how to stop bootloader mode on power up?

by adafruit_support_rick on Wed Oct 09, 2013 10:34 am

First of all, now that you have Blink loaded, see if you can go back to simply using the IDE to upload to the Trinket.

If it still doesn't work, you can find the .hex file by turning on 'verbose' output in compilation. This is a checkbox in the Preferences pane of the IDE. The last line before "Binary sketch size..." will be the path to the .hex file.

The path will be an ugly thing, but it won't change on you over multiple compiles, so you ought to be able to cd to it just the one time in avrdude.

adafruit_support_rick
 
Posts: 12904
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY