[McHUG] ATmega 168 Success

Rich Mitchell geobra at att.net
Thu Mar 20 08:21:41 EST 2008


I love flex time at SSA.  That means I can get to work any time between 6am and 9:30am.  So when I am nearing a solution on a McHUG type problem I can stick with it!  Yesterday afternoon I had loaded a simple Morse Code blinking program into the Butterfly (ATmega169) using our newly working makefile tool chain.  After much playing around last evening and this morning I was able to load the same program into the Arduino chip (ATmega168).  Although I don't have the "make program" step working yet, I am able to load it using the AVRDUDE command Steve gave us.  I was also using the P3 module from Modern Device - which means I used a $4 module plus serial cable instead of a $20 special cable.

C:\AVR Programs\BlinkyBoth>avrdude -F -p atmega168 -P COM2 -c stk500 -b 19200
 flash:w:BlinkyBoth.hex
avrdude: successfully opened stk500v1 device -- please use -c stk500v1
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.02s
avrdude: Device signature = 0x000000
avrdude: Yikes!  Invalid device signature.
avrdude: Expected signature for ATMEGA168 is 1E 94 06
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be perform
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "BlinkyBoth.hex"
avrdude: input file BlinkyBoth.hex auto detected as Intel Hex
avrdude: writing flash (584 bytes):
Writing | ################################################## | 100% 0.39s
avrdude: 584 bytes of flash written
avrdude: verifying flash memory against BlinkyBoth.hex:
avrdude: load data flash data from input file BlinkyBoth.hex:
avrdude: input file BlinkyBoth.hex auto detected as Intel Hex
avrdude: input file BlinkyBoth.hex contains 584 bytes
avrdude: reading on-chip flash data:
Reading | ################################################## | 100% 0.38s
avrdude: verifying ...
avrdude: 584 bytes of flash verified
avrdude: safemode: Fuses OK
avrdude done.  Thank you.

C:\AVR Programs\BlinkyBoth>

Now the approach for loading the 168 was different from the one I reported a few days ago for the butterfly.
1) cut and paste the AVRDUDE command into the command line
2) power on the ATmega168
3) hold the ATmega168 reset button down
4) press enter on the PC and let it finish
5) release the ATmega168 reset button

When I ran "make program" it was dying at the invalid signature and suggesting I use a -F param to override the error.  So with a bit of tweaking the make file should work.  So we basically are able to load C code into different Atmel chips using the same command line.  The next step is to load Arduino code (C++) into the ATmega168 using the same tool change.  Our make file will have to do things a bit differently.

By the way, when I loaded my program into the ATmega168 my LED wasn't blinking in Morse code.  I realized it was in the wrong Bare Bone Board pin and using a mapping chart I made yesterday, I moved it to the right pin and had Morse Code.

This morning I will reserve a table for 6 at Stables for tomorrow night.  So far I have Steve, Pete and Bill coming, so along with Cindy and myself that makes 5.  Let me know if anyone else wants to come and I'll change the reservation size.

Thanks and 73
Rich, N3III

--
McHUG - Physical Computing ;) 
MicroController Ham User Group


More information about the McHUG mailing list