Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

Troubles with ATmega168
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Troubles with ATmega168

by seanfrisbey on Mon May 17, 2010 3:34 pm

I am working on my senior project, and we are using the ATmega168 MCU. I have had no problems with programming it for the past month or two, but just two weeks ago, I was in the middle of programming the file to the MCU, and it stopped and told me that the fuse bits were set to 0xFF, but before that they were set to something else, and asked if I wanted to switch them back. I said sure, and it failed. Then it said a different set of fuse bits, failed on that too. After that, I was unable to program the MCU. It had become what I think is a brick.

So, luckily I have 8 of these babies! I'll just move to another one. Not. The same thing happened. I tried to program it and the fuse bits got all screwed up. So, I went online and did some research and came up with the verbose mode. so, I did ultimate verbose and the force command, and avrdude told me that the device signature was 0x000000, and should be 0x1E 94 06. Ok, so something went wrong and the signature got all messed up. Same thing with the other two. So, I tried one more, and it ruined as well.

I unhooked everything and hooked it all back up to make sure it wasn't a wiring issue. I double- and triple-checked it, and it was fine. I tried again, and it was no good. Now, I am down 4 MCUs, and I still don't know what the problem is. It may be the programmer! At this time, it is the one from Adafruit, version 2. I replaced it with the Pocket AVR Programmer from Sparkfun. I got it two days ago. Today, I tried with with a few more MCU's and I'm still getting the same issues. I have tried new MCU's on a laptop and desktop, with new installs of avrdude in between. I don't have the slightest idea what could be wrong. I only have a few more weeks to get this moving.

Any help with this would be wonderful. I have performed a few troubleshooting routines, but I can't remmeber any of them. If you have any ideas, just let me know and I will tell you what I got from them, or if I haven't done it yet, I will do so. I have 1 MCU left out of 8! I hope I can get it working...

Thank you so much,
Sean
seanfrisbey
 
Posts: 3
Joined: Mon May 17, 2010 3:24 pm

Re: Troubles with ATmega168

by madworm_de on Mon May 17, 2010 3:49 pm

The last time I had such a problem, it turned out that I was programming the fuses for external clock source and didn't know I was doing that. Of course no external clock was there, hence the chip seemed dead and refused to be programmed again. Make sure you don't tread on that path of certain insanity.
NO LARDO CHIPS
madworm_de
 
Posts: 99
Joined: Mon Jun 09, 2008 6:56 am

Re: Troubles with ATmega168

by seanfrisbey on Mon May 17, 2010 5:29 pm

I am not only having trouble programming, I can't do anything. I can't write fuses, I can't read fuses, nothing works anymore. Not to mention I do have an external clock source...
seanfrisbey
 
Posts: 3
Joined: Mon May 17, 2010 3:24 pm

Re: Troubles with ATmega168

by wireframewolf on Mon May 17, 2010 7:10 pm

As a noob to programming chips myself, I know what this sort of madness feels like.

I don't know what the problem is, but maybe you can ease your mind a little bit.

Do you own an arduino? If you do, plug one of your chips in there and try burning the bootloader via Arduino's IDE. As long as the chip and the programmer are okay, it should successfully burn the bootloader, and then you can narrow your likely problems down to makefile configuration, hardware, or maybe even a weird error with whatever AVR burning program you use. I use AVR-Dude myself.

This won't really solve your problem, but getting something burned onto the chip might make you feel a little less crazy, and that is a good first step.
wireframewolf
 
Posts: 21
Joined: Wed Mar 05, 2008 10:04 pm

Re: Troubles with ATmega168

by chatham on Mon May 17, 2010 11:03 pm

Sounds like it could be a speed issue. If you can, change the speed of your programmer - if you're trying to talk to your chip with ISP programming, and your programmer is running over 1/4 of the ATmega's clock speed, it will mess up. The big clue here is the fact that you're reading all zeroes for the signature bits - this means that you're not able to talk to the chip at all. If you're using virgin chips, you shouldn't have a problem with the fuses being set incorrectly. However, they will be running at 1MHz by default, so if you're trying to program them at 250KHz, you're running on the edge of that 1/4 speed, and so it might be too fast.

I don't have any experience on how to set the programmer speed in AVRDUDE, but it looks like you use the -B flag. Try setting it to 57.6kHz, or 4kHz (-B 57600 or -B 4000). That may help.

In my experience, ATmegas are pretty hardy - unless you're wiring the power pins backwards (easy to do, but you've checked that), so I wouldn't think that it's a problem with your chips that's causing the chips themselves to give back a 0x0000 signature. Even if they weren't messed up, I wouldn't expect them to screw up to zero. With that known, I'd advise avoiding the -F flag to skip the signature check - I don't know, but if you're not communicating with your chips properly to begin with, you might be really messing up your fuses when you try to program them, and potentially really bricking your chips (There's a fuse that disables ISP programming on the ATmega168 - ouch!).

Hope it helps!
OpenChord.org - Open Source kits to let you play Guitar Hero with a real guitar, or build your own Wii/PS3/USB controllers.

chatham
 
Posts: 144
Joined: Thu Feb 04, 2010 2:30 am

Re: Troubles with ATmega168

by seanfrisbey on Wed May 19, 2010 1:59 am

Well, I found out what it was. Somehow, I had programmed the fuse bits to use an "external clock" versus an "full swing crystal oscillator", which is what I am using. I don't remember how I realized that I had done that, but I hooked up a clock signal from a frequency generator at school to act as the clock, and voila! Everything worked. I changed the fuse bits back to being a full swing crystal oscillator, and it worked just fine!

Moral of the Story: Make sure you know what your clock source is, and that you program the fuse bits accordingly.
seanfrisbey
 
Posts: 3
Joined: Mon May 17, 2010 3:24 pm

Re: Troubles with ATmega168

by stinkbutt on Fri Jun 18, 2010 3:32 pm

Why is it every single time someone discovers they've bricked their chips it turns out to have something to do with the fuses?

STOOPIDFUSES
Red M&M, Blue M&M: They all wind up the same color

stinkbutt
 
Posts: 593
Joined: Wed Feb 17, 2010 2:40 am

Please be positive and constructive with your questions and comments.