Change VID and PID for Zero in bootloader makefile

Hello

I developed a custom board based on ATSAMD21G18A(equivalent to Arduino Zero) and looking to change its VID and PID.

I have downloaded git of Arduino core for SAMD: GitHub - arduino/ArduinoCore-samd: Arduino Core for SAMD21 CPU
at bootloaders/zero there Makefile which is responsible for making a new bootloaders. There is great tutorial for this by adafruit: Compile | Compiling ATSAMD21 Bootloader | Adafruit Learning System

Everything works like it should, actually, I can generate new .bin file which can be sucessfully flashed to a blank chip and later code can be uploaded to the same board. By editing boards.txt, I also get custom board name and everything I need.

BUT I am having problems with changing the VID and PID. I can not use Arduino ones as it is not allowed. By adafruit tutorial, line of code should be added to Makefile:

CFLAGS_EXTRA?=-D__SAMD21G18A__ -DUSB_PID_HIGH=0x00 -DUSB_PID_LOW=0x4D -DUSB_VID_LOW=0x41 -DUSB_VID_HIGH=0x23

Unfortunately, this code does not initally exsists in 1.6.18. version of samd-core. Even if added, it does not change the VID nor PID. I am not sure where to look or where to change those. Could somebody point to the location where VID and PID are changed at the moment?

Also, I am guessing that I will need another drivers for custom VID and PID, is that right?

Thanks everyone!
David

Hi, David. I'm searching the forums with a similar issue. I think I can help you a bit.

It seems like you actually need 2 PIDs, one for the bootloader, and one for normal code execution. I'm not sure why they need to enumerate as 2 different devices, I've searched a fair bit and haven't been able to find an answer.

I've been able to change the VID/PID for normal code execution by creating a custom board package and changing boards.txt, as well as USBCore.cpp. I followed this really excellent tutorial, which also has a discussion further down in the comments about VID/PID and drivers, and links to a good Adafruit tutorial on driver creation and signing:
https://forum.arduino.cc/index.php?topic=409715.0

Yes, I guess there's a generic CDC inf file for Windows 10, but for anything under, you'll need to create your own that points to usbser.sys. And it's helpful to sign it, especially if distributing it to others. The adafruit tutorial on driver signing is a little out of date - I went with GlobalSign and I guess as of last year, they don't allow downloads of code signing certificates. Now it's all hardware-token-controlled, so they have to send you a USB stick. The adafruit tutorial was still extremely helpful, but to install the certificate, you end up following these instructions (even though it's not an EV cert):

Doing all of that, I was able to successfully change the VID/PID, create a driver, and have my board recognized on a Windows 7 machine. Woot! However, I'm still having trouble with the bootloader. I only have one PID and tried using the same one for both the bootloader and "normal" port, but it's not working. I was able to re-compile and re-burn the bootloader, and although it did enumerate as a COM port, it didn't associate with my board and I wasn't able to re-program through the bootloader.

I'm wondering if getting another PID, and adding it to my driver will fix everything. And I'm still curious as to why the bootloader needs to be identified as a completely different USB device.

dava_2:
BUT I am having problems with changing the VID and PID. I can not use Arduino ones as it is not allowed.

textile:
It seems like you actually need 2 PIDs, one for the bootloader, and one for normal code execution.

Yes, I guess there's a generic CDC inf file for Windows 10, but for anything under, you'll need to create your own that points to usbser.sys. And it's helpful to sign it, especially if distributing it to others.

Doing all of that, I was able to successfully change the VID/PID, create a driver, and have my board recognized on a Windows 7 machine. Woot! However, I'm still having trouble with the bootloader. I only have one PID and tried using the same one for both the bootloader and "normal" port, but it's not working. I was able to re-compile and re-burn the bootloader, and although it did enumerate as a COM port, it didn't associate with my board and I wasn't able to re-program through the bootloader.

I'm wondering if getting another PID, and adding it to my driver will fix everything. And I'm still curious as to why the bootloader needs to be identified as a completely different USB device.

I have the same problem, I have only one PID that I licensed from Microchip. Is it really legally required to change the PID even for the bootloadrer for Zero-cloned boards? It's the same single USB port on Zero and by default when connected to PC it only shows the PID/VID of the normal code, not of the bootloader, so why do we need to worry about changing the bootloader PID?

As a workaround I can always program the normal code through JTAG without the bootloader, but then the ability to update the FW for the users will be lost.