PaxInstruments / labwiz-board

A development board based on the STM32 series processors specifically targeting the STM32F103RxT series.
4 stars 2 forks source link

USB connection for bootloader #27

Closed charlespax closed 7 years ago

charlespax commented 8 years ago

What do we need for enabling the bootloader to flash over USB? See AN2606 p. 26. screen shot 2016-07-15 at 23 38 52

electrokean commented 8 years ago

STM32F103 doesn't have built in USB DFU bootloader, so it would be dependant on a separate bootloader like https://github.com/rogerclarkmelbourne/STM32duino-bootloader See the notes there in README.md as there are a few implementation options for the disconnect feature

charlespax commented 8 years ago

Moved to firmware repo.

electrokean commented 7 years ago

For the more modern chips with USB DFU, you should just need a way to control BOOT0 (and possibly RESET) to start the bootloader.

If you have a spare I/O pin, you can do a nifty firmware trick by connecting that to BOOT0 along with a small capacitor. To enter the bootloader, the firmware pulls the I/O pin high to charge the cap, and then does a reset while the cap holds BOOT0 high (slowly discharging through a pulldown).

Ref: http://stackoverflow.com/questions/26891432/jump-to-bootloader-in-stm32-through-appliction-i-e-using-boot-0-and-boot-1-pins

charlespax commented 7 years ago

PC1 is currently not used and is a good candidate. It could easily be routed over. screen shot 2017-01-23 at 13 16 32

I think this circuit would work. I would just connect PC1 to BOOT0 and add a cap across the 10k pulldown resistor. Not sure what value. img_20170123_131758

I would have to change the BOOT1 circuit. Right now it's normally high, which would make the device boot from SRAM. Making BOOT1 normally low would have the system default to system memory (hardware bootloader) if BOOT0 is high. screen shot 2017-01-23 at 13 24 01

screen shot 2017-01-23 at 13 27 06

charlespax commented 7 years ago

Since at lease some chips require a 1.5k pullup on USB_DP, we should implement the circuit. Here is an except from AN2606 screen shot 2017-01-23 at 13 42 05

charlespax commented 7 years ago

Actually, the board already has the 1.5K pullup. I think the pullup is to indicate to the host if the device is full-speed or high-speed (see also #55 ). screen shot 2017-01-23 at 13 44 17

charlespax commented 7 years ago

Yes, the 1.5k pullup on DP is to indicate full-speed. It is also the same circuit to indicate high-speed.

Change made to the BOOT1 switch. screen shot 2017-01-23 at 14 00 06

PC1 connected to BOOT0. screen shot 2017-01-23 at 14 03 46

Capacitor added in parallel with the BOOT0 pulldown. screen shot 2017-01-23 at 14 05 07

charlespax commented 7 years ago

Done. Closing issue.