Skip to content
This repository has been archived by the owner on Sep 24, 2018. It is now read-only.

Flashing

mplewis edited this page Apr 14, 2013 · 1 revision

Use whatever AVR programmer you like to program the chip. Whichever one you choose, make sure it powers the board or that you find some way to power the board.

Matt has had luck with the Pololu AVR programmer. If you want the Pololu programmer to power your target board, solder a wire between the VBUS (+5V) via and VDD pins.

When hooking the programmer up to the 2x3 ICSP headers on the board, make sure you line up the connector properly. It can be connected two ways, and if it's reversed, the board won't power on.

To flash C code on your microcontroller, you have to compile it. headslave comes with a Makefile, so run make in the headslave/ directory. You'll end up with a ServoController_tiny2313.hex file. That's what you want to flash over.

Follow the directions on Pololu's web site to set up the USB programmer.

Once your programmer is set up and you've got it working, run avrdude to transfer the .hex file to the microcontroller's flash memory.

The command Matt used on Taylor's OS X machine was as follows:

avrdude -p attiny2313 -c avrisp2 -P /dev/cu.usbmodem00043621 -U flash:w:ServoController_tiny2313.hex

  • -p attiny2313: our target chip is the ATtiny2313
  • -c avrisp2: our programmer is the AVRISP2 (the Pololu programmer emulates this protocol)
  • -P /dev/cu.usbmodem00043621: our programmer is hooked up on the virtual serial port cu.usbmodem00043621. This will be different on your system; check the Pololu docs for details on how to find your virtual port.
  • -U flash:w:ServoController_tiny2313.hex: write ServoController_tiny2313.hex to the microcontroller's flash memory.

If everything goes well, you should see something along these lines:

Trimble:headslave % avrdude -p attiny2313 -c avrisp2 -P /dev/cu.usbmodem00043621 -U flash:w:ServoController_tiny2313.hex

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e910a
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "ServoController_tiny2313.hex"
avrdude: input file ServoController_tiny2313.hex auto detected as Intel Hex
avrdude: writing flash (564 bytes):

Writing | ################################################## | 100% 0.22s

avrdude: 564 bytes of flash written
avrdude: verifying flash memory against ServoController_tiny2313.hex:
avrdude: load data flash data from input file ServoController_tiny2313.hex:
avrdude: input file ServoController_tiny2313.hex auto detected as Intel Hex
avrdude: input file ServoController_tiny2313.hex contains 564 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.12s

avrdude: verifying ...
avrdude: 564 bytes of flash verified

avrdude: safemode: Fuses OK

avrdude done.  Thank you.
Clone this wiki locally