Actions

Avr2011 Programming The Kit

From HacDC Wiki

Revision as of 21:11, 5 March 2011 by Hexagon5un (talk | contribs) (Created page with "= You will need: = * your laptop * an FTDI cable * the classboard, populated with chip and FTDI header The chips we use in class are pre-flashed with a bootloader, which means ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

You will need:

  • your laptop
  • an FTDI cable
  • the classboard, populated with chip and FTDI header

The chips we use in class are pre-flashed with a bootloader, which means that you can program them over the AVR's serial port (Rx and Tx, PD0 and PD1).

Getting the Board Into Bootloader Mode

  • Hold down the "B" button, which is hooked up to PD2
  • Tap the "A" button (hooked up to RESET) while keeping "B" held down
  • Now you can release the "B" button

The logic behind this dance is that when the chip starts up, the bootloader program checks for the "B" button on PD2 being pressed. If the button is pressed, it sits and waits for programming data to come in over the serial line. If the button isn't pressed, it starts your program.

Programming the Chip

  • Get the chip into bootloader mode
  • While you're in the directory with your code and the Makefile, type "make"
  • Your code will compile, and it will upload your code to the chip
  • The chip will automatically reset and start running your program

Tweaks

  • If you're using Ubuntu, you may have to run "sudo make" in order to access the USB port. Feel free to add yourself to the "dialout" group which has the permissions.
    sudo usermod -a -G dialout yourNameHere