Error while burning bootloader

I changed the firmware on my 3d printer soon after I purchased it and now want to update it but it seems when I flashed it I deleted the bootloader.
While trying to burn a new bootloader to my atmega2560 using a USBASP, I was getting "Cannot set sck period" errors so I installed a slow clock jumper and now, while I'm still getting this error, I'm also getting an " Error while burning bootloader : Failed chip erase : uploading error : exit status 1" message. I checked and re-installed the libusb-win32 firmware on the USBASP after getting the original error and checked the continuity of the pin connections from the USBASP to the board.
Any advice on where I go from here would be great, thanks.

Hi @sneem26. I also experienced this "avrdude: error: program enable: target doesn't answer. 0, avrdude: initialization failed, rc=-1" error when using the USBasp programmer.

For me, the solution was to change to using libusbK driver instead of libusb-win32:

  1. Download the "Zadig" driver installation tool from this website:
    http://zadig.akeo.ie/
    Zadig is recommended on the official USBasp website: http://www.fischl.de/usbasp/
  2. Plug your USBasp into your computer.
  3. Start "Zadig".
  4. From the dropdown menu in the "Zadig" window, select "USBasp".
    :exclamation: If it doesn't show up on the menu, then select Options > List all devices from the Zadig menus and check again.
  5. Click the up or down arrows next to the Driver selection box on the right side until you see "libusbK".
  6. Click the Replace Driver button.
  7. Wait for the driver replacement process to finish.
  8. Close the "Zadig" window.

Now try using the USBasp programmer once more. Hopefully the error will no longer occur.

Thankyou for the reply.
I just replaced the driver with libusbk and had the same error.
I even tried WinUSB and got a "Could not connect to usb" error.
Also, as this is my first experience using a USBASP, can you confirm having only the red LED 3 lit and the power jumper set to 5V are correct ???


.

I'm sorry to hear that. Are you certain it is the exact same error:

avrdude: error: program enable: target doesn't answer. 0, avrdude: initialization failed, rc=-1

I ask because there is a very similar error message that is more common and has completely different causes:

avrdude: error: program enable: target doesn't answer. 1, avrdude: initialization failed, rc=-1

Note the difference is the first has the number 0, while the second has the number 1

I can't confirm or deny. I only see LED1 and LED2 on the official USBasp schematic and I don't know what even those are for. The USBasp programmers I own have a different design from yours. On both of them, a single LED is lit when I plug it in. On one of the boards it is labeled "G", which I guess maybe stands for "green" even though the LED is actually red. The LEDs are unlabeled on the other USBasp I have.

Thanks again for the replies.
Below are the screenshots of the installed driver and the error.
It does say target doesn't answer. 1


Do you think I'd have more success using a nano or uno instead of the usbasp or do you think the problem is more likely to be with the board or chip ???
How do I use -F to override the check ???

Make sure the programmer’s cable is correctly connected to the target board. This "target doesn't answer. 1" error can occur if you have the cable plugged into the board the wrong way around.

Pin 1 on the cable is indicated by a small triangle embossed on the plastic. Pin 1 on the Arduino board’s ICSP header is typically indicated by a white dot on the PCB’s silkscreen.

My cable has a red wire indicating pin 1.
I'm using a 10-6 pin adapter on the end of the cable and it has all the pins marked.
I've checked them with a continuity meter against the pins on the programmer which are also marked and they are all correct.
The atmega2560 target board has a G marked on the pcb next to the icsp header indicating the ground pin.
I have checked this against the pin out diagram for the board and all the pins on the board match the pins on the adapter.
In the tutorials I watched, the target board is removed and sitting next to the programmer, which I assume is just to make the demonstration easier to see ???
My board is still fully attached to the printer which I am leaving turned off while trying to burn the bootloader.
When I connect the programmer with the printer off, 2 blue leds light up and one of them next to the icsp flashes slowly, which I'm assuming indicates the controller is powering the board.
Does the programmer supply the power to the target board while burning the bootloader or is it necessary to turn the printer on or otherwise supply power to it ???
Also, I was speaking to the local electronics store where I got the controller and they said that although they have not had any returns or complaints about their controllers, he personally thinks using an uno is a more reliable method.

Can you measure the voltage to make sure something in the printer is not getting powered through the mega and drawing too much current?

Is anything in the printer using the SPI bus pins?

Just to verify, you are using the ISP header for the atmega2560 and not the header for the 16U2?

Thinking the programmer might not be able to supply enough power to the target board, I tried to burn the bootloader with the printer on and the 5v jumper removed from the programmer and with the libusb-win32 driver I got the same errors with the target doesn't answer. 0 which appeared instantly but when I installed the libusbk driver, the progress bar ran for around 15 seconds before I got a different error.
While the sck error is still present, there is no target doesn't answer, instead there is a verification error, content mismatch.

Thanks for the reply, David.
I was wondering about the programmer being able to supply enough current to the board while it is still connected to the printer.
If the SPI bus pins you mean are shown as EXP2 in the photo, then no, they are not being used.
I'm using the ICSP header with the pin diagram shown on the top left of the photo.

Sorry, though you were actually talking about a Mega, you have a different board that uses an atmega2560.

I think it is progress of sorts. What happens if you try the "Burn Bootloader" operation a few more times? Do you continue to get the verification error every time, or does it eventually succeed?

BINGO !!!
After three more attempts it was successful.
Thanks again for all your help ..... I REALLY appreciate it.

You are welcome. I'm glad you were finally successful.

Regards,
Per

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.