3

Actually I am facing a big problem while programming my atmega328p using an arduino uno as ISP. I followed a video on youtube "Arduino as ISP" by Notes and Volts. Which look doing the same steps that the majority followed. For the blinking LED sketch the µC worked very well and it did not show any troubles. So I decided to carry on , and at this point I needed to upload a new program but this i wanted to upload my program using "avrdude" command line because my code was written with MikroC pro for avr, and here is the command line :

"avrdude -p atmega328p -b 19200 -C arduino -P COM7 -U lfuse:w:0xf7:m -U hfuse:w:0xc9:m -U efuse:w:0xff:m -U flash:w:LED.hex:i "

But unfortunately it did not work well and I have got the following error :

avrdude : invalid byte value <ff> specified for immediate mode avrdude : write to file 'ff' failed avrdude : safemode : Fuses OK

Seeing that error paniced me , that's why I decided to retry the programmation with an arduino sketch and then happened the big issue when the arduino generate an error message about finding a bad microcontroller [error about the device signature] [PIC]2. My last try to find out if I ruined my µC is with switching the µCs; the arduino original and the one that I had to program and unfortunately It was not a good result : "avrdude : stk500_recv() : programmer is not responding avrdude : stk500_getsync() attempt 1 of 10 : not in sync : resp=0x85" PIC Looking for more than day on the internet and I could not find a valid solution , except the possibility that I really BURNT my µC and I have to buy another one. And this is specifically why I am asking for your help; I need to know if SO could figure this trouble out.Otherwise, could somebode confirm to me that there is no hope with my µC and it's gone and I have to stop trying to make it works . Thank you Regards

8
  • Without looking into the exact fuses that you set, there are a few that can cause the chip to not take new programming: If you set it to use an external clock crystal, you then need to have that external clock crystal connected to the chip in order to reprogram it. Or if you set the RESET pin as an output, you need a high voltage programmer to reprogram it. Oh, by the way, have you tried to "write bootloader" in the Arduino UI? If you have overwritten the bootloader it probably won't let you reprogram the chip until you've uploaded the bootloader again.
    – Dampmaskin
    May 12, 2017 at 15:07
  • I did connect an external clock crystal of 16Mhz with its two 22pF capacitors. what do you mean by high voltage programmer I have already burnt the bootloader but in all casses using the µC (that should be programmed) on the ardiono board does not allow me to upload any sketch even for burning the bootloader
    – BOuissal
    May 12, 2017 at 15:10
  • Swapping the ICs would seem to mean you'd be trying to use the misprogrammed target chip as an ISP programmer; that of course won't work. May 12, 2017 at 17:14
  • @ChrisStratton no I did not try to use the misprogrammed target as an ISP programmer, I tried only to upload a simple blink sketch to it to discover if it still working or not
    – BOuissal
    May 12, 2017 at 20:00
  • You can't use a misprogrammed IC in an Arduino as it won't have a valid bootloader (on the ATmega series, ISP can only erase the whole chip, so any attempt to ISP that does not install a working one means there will be no bootloader) May 12, 2017 at 20:02

3 Answers 3

2

Trying your fuse settings on an AVR fuse calculator shows that you have selected an “external full-swing crystal” as the clock source. Now your ATmega won't work unless you connect it to an external crystal. Or you could try just sending a square wave into the XTAL1 pin. Then you can try to reprogram it.

1
  • it's already connected to an external crystal. And when I tried to reprogram it, the arduino software generate an error about selecting a bad µC
    – BOuissal
    May 12, 2017 at 19:50
2

after two days of searching on internet, I decided to just reburn the bootloader again on my target µC to discover if it's really burned or not. SO, I guess it was not damaged because I was able to burn the bootloader and upload the blink led sketch successfully.

1
  • 1
    The first part of this could be an answer of the "the problem must have been elsewhere" sort; but the second part where you ask a question is not allowed in an answer, and must be removed. May 15, 2017 at 17:33
1

What if I have burnt my atmega328p?

get a new one.

Otherwise, could somebode confirm to me that there is no hope with my µC and it's gone and I have to stop trying to make it works .

based on the information you have provided, no one can tell definitively. you could have changed the fuse settings, or your 2nd chip didn't have the bootloader, or bad connection, ....

a better approach is to get a separate programmer - usbasp for low prices, or dragon (older debugger with hv programming capability) and go from there.

1
  • 1
    Actually, I am using the arduino as an ISP programmer because it was decreed by the company I am working for that's why the possibility of using a separate programmer is not allowed .
    – BOuissal
    May 12, 2017 at 19:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.