 |
By: willy (offline) on Thursday, March 25 2010 @ 06:22 PM PDT (Read 5031 times)
|
|
|
willy |
| willy |
|
First off, just wanted to say thanks for compiling the information on the page Resources for getting started with AVRs - at http://www.evilmadscientist.com/article.php/avrstuff. This is just what I had been looking for! I've completed a Peggy, Meggy Jr, and an interactive LED board and now am playing around with the atmegaxx8 target boards.
Over the course of creating these, I've noticed that I have few chips (atmega168s) that I can't program directly from the target board (or 6pin ISP on Peggy). I've just ignored this in the past becuase I have been able to program them just fine in the Arduino envvironment but now its beginning to bug me. I'd really like to find a way to program the board without having to remove the chip, and plug it into an arduino main board.
Lately, I have just been testing to see if I can get a connection with the board:
avrdude -c usbtiny -p atmega168 -P usb
on a bad chip, I get the response:
avrdude: initialization failed, rc=-1
If I add the -F option, it says
Yikes! Invalid device signature.
I saw on the avr resource page, instructions on how to enter terminal mode, slow the clock and erase the contents of the chip, but that didn't work for me.
Any suggestions on what I might be doing wrong would be greatly appreciated!
|

Apprentice
Status: offline
Registered: 04/22/09 Posts: 12
|
|
|
|
|
 |
By: Windell (offline) on Friday, March 26 2010 @ 12:00 AM PDT
|
|
|
Windell |
| Windell |
|
Hi Willy,
It sounds like you are working with chips that have different clock configurations set.
The clock source for an AVR microcontroller is set in the fuse bytes. The chips that are programmed for use with the Arduino IDE are also set with their clock configuration to expect an external 16 MHz oscillator crystal. Once a chip has its fuse bytes set to expect a crystal, it will not work without it.
So, the chips that come in the Peggy 2 and Meggy Jr will not operate--even to be programmed -- unless they have the oscillator crystal present. If you'd like to work with the chips on the target board, you have two choices: Add a crystal (and it's two support caps) to the target board, or reprogram the chips-- while on a board with the crystal -- to run off of the internal oscillator.
Windell H. Oskay
drwho(at)evilmadscientist.com
http://www.evilmadscientist.com/
|

Evil Scientist
 Status: offline
Registered: 06/15/06 Posts: 1932
Sunnyvale, CA
|
|
|
|
|
 |
By: willy (offline) on Friday, March 26 2010 @ 09:55 PM PDT
|
|
|
willy |
| willy |
|
Thanks - that was a BIG help. I managed to find a 16Mhz crystal laying around and connected it to the target board without soldering it (and no caps - not ideal, I know - but a quick fix). I ran my test and it was able to read the board!!!
avrdude -c usbtiny -p atmega168 -P usb
Next I entered the following command with fuse settings that I copied from another working chip -
avrdude -U lfuse:w:0x62:m -U hfuse:w:0xdf:m -U efuse:w:0x01:m -c usbtiny -p atmega168 -P usb
and voila! Once i removed the crystal it was working again. I've learned that it is not a good idea to try and burn the bootloader on the arduino main board without the usb cable attached. That seem to reprogram the fuse settings that caused this in the first place.
Next I need to see if I can reprogram the fuse settings on a chip that is already soldered into a board (I have a Simon from sparkfun that I think I messed up the same way). that won't be so easy because its a surface mount chip.
Thanks again!
|

Apprentice
Status: offline
Registered: 04/22/09 Posts: 12
|
|
|
|
|
 |
By: Windell (offline) on Friday, March 26 2010 @ 10:03 PM PDT
|
|
|
Windell |
| Windell |
|
 I've learned that it is not a good idea to try and burn the bootloader on the arduino main board without the usb cable attached. That seem to reprogram the fuse settings that caused this in the first place.
If you burn the normal Arduino bootloader, that will-- as part of the process --burn the fuses as well. There is a variation of the bootloader (one of the Lilypad versions) that will set the chip to run at 8 MHz, off of its internal oscillator. You might try that one.
Windell H. Oskay
drwho(at)evilmadscientist.com
http://www.evilmadscientist.com/
|

Evil Scientist
 Status: offline
Registered: 06/15/06 Posts: 1932
Sunnyvale, CA
|
|
|
|
|
 |
By: willy (offline) on Friday, March 26 2010 @ 10:38 PM PDT
|
|
|
willy |
| willy |
|
Update:
Reprogrammed the fuses on the simon chip as well - I can't believe it worked - just held the leads of the crystal against the tosc1 and tosc2 pins temporarily while I pressed enter on the keyboard - no easy feat. There is so much to learn here! Will check out the other bootloader - thanks for the tip!
|

Apprentice
Status: offline
Registered: 04/22/09 Posts: 12
|
|
|
|
|