Go Down

Topic: Why separate USB PIDs for bootloader and sketch for ATmega32u4 Arduinos? (Read 564 times) previous topic - next topic


Hi there --

If I look at the various ATmega32u4 based Arduinos I see that they have one USB PID for when the bootloader is running and a different one for when the sketch is running (at least for the Leonardo, Esplora and Yun).

E.g. the Leonardo uses the PID 0x0036 for the bootloader and 0x8036 for the sketch.

Is the requirement for two PIDs documented/explained anywhere for people creating their own Arduino like hardware with the ATmega32u4?

It seems conceptually nice to be able to distinguish the two states, i.e. bootloader and sketch, but does anything actually depend on or take advantage or this?

I had a good look around in the ide-1.5.x branch of the Arduino repo - i.e. https://github.com/arduino/Arduino/tree/ide-1.5.x - but couldn't find anything really.

All the two PIDs seems to do is:
  • require you to have two entries for each board in the arduino.inf file for Windows.
  • require you to make sure you use one PID for your board's Caterina bootloader and another for your core.
  • maintain at least two pid.X entries for each board in boards.txt
So other than being able to have different names show up in Device Manager on Windows, depending on what state the board is in, what are the advantages?

Is there some bit of the IDE that I didn't notice that reacts in some way to the different PIDs for a given board?

In the case of the Leonardo, Esplora and Yun I see that the sketch PID is the same as the bootloader PID except for the highest bit, which is set for the sketch, e.g. 0x8036, and unset for the bootloader, e.g. 0x0036.

Is this just a convention or is it required? Does anything depend on this?

Also I notice that while the Leonardo, Esplora and Yun have pid.0 and pid.1 values listed for them in boards.txt, some of the other ATmega32u4 based Arduinos do not.

I.e. the Micro, LilyPad USB and the Robot - they just each have the old familiar build.pid.

Is there a reason for this - not having a pid.X value seems to mean the IDE won't auto-recognise these boards? Do these boards not have separate bootloader and sketch PIDs? Take the Micro - it's basically a scaled down Leonardo so why the different handling?

I started looking into this on investigating what the vid.0 and pid.0 entries were in 1.5.X boards.txt files and got from there to https://code.google.com/p/arduino/issues/detail?id=223

From the commentary for this issue I can see a lot of clean up has been going into the whole PID issue so I'd like to be clear about what's going on here.

PS I also see from the repo that you're getting ready for 1.6.0rc1 - congratulations. I hope we can soon say goodbye to the 1.0.X series :)

Thanks for your help,


Go Up