Monday, September 6, 2010

AVRdude Loader - A New Way


  • Here is an example of how to burn .HEX files to any AVR microcontroller using AVRDUDE-GUI.
  • Any arduino board (FTDI Chip more specifically) can be used as loader.There will be four pins coming out of FTDI chip, marked as X3 on Arduino boards.
  •  
  • Here in above image,
  • 1 –> MISO
  • 2 –> SCK
  • 3 –> MOSI
  • 4 –> RESET

  • 1> FT232RL BitBang Mode AVR-Writer
  • FT232RL is an USB-Serial bridge on an Arduino Dicimila/NG/Duemilanove PCB. It has the function to manipulate each signal pin directly. It’s called BitBang Mode.

  • 2> Download the necessary files from below link.
  • my
  • Here in file given above the extension will be .doc, change it to .zip and then extract it where ever you like.

  • 3> Setting
  • Open the extracted folder and run “avrdude-GUI.exe” in it.
  • Then follow (i) to (iv) as shown in image below.
  • Now connect MOSI, MISO, SCK and RESET of that of FTDI CHIP (or ARDUINO Board) with the same pins of your microcontroller. Also give supply to your controller and connect a crystal.
  • NOTE : If you are using ARDUINO board as programmer and it is PC supplied then don’t forget to connect both the grounds, that of your ARDUINO board with supply ground of your controller.

  • 4> PROGRAMMING
  • So you are ready to burn any .hex file to your controller.
  • First, read fuse bits.
  • These bits are default bits in any virgin chip. You have to reprogram it according to frequency of the crystal you have used.
  • But before writing FUSEs, first erase chip and read lock bits.
  • So now rewrite the fuse bits as per your requirement.
  • Here are Fuse bits for some known most used controllers for crystal frequency of 16 MHz.
  • AtMega 168 :
  1. hfuse = DD
  2. lfuse = FF
  3. efuse = 00
  4. lock bit = 0F
  5. unlock bit = 3F
  • AtMega 328 :
  1. hfuse = DA
  2. lfuse = FF
  3. efuse = 05
  4. lock bit = 0F
  5. unlock bit = 3F
AtMega 8 :
  1. hfuse = CA
  2. lfuse = DF
  3. lock bit = 0F
  4. unlock bit = 3F
Once this is done, now remove “-B 4800″ from the command line. So now we are running controller in fast mode.
Now browse .hex file and burn it.
Now write lock bit again and you’re done!!!
And this is how you can use arduino board to burn any .hex file onto controller.
Note : If you want to program your controller on arduino board only (i.e. burning bootloader or so…), here is another helpful diagram.
  
All are one in the same…. So apply any one.

No comments:

Post a Comment