0

I have got the Bootloaded ATMega328P-PU from China and I want to reburn new bootloader into it. For this I use UsbAsp programmer. I want to do it in Arduino IDE. But when I try to flash, for example, an empty flash it says that error:

 Using Port                    : usb
         Using Programmer              : usbasp
         AVR Part                      : ATmega328P
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PC2
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65    20     4    0 no       1024    4      0  3600  3600 0xff 0xff
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
           lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : usbasp
         Description     : USBasp, http://www.fischl.de/usbasp/

avrdude: auto set sck period (because given equals null)
avrdude: warning: cannot set sck period. please check for usbasp firmware update.
avrdude: error: program enable: target doesn't answer. 0 
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.


avrdude done.  Thank you.

But when I work in Avrdudeprog, it works without any problems.
How can I fix it?

  • what's the circuit ? the error is mainly about a bad connection to the chip. – Tirdad Sadri Nejad Aug 31 at 21:38
  • Nop. When I work whith programs as Khazarma, AVRDUDESS andAvrdudeprog v3.3 it works without broblems – E.M. Sep 1 at 5:06
0

use Zadig 2.4 to change the driver for USBasp. USBasp works with 3 drivers but it seems the type of installed driver causes some problems in various software. khazama, progisp on one hand and Arduino on the other hand. despite all of them using avrdude.

libusb-win32 : khazama works, Arduino does not WinUSB : khazama doesn't work, Arduino works libusbK : both work

  • I must select libusbK. OK. I test – E.M. Sep 1 at 5:37
  • Can I ask one question? This chip is fron china and it worked very slow and in internal clock 8 MHZ. I watched video and here said that I must set fuse bits as: – E.M. Sep 1 at 8:30
  • L: 0xFF H: 0xDE E: 0x05 Lock:0x3F as in bootloader. But my chip broke. WHY? I don't know! How can I fix it without fuse doctor? – E.M. Sep 1 at 8:31
  • @E.M. the arduino has to operate from 16MHz. and when you use the 328 for the first time, it has a clock of internal 8MHz divided by 8 = 1MHz. the fuses seem right except for Efuse. the value 0x05 means 256 words for bootloader which is not sufficient. use 0xFD for 2K words – Tirdad Sadri Nejad Sep 1 at 8:59
  • @E.M.engbedded.com/fusecalc – Tirdad Sadri Nejad Sep 1 at 8:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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