Open MURPHYENGINEERING opened 2 years ago
We can use the built-in bootloader to flash it without a programmer, but the user has to boot it with the BOOT0 pin. Asking the user to put it in a special mode every time they want to upload code isn't what I want. We can require this the first time to flash a bootloader that listens for a programmer on USB so they have a more Arduino-like experience.
See the STM docs on the boot capabilities for our chip (c20ec9f2251de8fd79f439a7f0a2a60e13dd4db3). What we're looking for is
Reading about FTDI programming with a bootloader:
RS-232 chips use the DTR pin to reset the chip and enter the bootloader's firmware-receptive window:
That pin is toggled when the IDE starts uploading (or opens the serial monitor) and stays high. The reset pulse is implemented by draining a capacitor on the chip reset pin:
To support that process on the STM32, we need to find how the FTDI chip translates the always-connected USB channel to a toggling DTR signal. Can the host-side driver toggle power on the USB interface? That seems almost too easy.
Briefly looking at the Arduino UNO schematic, it looks like they're using an ATMEGA16 as an ISP connected directly to USB.
On the datasheet there's a good clue about how this might work:
The ATMEGA16 appears to be using something like that DTR reset scheme:
More after class