Using Mega to fix Leonardo bootloader

I used a Leonardo board as a keyboard, and I can't flash it anymore.
I read flashing bootloader again may fix this, and I have Mega2560 so mixing these tutorials:
[1] Arduino Leonardo Bootloader Replacement - iFixit Repair Guide
[2] https://www.instructables.com/How-to-use-Arduino-Mega-2560-as-Arduino-isp/

I flashed ArduinoISP from samples to Mega; and make this wiring:
Mega Leonardo ICSP
50 -> MISO -> 1
51 -> MOSI -> 4
52 -> SCK -> 3
53 -> SS? -> RESET

And the capacitator on MEGA between RESET and 5V
Now I set the board to Leonardo, select programmer "Arduino as ISP"; the board as Leonardo, but when I try to burn bootloader I receive:
avrdude: Yikes! Invalid device signature.
Double check connections and try again, or use -F to override this check

Did I miss the wiring?

Thanks

I just found https://www.arduino.cc/en/Tutorial/BuiltInExamples/ArduinoISP; but there isn't a wiring from mega to leonardo.
Another difference I found is I am using a ceramic capacitor (non polarized? my English skill isn't good in electronics)

You can't flash: do you mean you can't upload new code?
I think this is normal behaviour for Leonardo's in HID mode. The key to success is hitting reset at exact that moment the Arduino IDE wants to start uploading, just after compilation finished.

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