I am trying to set up a single arduino with a unique Vendor ID / Product ID for testing behavior on plug-in (focusing on the host side). I am not experienced with compiling bootloaders, but ALL I want to change about the arduino is that it announces itself with this VID/PID (and that i maintain all the programmability of arduino to test my communications protocol).
Is there an easy way to compile a bootloader for an arduino (any 'flavor' would be OK), where I can specify the VID/PID?
Some of the Arm based Arduino boards that have USB support on the processor have a bootloader where you can specify the VID & PID when building the bootloader. Adafruit has a github page for their SAMD board bootloaders where you can specify the VID & PID. Look at the boards/"board name"/board_config.h file.
For an Uno, you would need to reprogram the 16u2 firmware, rather than the bootloader.
For a Genuine Nano or other board with an actual FTDI chip, FTDI has a utility to modify the VID/PID/etc in the chip.
I believe you're out-of-luck for anything with a CH340x.
The boards with native USB are easier. Theoretically, the sketch and the bootloader can have different VID/PIDs.
Thanks! the adafruit github you linked, @markd833, was really easy to follow (or i got lucky with my machine's configuration). I am now just waiting on an M0 to arrive to try this out - (and then write up the sequence for future noobs).
I have a Micro also coming in the mail to test and try to understand this. In that case, which is the VID/PID that the computer you attach to is given? (or does that answer differ at different 'levels'). I'm interested in both a 'hardware' level (maybe what your computer shows in the device enumeration), and a 'software' level (what an application is given) [but not sure if i'm talking sense]
The VID/PID for boards with native USB hardware is taken from the boards.txt file. But this is valid only when compiling the sketch.
The Bootloader VID/PID is defined when compiling the bootloader.
Hi @MicroBahner -- Thanks! Let me clarify my question: Suppose I've transferred my sketch to the arduino, setting the VID/PID to "Combination 1" at that level, but the bootloader has VID/PID "Combination 0" at that level.
Now, then, suppose I connect this programmed arduino to another computer or host device. Does this new host device see the arduino as Combination 1 or as Combination 0 or is there a complex interaction between them (it sees both Combinations, at different times/situations)?
There is only one VID/PID at one time when running your microcontroller. Which VID/PID your computer sees, depends wether bootloader or sketch is running.
After reset the bootloader is running and is waiting for an upload. During this time your computer sees the VID/PID of the bootloader ( the devicemanager shows the corresponding device e.g. 'Arduino Leonardo Bootloader' )
If it times out ( or after uploading ) your sketch is started. Now your computer sees a different VID/PID and shows another device at a different comport ( e.g. Arduino Leonardo ).
You can still see the bootloader device if you check 'show hidden devices' in device manager.