The pill is a fine F103 board. The maple is bigger and more manly. It also has the USB disconnect circuit that I can manipulate in software (GPIO C12) and avoid bending over and unplugging/replugginf the USB cable. And I have these doggone things and ought to use them for something. Every change is more time and trouble than you would ever think -- but you always learn things too.
One thing I learned was that it was not sufficient to just connect SWCLK and SWDAT for the STLINK, I also had to connect ground. Not entirely surprising if you think about it at all.
Also the LED on the maple is on PA5 rather than PC13. But not only that, you must configure the GPIO to drive the LED with push pull. On the Maple, the chip drives the diode, while on the pill, the chip pulls the diode to ground. So for the pill you can configure the GPIO either way (push/pull or open drain). Probably open drain is better.
If I now enable the gpio as an output and set it to one, on a reboot, linux sees the board "arrive" and a successful enumeration ensures.
If I now enable the gpio as an output and set it to zero, I get the exact same result. This is somewhat puzzling, but certainly works out OK. The enumeration goes very fast when the bit is set to zero.
So here is what does work. On reset, all GPIO get configured as inputs.
When my code starts, I configure PC12 as a push/pull output. I get
enumeration and everything works.
Later, to cause a disconnect when I get in the mood,
I reconfigure PC12 again as an input, delay a while, then back to
an output. This causes a disconnect and restarts enumeration.
This satisfies me, at least for now.
And it is handy to have a reset trigger USB enumeration rather than having to bend over and grab my cable to yank it out and put it back in again. These little things are important and above all they maintain mental focus and clarity. One less thing to remember. Automation during code development is always good.
Tom's Computer Info / [email protected]