Actions

Avr2011 Programming The Kit: Difference between revisions

From HacDC Wiki

No edit summary
Line 13: Line 13:
= Getting the Board Into Bootloader Mode =
= Getting the Board Into Bootloader Mode =


* Hold down the "B" button, which is hooked up to PD2
When the chip starts up, the bootloader program checks for the "B" button (connected to 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.  So, what you want to do is reset the chip while the "B" button is pressed.
* Tap the "A" button (hooked up to RESET) while keeping "B" held down
 
To get the chip into ready-to-program Bootloader Mode:
 
* Hold down the "B" button
* Tap the "A" button (RESET)
* Now you can release the "B" button
* 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 =
= Programming the Chip =


* Get the chip into bootloader mode
* Get the chip into bootloader mode
* While you're in the directory with your code and the Makefile, type "make" into the terminal
* While you're in the directory with your code and the Makefile, type "make" or "sudo make" into the terminal
* Your code will compile, and it will upload your code to the chip -- if all is well you will see a ghetto progress bar
* Your code will compile, and it will upload your code to the chip -- if all is well you will see a ghetto progress bar
* The chip will automatically reset and start running your program
* The chip will automatically reset and start running your program
Line 30: Line 33:


Common problems and their solutions include:
Common problems and their solutions include:
* Permissions to write to USB port.  Solution: "sudo make" or add yourself to the USB output group (see below).


= Tweaks =  
= 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.  <pre>sudo usermod -a -G dialout yourNameHere</pre>
* 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.  <pre>sudo usermod -a -G dialout yourNameHere</pre>

Revision as of 17:59, 6 March 2011

Hookup:

  • 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.

Plug the FTDI cable into the board -- black wire to GND.

Avr2011 cable hookup.jpg

Getting the Board Into Bootloader Mode

When the chip starts up, the bootloader program checks for the "B" button (connected to 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. So, what you want to do is reset the chip while the "B" button is pressed.

To get the chip into ready-to-program Bootloader Mode:

  • Hold down the "B" button
  • Tap the "A" button (RESET)
  • Now you can release the "B" button


Programming the Chip

  • Get the chip into bootloader mode
  • While you're in the directory with your code and the Makefile, type "make" or "sudo make" into the terminal
  • Your code will compile, and it will upload your code to the chip -- if all is well you will see a ghetto progress bar
  • The chip will automatically reset and start running your program


If there are errors...

Common problems and their solutions include:

  • Permissions to write to USB port. Solution: "sudo make" or add yourself to the USB output group (see below).


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