Hey guys,
Hope you are doing great.
I am doing a personal project wherein I am messing around with a custom Atmega32u4 board based on Leonardo design. I am trying to rename the board to a custom name with a custom VID and PID for my personal use.
I followed the steps at http://steven.casagrande.io/articles/compiling-arduino-caterina-with-new-vidpid/
I recompiled Arduino Caterina Bootloader code based on LUFA with the changes in the VID, PID and the enumeration names in the Descriptor.c file as follows(I did correct for the sizing of the String length to make it match with 16 with spaces).
const USB_Descriptor_String_t ProductString =
{
.Header = {.Size = USB_STRING_LEN(16), .Type = DTYPE_String},
#if DEVICE_PID == 0x0036
.UnicodeString = L"Arduino Leonardo"
#elif DEVICE_PID == 0x0037
.UnicodeString = L"Arduino Micro "
#elif DEVICE_PID == 0x003C
.UnicodeString = L"Arduino Esplora "
//*****************************
#elif DEVICE_PID == 0x0ADB // Random PID number
.UnicodeString = L"Hello World "
//*****************************
#else
.UnicodeString = L"USB IO board "
#endif
};
const USB_Descriptor_String_t ManufNameString =
{
.Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
#if DEVICE_VID == 0x2341
.UnicodeString = L"Arduino LLC"
//*****************************
#elif DEVICE_VID == 0x0BAD // Random VID number
.UnicodeString = L"HelloVendor"
//*****************************
#else
.UnicodeString = L"Unknown "
#endif
};
I recompiled the project and generated the bootloader hex file and burned it to the new custom board via Atmel Studio and JTAGICE3 Programmer. Upload was successful. I uninstalled the new board from the device manager, Replugged it back to the PC and it shows up listed with the name USB Serial Device in the Ports Section of the Device Manager.
It is not showing up with the name Hello World as mentioned in the recompiled bootloader. So I thought the issue was with the bootloader but when I checked the PID and VID of the newly flashed device(By right clicking and checking properties in Device Manager for the new device), it shows up same as the one I mentioned in the new code. So am I assuming bootloader is OK.
In order to debug the problem, I plugged in an Arduino Leonardo along with the custom board to compare the USB properties. What is surprising is that in the properties of the custom board, Bus reported device description section, it shows up as Hello World (Check attachment below with the name Bus Reported.png) but Device description section shows it as USB Serial Device
Exploring further, I was doing a side by side analysis of the two boards. I have attached the images for that. (Check attachments 1-4.png) It seems that it could be the issue with Windows?
I can flash new codes in the new board via Arduino IDE after I edited the boards.txt and added a new entry to the Arduino IDE. It programs fine without any issues.
-
Any ideas how I can fix this issue to make Windows renumerate my device with my custom name? I am sure people would have tried this already on a Leonardo board.
-
Second question is when I look at the bootloader sizes of Arduino Caterina Leonardo Production version has a file size of around 75.9KB on Windows whereas the newly compiled bootloader which I compiled was only around 11KB. Is that an issue? Why so, why is the Leonardo's production bootloader appear to be much larger?
(I know both the above file sizes are wrong as its in the machine readable format, Actual flashed size on the microcontroller will be around 4KB I assume) -
Third question is, when I plug in the original Arduino Leonardo, it enumerates as Arduino Leonardo Bootloader for the first 8sec and then enumerates itself as Arduino Leonardo. I know why this happens, but I am not sure where in the code this is made to happen? How is the enumeration names changing? Which part of the code is responsible for this?
The enumerated name also changes from Arduino Leonardo Bootloader to Arduino Leonardo in the Arduino IDE in Tools->Ports Section. Where is the code which enables this part?
Hoping someone can help me out with these issues.
Thanks in advance.