Cannot program microcontroller anymore

When I try to reprogram or erase the microcontroller using avrdude, I get the following error:

avrdude: Initialization failed, rc=-1
Double check connections and try again, or use -F to override this check.

When I use -F I get the following error:

avrdude: Device signature = 0x??? (changes everytime)
avrdude: Expected signature for ATMEGA168 is 1E 94 06

Sometimes it says:

avrdude: safemode: Verify error - unable to read lfuse properly. Programmer may not be reliable.

If I press the reset button several times and try again, it says:

avrdude: safemode: Fuses OK.

The error occured after I tried to read a PWM signal from the PB3 pin to PB0. I used a jumper cable to connect PB3 (located on the programmer header) to PB0 (located on the LCD header). May be, I have accidently connected PB3 to VCC or Ground. When I connected the two pins, the motors, which were running, stopped immediately.

Thanks.
Tobias

Hello Tobias.

It would help us if you specified the product you’re having problems with. I don’t understand what you were trying to do. Were you ever able to successfully program the device (it would help to know if the product was defective from the beginning or if we’re trying to figure out how it got damaged)?

- Ben

I am sorry. I forgot to mention. I am using the Orangutan LV-168 robot controller and the Orangutan USB programmer. At the beginning the controller worked. I was able to program it 4 or 5 times until it stopped working.

Thanks,
Tobias

If PB3 was set up as an output and you shorted it to something else, you might have damaged the pin, which would prevent you from ever talking to it again. Does your old program still run besides the motor portion? Do you think the whole chip is dead or just that pin?

- Ben

PB3 was set up as output. My old program does not run. It was supposed to run the motor on M1. The power LED is on, but that motor is not running. I am not sure whether this is happening due to chip being dead or just the pin or due to some burnt fuse.
How can I make sure whether only the pin is dead or the whole chip?

Tobias

Out of curiosity, why were you trying to connect pin PB3 to PB0?

Since you can no longer program the device, the only way would be to look for evidence that your old program is running. If it uses any of the I/O pins as outputs(besides PB3), you could try using a multimeter or oscilloscope to see if their outputs are changing.

Something else I would recommend is your trying to program your LV-168 with a different AVR ISP software program, such as AVR Studio. Also, if you’re not using the most recent version of avrdude, see if upgrading makes any difference. Lastly, please take a look at the troubleshooting section of the Orangutan USB programmer user’s guide and see if any of the suggestions help.

If none of this works, please contact us for information about how to return your Orangutan so we can fix it.

- Ben

I was trying to transmit a PWM signal from PB3 and trying to read the same signal into PB0. My old program is not running. I have tried different software and different operating systems, but it does not work. I would like to return the oranguton, so that it could be repaired.

Thanks
Tobias

Please call or email Pololu tomorrow (Monday) and we will provide you with a RMA number and instructions for returning your Orangutan. I’m not sure if this would have served your purpose, but for future reference, you can read the PWM signal on PB3 by looking at the PB3 bit of PINB (even with PB3 set as an output). In general, we advise against using the ISP I/O lines for anything other than the hardware to which they are dedicated.

- Ben

Hey Ben,

First of all, thanks for repairing my board free of cost last time.

However, I am facing the same problem again. And this time I was not even playing with the ISP Pins. I was reading PWM signals from a Gyroscope into ICP1 (PB0). Everything was working fine. I modified my program a little, and when I tried to write that program into the device, I got the “Programming Failed” error.

I have seen this “Programming Failed” error earlier too on a couple of occasions, but changing the ISP clock speed removed the problem. So, this time again I tried changing the ISP clock speed, but I could not. And since then I am not able to even erase the Chip.

The board is not behaving as it should (according to the last program that was written into it). I tried programming it from Linux, and this the error that I am getting:

root@www:/home/gill# avrdude -p m168 -c avrispv2 -P /dev/ttyUSB1 -u -F

avrdude: stk500v2_command(): command failed
avrdude: initialization failed, rc=-1
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.04s

avrdude: Device signature = 0x1f00fe
avrdude: Expected signature for ATMEGA168 is 1E 94 06
avrdude: current erase-rewrite cycle count is -16776961 (if being tracked)

avrdude done. Thank you.

This is exactly the same that I got the last time.

I do not want to trouble you again by sending the board back, so please tell me how you repaired it last time?

Thanks
Tobias.

Hi, Tobias.

I’m very sorry to hear you are continuing to have problems with your board. The following statement troubles me:

Can you elaborate a bit on this? This indicates to me that somehow the mega168’s clock fuse bits were being changed. Do you know if this is the case? When you changed the ISP frequency, did you look at the fuse bits or did you just continue to program using the new ISP frequency? One thing I need to know: have you ever tried to program your Orangutan while its power was off?

At the moment, it sounds to me like there is some sort of systematic problem with your programming setup that can randomly changing your fuse settings. Most of the time this won’t have any kind of catastrophic effect, but if you get unlucky enough to have the wrong fuse bit flipped, the entire board can become unresponsive. I think we need to try to figure out what caused this problem so that it doesn’t happen again.

Last time we fixed your board by desoldering the mega168 and replacing it with a new one. It can be somewhat tricky work given the small MCU package; is this something you’d feel comfortable doing on your own?

- Ben

Hey Ben,

I was not playing with any fuses, I was just writing my programs, programming the board and testing the outputs. I did not touch any fuse settings. Just a couple of times, it would say, “Programming Failed”, and I would change the frequency and continue programming.

No, I did not look at fuse bits, I just continued programming.

Yes, I may have accidentally tried that, but after getting the error I wud have usually turned on the power. But when my board became un-responsive, this was not the case. It was turned on when I tried to program it.

So, I guess I may want to replace the MCU on my own. I will just give it a try and hope that solves my problem. I know someone in my university who is expert at that and will do it for me.

Thanks for your reply.
Tobias