Building Arduino 1.0.1 Bootloader for Leostick

A shrunk down Leonardo-compatible board, thumb drive sized with native USB support. [Product info]
Fractal
Posts: 12
Joined: Mon May 21, 2012 10:45 pm

Re: Building Arduino 1.0.1 Bootloader for Leostick

Post by Fractal » Wed May 30, 2012 10:03 am

That would be useful, though the ideal one would be for it to try to negotiate the maximum power possible (500ma for the internal polyfuse), but even if it can't get it, store the current max power in eeprom (presumably given it's only 8 bits, store it in terms of unit loads (100 ma) ).

Then you could know in the sketch to use e.g. a lower PWM cycle, or something. Your 2 different board definitions is probably the easiest way for now though!

adr1an
Posts: 21
Joined: Tue Nov 01, 2011 10:04 am

Re: Building Arduino 1.0.1 Bootloader for Leostick

Post by adr1an » Wed May 30, 2012 1:24 pm

Problem solved, I believe for the moment regarding adjusting usbMaxPower within a Sketch.

Refer to the new thread I started: viewtopic.php?f=27&t=679

I've also updated the leostick.zip file - so if you have downloaded it previously might want to grab a new copy

User avatar
jonoxer
Freetronics Staff
Freetronics Staff
Posts: 298
Joined: Sat Oct 15, 2011 11:31 am
Location: Melbourne, Australia
Contact:

Re: Building Arduino 1.0.1 Bootloader for Leostick

Post by jonoxer » Fri Aug 31, 2012 11:48 am

Hey @adr1an, that's excellent work you did with the Caterina bootloader!

We've now switched to Caterina ourselves so the last thousand or so LeoSticks have shipped with the Caterina bootloader and our own officially registered VID/PID, and I've created a new board profile specifically for the LeoStick + Caterina combo. I've also created a unified .inf file that includes the VID/PID pairs used on every device we've ever shipped, to make it easier to install if you're using Windows.

There's more info here:

viewtopic.php?f=27&t=285&start=10#p3312
--
Jon

the nerdling
Posts: 10
Joined: Mon Dec 10, 2012 11:13 pm
Location: my house
Contact:

Re: Building Arduino 1.0.1 Bootloader for Leostick

Post by the nerdling » Mon Dec 10, 2012 11:27 pm

can you make the bootloader time longer than the original, i try to upload a sketch but the old one starts running too soon

sleat
Posts: 5
Joined: Thu Dec 20, 2012 7:49 am

Re: Building Arduino 1.0.1 Bootloader for Leostick

Post by sleat » Sat Dec 22, 2012 9:31 am

Here's a question for adr1an or anyone with some ideas about getting analogWrite to work on the red LED pin, 13,

Firstly, you give great instructions for building a new bootloader, but can you give simpler instructions for how to use the files you uploaded without rebuilding anything? Sorry if that's a stupid question, I get that you'd put the bootloader.zip items under (windows)

C:\Users\<name>\Documents\Arduino\hardware\LeoStick_v1_0

But what then? Can I burn a shiny new Caterina bootloader into my LeoStick with just Arduino 1.0.3 ide (if so, how?), or do I need to solder the ICSP header onto the thing and go find some additional hardware to burn a new bootloader into it?

I also see that if you change the bootloader, a new .inf file would be necessary, hence the new LeoStick_Bootloader_driver.zip

Secondly, is all this even necessary...

I'm just messing around with a leostick I got from JayCar, and simply trying to get analogWrite to work on D13, the red LED.

Another fellow mentioned that "new firmware" was needed, and pointed to this post, but from my understanding of how Adruinos work, whether you can use analogWrite on a particular pin is a function of a configuration or source file somewhere, not which bootloader is loaded.

If it is indeed true that a new bootloader is needed simply to support analogWrite on D13, can you explain the mechanism of that requirement? I wouldn't have thought it had anything to do with the bootloader, but with the cores code contained under:

C:\Users\Joe\Documents\Arduino\hardware\LeoStick_v1_0\cores\arduino...

Perhaps in wiring_analog.c, where there's a comment:

// Right now, PWM output only works on the pins with
// hardware support. These are defined in the appropriate
// pins_*.c file. For the rest of the pins, we default
// to digital output.

Except that this part DOES have PWM output available on pin 13!
Where is pins_(chipname?).c located?

Thanks in advance for any light you can shed on this. Always learning...

sleat
Posts: 5
Joined: Thu Dec 20, 2012 7:49 am

Re: Building Arduino 1.0.1 Bootloader for Leostick

Post by sleat » Sun Dec 23, 2012 6:45 am

In my quest for getting PWM to work with Pin D13, I've made up a freetronics-eleven based ISP jig that plugs onto the 6 pin programming header on the LeoStick, but a question has arisen.

There are two hex files under the bootloaders directory that adr1an published in the file leostick.zip

Caterina-Leonardo.hex, and
Caterina-LeoStick.hex

So when one selects Arduino ISP as the programmer, then selects the Freetronics LeoStick as the board (which finds it under hardware in the sketchbook directory?) and then selects "burn bootloader" from the IDE, which of the two files does the PC-side burn program select, and what criteria does it use to decide which one to select?

wintrmute
Posts: 6
Joined: Sun Mar 04, 2012 8:13 am

Re: Building Arduino 1.0.1 Bootloader for Leostick

Post by wintrmute » Tue May 07, 2013 8:58 am

sleat wrote: There are two hex files under the bootloaders directory that adr1an published in the file leostick.zip

Caterina-Leonardo.hex, and
Caterina-LeoStick.hex

So when one selects Arduino ISP as the programmer, then selects the Freetronics LeoStick as the board (which finds it under hardware in the sketchbook directory?) and then selects "burn bootloader" from the IDE, which of the two files does the PC-side burn program select, and what criteria does it use to decide which one to select?
I'm guessing that it reads boards.txt which has a line it:
leostick.bootloader.path=caterina
leostick.bootloader.file=Caterina-Leostick.hex

wintrmute
Posts: 6
Joined: Sun Mar 04, 2012 8:13 am

Re: Building Arduino 1.0.1 Bootloader for Leostick

Post by wintrmute » Tue May 07, 2013 9:03 am

sleat wrote: But what then? Can I burn a shiny new Caterina bootloader into my LeoStick with just Arduino 1.0.3 ide (if so, how?), or do I need to solder the ICSP header onto the thing and go find some additional hardware to burn a new bootloader into it?
Did you ever figure this out? I'm wondering the same thing at the moment.

angusgr
Freetronics Staff
Freetronics Staff
Posts: 853
Joined: Tue Apr 09, 2013 11:19 pm
Location: Melbourne, Australia
Contact:

Re: Building Arduino 1.0.1 Bootloader for Leostick

Post by angusgr » Thu May 09, 2013 11:41 pm

wintrmute wrote: sleat wrote:But what then? Can I burn a shiny new Caterina bootloader into my LeoStick with just Arduino 1.0.3 ide (if so, how?), or do I need to solder the ICSP header onto the thing and go find some additional hardware to burn a new bootloader into it?

Did you ever figure this out? I'm wondering the same thing at the moment.
You need a second piece of hardware, unfortunately. It can be a second Arduino-compatible device, though. If you install the new official LeoStick board profile v3.3, there is an overview of the upgrade process here.

Post Reply