0
\$\begingroup\$

My USBasp was working fine. I could burn a program to the ATmega328p. But last night I wanted to change the clockspeed using clock_prescale_set(clock_div_t x).

After that it burned successfully and changed the clock speed, but I could not burn any new program. It shows this error message in AVR Studio:

avrdude.exe: warning: cannot set sck period. please check for usbasp firmware update.

avrdude.exe: error: programm enable: target doesn't answer. 1 

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

What is the problem and how do I solve it?

\$\endgroup\$
1
  • \$\begingroup\$ I tried to program an atmega328 before and after many attempts it worked only when I connected an external oscillator. AVR pocket programmer is better. \$\endgroup\$
    – pantarhei
    Commented Dec 17, 2018 at 16:13

1 Answer 1

1
\$\begingroup\$

Many potential issues:

  1. You have changed the devider to 8 and now your Atmega is clocked 1MHz. You need to slow down your usbasp by the slowSCK jumper. It is possible also by the command line option -B x but unfortunately your usbasp firmware does not support it. You need another usbasp to flash the new software.
  2. You have changed other fuse bits - for example you set the external clock source. Then you need to connect the clock from the other source to the Atmega clock pin.
  3. I you have changed something else (for example the function of the reset pin) your uC is bricked and it can be only unbricked by using the high voltage programmer. You can build your own one (take a look here).
\$\endgroup\$
3
  • \$\begingroup\$ thanks,I think 1st potential isuue is the cause.Btw can i set the clock of atmega by using external oscillator? \$\endgroup\$
    – Zarzisur
    Commented Dec 20, 2017 at 20:46
  • \$\begingroup\$ yes you can. If you plan to use uart you actually need to clock it this way. \$\endgroup\$ Commented Dec 20, 2017 at 20:47
  • \$\begingroup\$ But he has to program new CKSEL fuses to enable external clock which he can't do now. @Zarzisur, if you have another Atmega328p or any Arduino you can use ArduinoISP firmware to make it into another AVR programmer. With this use can either try to flash new fuses to your current Atmega328p or flash your USBasp to fischl.de firmware which does supports setting SCK period. \$\endgroup\$
    – NStorm
    Commented Apr 17, 2019 at 6:53

Your Answer

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

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