Too lazy to research, so I'll ask about Arduino bootloader

Go To Last Post
8 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Can winAVR flash an AVR which uses the Arduino serial bootloader?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

My mistake, I thought this was a joke.

Last Edited: Sat. Jul 24, 2010 - 05:57 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The Arduino-IDE calls in fact avrdude with option stk500v1. I saw also an option "arduino" in avrdude, but I'm not sure if it is for legacy reasons or if it does the toggling of the handshake lines to reset the MCU and jump in the bootloader.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The Arduino bootloader uses the stk500v1 protocol.
Using the '-c arduino' programmer in avrdude toggles the handshake lines so that the Arduino jumps into the bootloader.

So you can load ANY program into the Arduino hardware. Simply set the relevant $(AVRDUDE) macros in your Makefile.

The Arduino comes with the ArduinoISP sketch. This converts any Arduino into an ISP programmer. Connect the target ISP lines and some status LEDs.

Invoke with 'avrdude -c stk500v1 -b 19200 ...'

Incidentally, I actually flash Arduino target board via the CodeVision Tools menu for CV projects.

WinAVR projects are flashed by a regular 'make all program'

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

uracolix wrote:
The Arduino-IDE calls in fact avrdude with option stk500v1. I saw also an option "arduino" in avrdude, but I'm not sure if it is for legacy reasons or if it does the toggling of the handshake lines to reset the MCU and jump in the bootloader.

The Arduino hardware currently has a hardware kludge on it to reset the MCU back into the bootloader.
This is very important as it is the only way to get avrdude to work automatically with the current version of the Arduino bootloader.
Without it you have to press the reset button and the current Arduino bootloaders do not wait very long (like half second or less) before starting up the application code.
Yes you can use the manual reset, but you have be quick
to start avrdude after you press reset otherwise the bootloader will not be running when avrdude tries to talk to it.

They used a capacitor between the serial port DTR signal and the reset line on the MCU.
If the OS is configured properly, this will cause the MCU to be momentarily reset when the serial port is opened and the DTR signal is driven low.
The cap keeps the signal from permanently being driven low.

Back to the "arduino" type. A while back I saw a hack to avrdude that put in code to explicitly drive DTR line so that the downloading did not depend on the OS configuration of driving the DTR line or the capacitor hardware hack.

But I think that people have decided that they prefer the hardware hack and so need for the avrdude arduino board type seems to have lost importance/favor.
as vendors all starting including the capacitor hardware hack on all their boards.
And over time, the bootloaders have been updated/modified to dramatically shorten the application boot time from the bootloader (from 10 seconds down to less than 1 second) to the point where it can be difficult to manually reset the board to work with avrdude if you don't have the capacitor hack in your hardware.

As far as winavr compatibility, one of the reasons that the Windows Arduino release is so large, is that it includes a full WinAVR binary release. It is buried down in a sub directory under the Arduino directories and not installed in the normal WinAVR locations.
It is actually nice because the entire full toolset is there together with the Arduino files with no install/uninstall tools to get confused or not work properly. Simply unzip the Arduino image wherever you want and go.

And since the full WinAVR release is there including the unix utility commands, you can use any of the other tools outside the IDE, like diff, grep, make, etc... (the IDE doesn't use very much of WinAVR)

Not sure what the Arduino guys are going to do, now that there are not going to be any further WinAVR releases.

--- bill

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

bperrybap wrote:
...kludge...
I have to assume that you are using the positive warm and fuzzy definition of kludge that means 'brilliantly appropriate use of technology to fit the intended market'?

Smiley

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have a real Arduino board (Seeeduino v328) and also a mega168 sitting in the STK500.

Any Arduinos that use the 'brilliantly appropriate use of technology' work beautifully.

The 'bare mega168' on the STK500 requires me to use a 10-sec bootloader, and judicious use of my pinkies.

I think the Seeeduino is brilliant. It has the standard Arduino female headers, but you can solder additional male headers that line up on a 0.1" matrix. It is really easy to add additional hardware via these extra headers.

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

david.prentice wrote:

Any Arduinos that use the 'brilliantly appropriate use of technology' work beautifully.

The 'bare mega168' on the STK500 requires me to use a 10-sec bootloader, and judicious use of my pinkies.

I modified USBasploader a bit and use a tact button on my board to put it into the bootloader. It's a much better (imo) setup than arduino as long as you're using avrdude (it emulates usbasp). I'll post the source if anyone is interested