Thank you so much, now it works flawlessly
Which, the Uno R4 or the ESP32?
Many ESP32 boards use CP2102 UART bridges, but I would expect the Renesas microcontroller on the Uno R4 would probably have native USB and not need an external UART chip?
It does, but this board is normally connected to the PC via an ESP32-S3. The primary purpose of the ESP32-S3 is to provide the UNO R4 WiFi with Wi-Fi communication capabilities. However, it is also used as a "bridge" module for communication between the Renesas RA4M1 microcontroller and the PC. That communication includes uploading sketches, Serial Monitor, and the Arduino IDE sketch debugger (the bridge module acts as a CMSIS-DAP compliant debug probe).
I said "normally" above. This is because the design of this board makes it possible for the USB data lines to be connected either to the "bridge" module, or directly to the RA4M1. The connection of these lines is via the NLASB3157 switches on the board. Those switches are controlled by Arduino pin 21 (or by the solder jumper marked "RA4M1 USB").
The most common scenario for the RA4M1 to be connected directly to the USB data lines is when the sketch uses the HID capabilities of the board. The "HID" library that is bundled with the "Arduino UNO R4 Boards" platform automatically sets pin 21 to HIGH. This means that the RA4M1 is connected to USB when the sketch running on the board uses the "Keyboard" or "Mouse" libraries, or other 3rd party libraries that utilize the HID library. In this case, the board will still produce a USB CDC serial port (unless something in the sketch program disables or breaks it).
The ESP32-S3 must be connected to the USB in order to perform an upload. The sketch upload operation performs a "1200 bps touch". When the serial port is produced by the RA4M1, this signal causes the board to go into the boot mode. That frees pin 21 from the control of the sketch program, causing the NLASB3157 switches to return to the default state that connects the ESP32-S3 to the USB data lines.
It is of course also possible for the sketch code to directly control pin 21 (e.g., digitalWrite(21, HIGH)). In this case, the board will only produce a serial port if there is something in the sketch code that explicitly. Under these rare conditions, the upload operation would not trigger the boot mode (since there is no port). However, the user has the power to manually put the board into boot mode by performing a double reset. That double reset will have the same effect of causing the ESP32-S3 to be connected to the USB data lines.
Great news! At least you have one board to use to get back to work on Arduino projects.
Maybe we can now circle back to the UNO R4 WiFi and make some further investigation. Please perform the following procedure to gather a bit more information about the situation with the board:
- Disconnect the USB cable of the Arduino board from your computer.
- Start Windows Device Manager.
- Select View > Devices by type from the Device Manager menus.
- Open the "View" menu.
- If there is a ✓ to the left of the "Show hidden devices" menu item, click on "Show hidden devices" to disable it.
- Take note of the contents of the "Other devices" section of the Device Manager tree.
- Connect the Arduino board to your computer with a USB cable.
- Select Action > Scan for hardware changes" from the Device Manager menus.
- Based on the information you provided in post #7, we would expect a new device to now appear under the "Other devices" section of the Device Manager tree. Double click on the tree item for that new device.
A "properties" dialog will open. - Select the "Details" tab of the dialog.
- Select "Hardware Ids" from the dropdown menu in the dialog.
- Right click on the "Value" field in the dialog.
A context menu will open. - Select "Select All" from the menu.
All the text in the "Value" field will be selected. - Right click on the text in the "Value" field.
A context menu will open. - Select "Copy" from the menu.
This will copy the selected text to the clipboard. - Open a reply here on this forum topic by clicking the "Reply" button.
- Press the Ctrl+V keyboard shortcut.
This will paste the error output from the upload into the post composer. - Click the "Reply" button to publish the post.
Only the ESP32, the UNO is probably dead :/