Hello, so recently i got my first arduino, and i got a leonardo.
I was just playing around with an oled that i got with it figuring out how to make a pc temperature monitor. It worked fine, i changed and uploaded the program a few times, but last time i did it, while uploading, my arduino disconnected and got an upload error. I unplugged it and plugged it back in and now in device manager it is seen as:
Unknown USB Device (Device Descriptor Request Failed)
Description:
Windows has stopped this device because it has reported problems. (Code 43)
A request for the USB device descriptor failed.
And ever since that its not detected in arduino IDE.
Ive tried installing the driver from the arduino folder but it says that it already has the best driver, google'd a bunch and from what i could gather, the bootloader probably got screwed up somehow. I also saw that it was possible to fix that if you had some programmer... or another arduino, but i only saw how to upload a bootloader on arduinos other than a leonardo, i tried googling and looking up here, but i couldnt figure it out. I ordered a nano a while ago, hoping it will arrive soon, and i was wondering if i can use the nano as a programmer for the leonardo to attempt to upload a bootloader. I was wondering if it is possible, how to do it, as i couldnt really find any tutorials on doing it TO a leonardo, only how to program other arduinos WITH a leonardo.
Also, if you think something else might fix it so i dont need to wait for my nano to arrive that would be also great! I ordered a programmer PL2303 from aliexpress just in case i cant do it with a nano, so i can hopefully do it with that.
You can (sort of) break boards with native USB. Part of the uploaded code contains code to provide the USB connectivity; if your code manages to overwrite some variables used by that specific USB code, you break the board.
Open Windows device manager while your board is connected. Next press and release the reset button on the Leonardo. You should get an Arduino Leonardo Bootloader (Comx). If that is the case, you can continue with below.
In the IDE
1)
File -> Preferences , enable Show verbose ouitput during upload
2)
Load an innocent sketch (e.g. blink).
3)
Upload the sketch; you will see something like below when the actual upload starts
Sketch uses 3618 bytes (12%) of program storage space. Maximum is 28672 bytes.
Global variables use 149 bytes (5%) of dynamic memory, leaving 2411 bytes for local variables. Maximum is 2560 bytes.
Forcing reset using 1200bps open/close on port COM9
PORTS {COM1, COM9, } / {COM1, } => {}
PORTS {COM1, } / {COM1, COM7, } => {COM7, }
Found upload port: COM7
When you see the lines starting with PORTS, press and release the reset of the Leonardo; you have about 8 seconds to do so.
I tried what you mentioned, but when i press the reset button all that happens is it "disconnects" (i can hear windows device disconnecting sound) and it disappears from the Universal Serial Bus Controllers section, nothing new appears neither there nor in Ports (COM & LTP), and doesnt appear in IDE's ports section.
Then after a few seconds it reappears as an unknown usb device
Edit:
Forgot to mention, i did the steps you said, but all i got was
PORTS {COM1, COM5, } / {COM1, } => {} a few times and then it went with com1, which is not leonardo, its some other device, then proceeded to give me programmer errors
vladantd:
I also saw that it was possible to fix that if you had some programmer... or another arduino, but i only saw how to upload a bootloader on arduinos other than a leonardo, i tried googling and looking up here, but i couldnt figure it out. I ordered a nano a while ago, hoping it will arrive soon, and i was wondering if i can use the nano as a programmer for the leonardo to attempt to upload a bootloader. I was wondering if it is possible, how to do it, as i couldnt really find any tutorials on doing it TO a leonardo, only how to program other arduinos WITH a leonardo.
You can certainly do this. It's the same process shown in the tutorial:
The only difference is that the SPI pins are not broken out to pins 11-13 on the Leonardo. So you need to make the connections between the Nano you're using as a programmer and the ICSP header on the Leonardo. The tutorial at the link above shows the pinout of the ICSP header.
Please let us know if you have any problems when doing that. We can definitely help you out with the Burn Bootloader procedure if you get stuck.
vladantd:
I ordered a programmer PL2303 from aliexpress just in case i cant do it with a nano, so i can hopefully do it with that.
I don't think it will be possible to use the PL2303 as an ISP programmer, or if it is it will be very complicated to do. If you want a dedicated ISP programmer, I recommend the 6 pin USBasp, which you can probably buy from Aliexpress. I strongly recommend eBay instead of Aliexpress because, even though the prices are slightly more expensive on eBay, I find that the things I buy on eBay actually get delivered (while often the things I buy on Aliexpress never arrive) and the customer service is much better.
But the USB to serial adapters like your PL2303 are very useful tools for other purposes, so I don't think you'll regret the purchase.
vladantd:
if you think something else might fix it so i dont need to wait for my nano to arrive that would be also great!
Until then, you might check that your USB cable is fully inserted into the computer and Leonardo. If that doesn't help, try another USB cable in case the problem might be caused by a bad connection in the cable.
I'm learning to program by uploading any old code anyone posts on the forum and attempting to fix it, as a result I brick my Leonardo on a regular basis. This is how I recover it:
load an example sketch into the IDE.
press and hold the reset button on the Leonardo.
click upload.
release the button as soon as you see the text in the botton left corner of the IDE change from " compiling sketch " to " uploading "
pert:
The only difference is that the SPI pins are not broken out to pins 11-13 on the Leonardo. So you need to make the connections between the Nano you're using as a programmer and the ICSP header on the Leonardo. The tutorial at the link above shows the pinout of the ICSP header.
would this be the correct way to wire it to use the nano to upload a bootloader onto the leonardo?
pert:
Until then, you might check that your USB cable is fully inserted into the computer and Leonardo. If that doesn't help, try another USB cable in case the problem might be caused by a bad connection in the cable.
I tried it with 3 different cables, and 2 pc's so im sure its not that
B-D-N:
I'm learning to program by uploading any old code anyone posts on the forum and attempting to fix it, as a result I brick my Leonardo on a regular basis. This is how I recover it:
load an example sketch into the IDE.
press and hold the reset button on the Leonardo.
click upload.
release the button as soon as you see the text in the botton left corner of the IDE change from " compiling sketch " to " uploading "
Good luck.
i tried that a few times, sterretje also suggested that, but it didnt work, says selected serial port does not exist or your board is not connected
vladantd:
would this be the correct way to wire it to use the nano to upload a bootloader onto the leonardo?
That's correct. But since you're using the Nano Every, you should use the latest development version of the "ArduinoISP" sketch instead of the one in the Arduino IDE's File > Examples menu. The reason is because there was one or two fixes to the sketch since the last release of the Arduino IDE that are necessary to make it work on the Nano Every. You can get the latest development version of the sketch here: https://raw.githubusercontent.com/arduino/arduino-examples/main/examples/11.ArduinoISP/ArduinoISP/ArduinoISP.ino
pert:
That's correct. But since you're using the Nano Every, you should use the latest development version of the "ArduinoISP" sketch
Oh, im not using Nano Every, my bad, i didnt know that was a different version, thats just a google image i found, i will be using a normal Arduino Nano! But that is good to know in case it turns out to be a nano every!
My nano should arrive in a few days, and i will reply whether or not i managed to solve the issue, thanks for all the help so far!
With the classic Nano, you can use the standard version of the ArduinoISP sketch you find in the Arduino IDE at File > Examples > 11.ArduinoISP > ArduinoISP. The fixes to that sketch made since the IDE release only apply to boards of other architectures.
The connections shown in your image will still work perfectly with the classic Nano.
Oh, thats good, do i need to connect any other pins on the nano? i saw people connecting some pins with capacitors, do i need to do any of that or just connect directly with wires like in the pic?
Occasionally, people find it necessary to put a 10 uF capacitor between the reset and ground pins of the programmer board (the Nano in your case). If you have your Arduino AVR Boards updated in the Arduino IDE's Tools > Board > Boards Manager, I don't think you'll find this is necessary, but it certainly doesn't hurt to have some 10 uF capacitors on hand, since they are generally useful parts.