Configuring device descriptors of my UNO R4 Wifi

Hi,

Im looking to configure my device descriptors for my UNO R4 Wifi that I just bought. I have done it previously on my other avr based boards but Im having a lot of trouble with it on this new one. In the avr based ones I could simply edit the boards.txt and the USBCore.cpp but changing the boards.txt doesn't work on this new one and I can't even find the USBCore.cpp. I also tried changing some stuff in the USB.h but that didn’t work either.

I could also disable the serial interface through USBCore.cpp easily by commenting out a few line, how would I do this now?

Someone else asked about modifying the vendor id and product id and got an answer but im looking to modify a lot more, like the device class, device subclass, serial number and all that stuff. How do I do this with the new board?

@ptillisch and others with Arduino can answer this a lot better than I can, but I will mention a few things I have learned. Hopefully some of it will be useful.

A lot of this is covered in a few different places. Including my thread:
Creating variant for using UNO R4 WiFi in USB bridge bypass mode - UNO R4 / UNO R4 WiFi - Arduino Forum

The Arduino UNO R4 WiFi USB wise is interesting. There are Two processors on the board, an ESP32-S3 and the main processor RA4M1. By default the ESP32-S3 is the processor that talks to the USB port. The software that is loaded into this processor by default is contained in the github project:

arduino/uno-r4-wifi-usb-bridge (github.com)

I am guessing that to update the PID/VID when it is in this mode, you would need to update it, probably here:

uno-r4-wifi-usb-bridge/UNOR4USBBridge/UNOR4USBBridge.ino at main · arduino/uno-r4-wifi-usb-bridge (github.com)

However, there is a couple of ways to configure the board to have the main processor talk to the USB instead of the ESP32. Either by doing a digitalWrite(21, HIGH);
or by connecting the solder bridge on the bottom of the board: Some of this is described on their
cheat sheet:
Arduino UNO R4 WiFi Cheat Sheet | Arduino Documentation

Note: There are issues with the cheat sheet that they say pin 40, but it is actually pin 21.

One way this is used. Is if your sketch uses some HID class, like Keyboard or Mouse, the code is setup that it will set the PIN 21 high and take over USB. When it boots up in this mode,

I believe in this case, the VID:PID are set in the USB Descriptor are defined in the variant.
In my sources for WIFI, I believe it is in the file:
D:\github\ArduinoCore-renesas\variants\UNOWIFIR4\pins_arduino.h

Near the end:


#define USB_VID           (0x2341)
#define USB_PID           (0x006D)
#define USB_NAME          "UNO R4 WiFi"

If you try to update the board to always boot from the RA4M1 Processor, by soldering the USB jumper on the back (or like me soldered a switch there). You will need to also update the bootloader on the processor. Which is more the topic I linked to at the start.

The sources for the bootloaders is up on github:
arduino/arduino-renesas-bootloader: A tinyusb based project implementing the bootloader for Uno R4 and Portenta C33 (github.com)
And the makefiles also specify VID:PID and name as you can see in the file:
arduino-renesas-bootloader/Makefile.wifi at main · arduino/arduino-renesas-bootloader (github.com)

Hope that helps some.

Thanks for your reply. I’ll definitely take a look at all this and try to figure everything out.

Update: Actually its easily possible to change all of these descriptors in the USB.cpp in the renesas core I just wasn't doing it right or something. Only thing I'm trying to figure out now is how to disable the serial interface and only have the hid one. If anyone knows how please tell me, thanks.

1 Like