2

From what I understand, the Pro Trinket has "Optiboot" which allows it to detect which boot loader you are trying to use, one for USB and one for FTDI. When it's in this "bootloader state" the red LED on pin 13 buses for 10 seconds before it starts to run the program I've programmed.

Can I remove this Optiboot functionality? Would that entail permanently choosing a single boot loader/interface?

One problem I have with this is that along with the LED on 13, it causes the LED strip I have attached to pins 9, 10, 11 to blink. I would also really like to not have to wait 10 seconds to start running code.

Here's the page on Adafruit's site that talks about the bootloader[s] on the Pro Trinket.

Thanks!

migrated from electronics.stackexchange.com Jan 26 '15 at 1:01

This question came from our site for electronics and electrical engineering professionals, students, and enthusiasts.

  • 1
    If you have the source code and a programmer and the drive to dive into detail, then yes, you can presumably do that. – Chris Stratton Jan 26 '15 at 2:26
  • 1
    Have you asked on the Adafruit forums? They probably can answer better than anyone. – Craig Jan 26 '15 at 15:23
  • 3
    Only pin 13 will blink. Pins 9-11 will be floating. Maybe you should add some pull-down resistors to the FETs connected to the led strip (which is a good idea even if you do change the bootloader). – Gerben Jan 26 '15 at 16:07
1

Just program the pro trinket using ISP. (not using the USB connector). For example by using an Arduino as a ISP-programmer.

If you are brave, you could change the bootloader to only run when the reset button was pressed, and not at power-up. I've done exactly that for the regular trinket (see my github)

1

You could take the Pro Trinket bootloader source code and tweak it to your needs, burn it, and make sure you have patience and debugging skills.

From the author's (Frank Zhao) source code, it seems that this is the 10 seconds loop you are referring to, located in main.c, line #456:

if ( ((usbHasRxed != 0) && (timeout > USBBOOTLOADER_TIMEOUT)

The USBBOOTLOADER_TIMEOUT variable which is defined to 10 at the top of that file, line #70:

#define USBBOOTLOADER_TIMEOUT 10

and is progressed after 'roughly' 1 second, at line #496:

// roughly 1 second
#if (F_CPU == 12000000)
    if (t1ovf > 183) {
    #elif (F_CPU == 16000000)
    if (t1ovf > 244) {
    #endif
        t1ovf = 0;
        timeout++;
    }
0

I'd be careful to remove that section because these ten seconds are not only where the board detects which bootloader to use but also when it is accepting a new sketch at all. So if you'd get rid of that, you wouldn't be able to upload new sketches anymore i guess.

  • That's more of a comment than an actual answer. You could tweak the timing so it fits better, woulnd't be a problem. IF you can change the bootloader you should also be able to undo it (same tools/same changes). I'm not sure if the bootloader does the blinking, you could also easily disable that in the bootloader. But yeah, I would test it before shipping it to customers ;D – Paul Mar 22 '16 at 15:01
0

It is actually much simpler than the other answers suggest. There is no need to remove/overwrite the bootloader. You can just disable the bootloader by setting the appropriate fuse bit.

In order to do so, you need an ISP programmer. As you might know, you'll loose the ability to upload code though USB/FTDI. But you can restore that ability at any time, just by resetting the appropriate fuse bit to its original value.

Step 1: Connect your trinket through an ISP programmer

There is no ISP header on the trinket, but you can easily build one or just use jumper wires to connect the individual pins directly to the programmer. Pinout can be found at learn.adafruit.com. You need to connect MISO, MOSI, SCK, RST, VCC and GND.

Step 2: Determine current fuse configuration

avrdude -c usbtiny -p m328p

If you're using a different programmer than the USBTinyISP, replace usbtiny with the appropriate identifier. List possible values by specifying a bogus identifier, eg. avrdude -c foo.

Among some other things, avrdude should return a line containing the current fuse values. It should look similar to the following:

avrdude: safemode: Fuses OK (E:FD, H:D0, L:FF)

We're interested in the high fuse (H:D0). D0 indicates that the bootloader is enabled. Actually, any even number means the bootloader is enabled.

Step 3: Calculate new fuse value

We want to set the BOOTRST bit of the high fuse. It is the least significant bit of the fuse, which equals the number 1. So all we need to do is increment the value by 1.

In the example, the new fuse value is D1.

If you are unsure how to calculate the fuse value, you can use the Fuse Calculator. Choose ATMega328P as your device, enter the fuse values as reported by avrdude at the very bottom under "Current settings", then click apply. Uncheck BOOTRST in the "Manual fuse bits configuration" section, then you will see the new fuse value in the bottom section, where you entered the original value.

Step 4: Program new fuse value

avrdude -c usbtiny -p m328p -U hfuse:w:0xd1:m

Again, replace usbtiny with the identifier of your programmer. If you calculated a different value than D1, replace 0xd1 with your approriate value. However, if your original value for the high fuse was D0, then your new value is D1.

Done!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy