Failed uploading after upload USB HID example

Hello everyone, after I followed this tutorial and uploaded the example, I can no longer upload any code to Arduino R4. What should I do?

Is it because the port has been constantly occupied by keyboard behavior?

#include <Keyboard.h>

void setup() {
  Keyboard.begin();
  delay(1000);
}

void loop() {
  Keyboard.press('w');
  delay(100);
  Keyboard.releaseAll();
  delay(1000); 
}

error message

No device found on COM21
Failed uploading: uploading error: exit status 1

Is the person responsible for writing the Arduino documentation within the community? I would appreciate it if you could review and enhance the document.

Yes. Unfortunately I have no help for this disaster. On Uno R3 also the SPI interface can be used for uploading.

1 Like

You can contact Arduino via https://www.arduino.cc/en/contact-us. Just make clear what you expect from the review and which enhancements you're thinking of.

1 Like

Hi @wulu. I'll provide instructions you can follow to upload to your board when it is in this state:

  1. Connect your Arduino board to your computer with the USB cable.
  2. Press and release the button marked "RESET" on your Arduino UNO R4 WiFi board quickly twice.
    You should now see the "L" LED pulsing.
  3. Select the port of the UNO R4 WiFi board from the Tools > Port menu in Arduino IDE.
    :exclamation: The double reset you did in step (1) can cause the port number of the board to change, so don't assume you already have the correct port selected.
  4. Upload the sketch to the board as usual.

This time the upload should be successful.

1 Like

Hi @ptillisch . Thank you for your reply! It works.

May I ask what this step does? From my understanding, is it similar to putting UNO R4 in "burning mode"? Also, where can I find relevant documentation?

And I noticed that you are a member of the Arduino team. I have a suggestion:

I think it should be mentioned in this tutorial from official Arduino documentation how to re-upload code to an Arduino board after use the example in it, in order to help people who may encounter the same issue.

1 Like

I agree that it should be addressed.

Ideally the core or library would be fixed to make it unnecessary to make this workaround. So I would start there. But if it is not possible to fix the code then documenting the technique would be the second best.

I am not responsible for the development and maintenance of this code or the documentation, and am extremely busy with the other things that are my responsibility so it is unlikely I would find time to follow up on this. The best thing would be for you to submit formal bug reports to the issue trackers (or better yet, pull requests (PR)) of the relevant repositories to make sure those who are responsible can track the task:

1 Like

Even though I definitely didn't have the time for it, I ended up following up anyway.

I did a thorough investigation into the problem and found the cause. I submitted a formal bug report here:

I also submitted a proposal for a fix here:

If anyone is interested in manually applying that fix and giving it a try, I would be happy to provide instructions.


Thanks for bringing this to our attention @wulu!

3 Likes

By the way, the double tap on the reset button is the common way to put most modern Arduino boards in bootloader mode when for some reason the IDE can't reach them - and the UNO R4 is no exception :slight_smile:

1 Like

Which ones are the exception?

The only modern one that I'm aware of is the Nano Every. Any others?