ATMEGA8 with USBASP Win10 Issues

Go To Last Post
6 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Sup Dudes,

 

I searched on the site for days and didn't find a solution for my specific problem so I'm finally posting the question, I hope it's in the right forum.

 

I'm getting the normal errors:

-cannot set SCK period, check for firmware update

-program enable, target doesn't answer. 1

-initialization failed, rc=1

-blah blah -F to override

 

So initially I thought it was the USBASP but I was able to flash the most recent (2011) firmware on all 3 USBASPs I own using one another to do it, so I know they all can program.

 

I have single, double, triple etc check my connections with a multimeter to MOSI, MISO, RST, SCK, VCC and GND. Also verified that I'm getting 5.0v on VCC pin with either USBASP provided and tried with external(via regulator) as well. Even tried adding the 10kohm on reset to pull it up and added a 0.1uf between VCC and GND.

 

-----------------------------------------------------------

 

What else would be causing the chip to not respond? I've been trying to program these ATMEGA8A-PU chips for a while and not sure why it isn't working.

 

My friend who originally used to program these for me isn't available to do them anymore so he made me a .bat file to use to program the chips.

 

Contents of .bat file:

 

@echo off
:START
avrdude -c usbasp -p m8 -U lfuse:w:0xD4:m -U hfuse:w:0xD9:m -U flash:w:shift.hex
pause
REM programming the lock fuse
avrdude -c usbasp -p m8 -U lock:w:0xFC:m
set /P c=Program another chip[Y/N]?
if /I "%c%" EQU "Y" goto :START
if /I "%c%" EQU "N" exit

So the steps I do are plug in the USBASP, put the chip in the ZIF, double click on the .bat, no matter what I do, no difference. I tried changing the clock speed with a -B64 to bring it down to 8hz to no avail.

 

I'm losing hope as I've been trying to do this for a year now off and on.

 

Any help is greatly appreciated. crying
 

Last Edited: Sun. Feb 21, 2021 - 11:06 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Welcome!

BrodyBruceLee wrote:
-program enable, target doesn't answer. 1

...

Also verified that I'm getting 5.0v on VCC pin with either ...

Stays at 5V?

reasons : brownout, VCC is unstable

A zener diode is ultra-reliable, a shunt regulator is stable simply by correct capacitance and enough current, most regulators are conditionally stable, a cell or battery is stable.

BrodyBruceLee wrote:
What else would be causing the chip to not respond? I've been trying to program these ATMEGA8A-PU chips ...
Power, clock, and ISP data will be enough.

BrodyBruceLee wrote:
I'm losing hope as I've been trying to do this for a year now off and on.
Hope springs eternal ... consider other AVR ISP though will be a few times to an order of magnitude more expensive than a USBasp.

 


ATmega8A - 8-bit Microcontrollers

 

Serial Programming Pin Mapping | ATmega8A Data Sheet

AVR® Microcontroller Hardware Design Considerations

 

Pololu - 5.10. Using the clock output to revive AVRs

 

edit :

[TUT][SOFT] Recovering from a "locked out" AVR | AVR Freaks

"Dare to be naïve." - Buckminster Fuller

Last Edited: Mon. Feb 22, 2021 - 01:07 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

BrodyBruceLee wrote:
I've been trying to program these ATMEGA8A-PU chips for a while and not sure why it isn't working.
New or used? If used could someone have previously programmed their RTDISBL fuses ?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

BrodyBruceLee wrote:

So initially I thought it was the USBASP but I was able to flash the most recent (2011) firmware on all 3 USBASPs I own using one another to do it, so I know they all can program.

This is a pretty good hint that you don't read advice.

 

And your "friend" was not very nice.

avrdude -c usbasp -p m8 -U lfuse:w:0xD4:m -U hfuse:w:0xD9:m -U flash:w:shift.hex

This sets the Fuses for an External 32kHz Watch Crystal.   

 

Connect a Watch Crystal between XTAL1 and XTAL2.   Restore the fuses to the Factory default

avrdude -c usbasp -p m8 -U lfuse:w:0x62:m -U hfuse:w:0xD9:m -B 200

Remove the Watch Crystal.   Your ATmega8 board should program again i.e. via the Internal 1MHz RC

 

Incidentally Chinese USBASP come with good firmware.   There is no need to replace it.

However your "friend" has made your AVR unprogrammable by the automatic SCK detection.    Automatic SCK does not expect 32kHz clock.

 

So the 2011 firmware is needed to recover from a SLOW clock.   It is unfortunate that you have replaced the Chinese firmware on three USBASPs.   You only need 2011 firmware on one USBASP.

 

If you don't have a Watch Crystal you can "try" with an external Clock to XTAL1 pin.   But in my experience it will not work.

 

What country are you in ?    A neighbour might mail you a free Watch Crystal.

 

David.

Last Edited: Mon. Feb 22, 2021 - 11:04 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hey Guys, 

 

Thanks a bunch for the responses, my back gave out during the week so I had to rest it. 

 

Power: I've tried using the USBasp's VCC line as well as a regulated 5v power supply 3A.

 

Chips are brand new.

 

I am in Hawaii (USA). 

 

For the firmware of the USBasp, I made a backup first before flashing with the 2011 version. Should I reflash the original firmware back on it?

 

For the watch crystal, I have a bunch of them as I repair arcade boards. 

 

I connected the watch crystal to XTAL1 & XTAL2 as instructed and ran the new code and got this, not sure if I am still to proceed with removing the watch crystal.

 

avrdude: set SCK frequency to 4000 Hz
avrdude: error: program enable: target doesn't answer. 1
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.


avrdude done.  Thank you.

Press any key to continue . . .

 

I'm pretty sure you guys are irritated with people asking for help with these, I don't mean to irritate anyone, I help in my community as much as I can within my field of expertise and when I don't understand new things to me, I seek help within that community. I truly appreciate the help guys. I don't know anything about coding these things, so please forgive me if you think you have to hold my hand here.

 

As far as the original code goes, if I reflash the original firmware,  what needs to change in the .bat file (Fuses with the default values?)?

 

Thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

BrodyBruceLee wrote:

For the firmware of the USBasp, I made a backup first before flashing with the 2011 version. Should I reflash the original firmware back on it?

The lock bits are normally set on Chinese USBASP boards.   So your backup is likely to be garbage.

 

BrodyBruceLee wrote:
I connected the watch crystal to XTAL1 & XTAL2 as instructed and ran the new code and got this, not sure if I am still to proceed with removing the watch crystal.

I would try again with another crystal.

 

BrodyBruceLee wrote:

As far as the original code goes, if I reflash the original firmware,  what needs to change in the .bat file (Fuses with the default values?)?

Yes,   I would use default fuses i.e. 8MHz RC with CLKDIV8

 

David.