|
If you can't view the Datasheet, Please click here to try to view without PDF Reader . |
|
Datasheet File OCR Text: |
march 2015 docid13801 rev 21 1/155 1 AN2606 application note stm32 microcontroller system memory boot mode introduction the bootloader is stored in the internal boot rom memory (system memory) of stm32 devices. it is programmed by st during production. its main task is to download the application program to the internal flash me mory through one of the available serial peripherals (usart, can, usb, i 2 c, spi, etc.). a communication protocol is defined for each serial interface, with a compatible command set and sequences. this document applies to the products listed in table 1 . they are referred as stm32 throughout the document. the main features of the bootloader are the following: ? it uses an embedded serial interface to download the code with a predefined communication protocol ? it transfers and updates the flash memory c ode, the data, and the vector table sections this application note presents the general concept of the bootloader. it describes the supported peripherals and hardware requirements to be considered when using the bootloader of stm32 devices. however the sp ecifications of the lo w-level communication protocol for each supported serial peripheral are documented in separate documents. for specifications of the usart protocol used in the bootloader, refer to an3155. for the specification of the can protocol used in the bootloader, refer to an3154. for the specification of the dfu (usb device) protocol used in the bootloader, refer to an3156. for the specification of the i 2 c protocol used in the bootloader, refer to an4221. for the specification of the spi protocol used in the bootloader, refer to an4286. table 1. applicable products type part number or product series microcontrollers stm32l0 series: stm32l051xx, stm3 2l052xx, stm32l053xx, stm32l062xx, stm32l063xx stm32l1 series. stm32l4 series: stm32l476xx, stm32l486xx stm32f0 series: stm32f 03xxx, stm32f04 xxx, stm32f05xxx, stm32f07xxx stm32f1 series. stm32f2 series. stm32f3 series: stm32f301xx, stm32f 302xx, stm32f303xx, stm32f318xx, stm32f328xx, stm32f334xx, stm32f358xx, stm32f373xx, stm32f378xx stm32f4 series: stm32f401xx, stm32f 405xx, stm32f407xx, stm32f411xx, stm32f415xx, stm32f417xx, stm32f427xx, stm32f429xx, stm32f437xx, stm32f439xx, stm32f446xx www.st.com
contents AN2606 2/155 docid13801 rev 21 contents 1 related documents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 2 glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 3 general bootloader description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 3.1 bootloader activation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 3.2 bootloader identification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 3.3 hardware connection requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 3.4 bootloader memory management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 4 stm32f10xxx devices bootloader . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 4.1 bootloader configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 4.2 bootloader selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 4.3 bootloader version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 5 stm32f105xx/107xx devices bootloader . . . . . . . . . . . . . . . . . . . . . . . 25 5.1 bootloader configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 5.2 bootloader selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 5.3 bootloader version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 5.3.1 how to identify stm32f105xx/107xx bootloader versions . . . . . . . . . . 28 5.3.2 bootloade r unavailability on stm32f 105xx/stm32f107xx devices with a date code below 937 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 5.3.3 usart bootloader get-version command returns 0x20 instead of 0x22 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 5.3.4 pa9 excessive power consumpt ion when usb cable is plugged in bootloader v2.0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 6 stm32f10xxx xl-density devices bootloader . . . . . . . . . . . . . . . . . . . 31 6.1 bootloader configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 6.2 bootloader selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 6.3 bootloader version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 7 stm32l1xxx6(8/b) devices bootload er . . . . . . . . . . . . . . . . . . . . . . . . . 33 7.1 bootloader configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 docid13801 rev 21 3/155 AN2606 contents 7 7.2 bootloader selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 7.3 bootloader version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 8 stm32l1xxxc devices bootloader . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 8.1 bootloader configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 8.2 bootloader selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 8.3 bootloader version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 9 stm32l1xxxd devices bootloader . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 9.1 bootloader configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 9.2 bootloader selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 9.3 bootloader version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 10 stm32f2xxxx devices bootloader . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 10.1 bootloader v2.x . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 10.1.1 bootloader configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 10.1.2 bootloader selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 10.1.3 bootloader version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 10.2 bootloader v3.x . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 10.2.1 bootloader configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 10.2.2 bootloader selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 10.2.3 bootloader version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 11 stm32f40xxx/41xxx devices bootload er . . . . . . . . . . . . . . . . . . . . . . . 49 11.1 bootloader v3.x . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 11.1.1 bootloader configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 11.1.2 bootloader selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 11.1.3 bootloader version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 11.2 bootloader v9.x . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 11.2.1 bootloader configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 11.2.2 bootloader selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 11.2.3 bootloader version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 12 stm32f05xxx and stm32f030x8 devices bootloader . . . . . . . . . . . . . 59 12.1 bootloader configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 12.2 bootloader selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 contents AN2606 4/155 docid13801 rev 21 12.3 bootloader version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 13 stm32f03xxx devices bootloader . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 13.1 bootloader configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 13.2 bootloader selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 13.3 bootloader version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 14 stm32f373xx devices bootloader . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 14.1 bootloader configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 14.2 bootloader selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 14.3 bootloader version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 15 stm32f302xb(c)/303xb(c) devices bootloader . . . . . . . . . . . . . . . . . . 66 15.1 bootloader configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 15.2 bootloader selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 15.3 bootloader version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 16 stm32f378xx devices bootloader . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 16.1 bootloader configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 16.2 bootloader selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 16.3 bootloader version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 17 stm32f358xx devices bootloader . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 17.1 bootloader configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 17.2 bootloader selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 17.3 bootloader version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 18 stm32f42xxx/43xxx devices bootload er . . . . . . . . . . . . . . . . . . . . . . . 73 18.1 bootloader v7.x . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 18.1.1 bootloader configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 18.1.2 bootloader selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 18.1.3 bootloader version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 18.2 bootloader v9.x . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 18.2.1 bootloader configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 18.2.2 bootloader selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 18.2.3 bootloader version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 docid13801 rev 21 5/155 AN2606 contents 7 19 stm32f04xxx devices bootloader . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86 19.1 bootloader configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86 19.2 bootloader selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 19.3 bootloader version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 20 stm32f07xxx devices bootloader . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 20.1 bootloader configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 20.2 bootloader selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 20.3 bootloader version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 21 stm32f301xx/302x4(6/8) devices bootloader . . . . . . . . . . . . . . . . . . . 92 21.1 bootloader configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 21.2 bootloader selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 21.3 bootloader version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 22 stm32f318xx devices bootloader . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 22.1 bootloader configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 22.2 bootloader selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 22.3 bootloader version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 23 stm32f303x4(6/8)/334xx/328xx d evices bootloader . . . . . . . . . . . . . . 98 23.1 bootloader configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 23.2 bootloader selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 23.3 bootloader version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 24 stm32f401xb(c) devices bootloader . . . . . . . . . . . . . . . . . . . . . . . . . 100 24.1 bootloader configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100 24.2 bootloader selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104 24.3 bootloader version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 25 stm32f401xd(e) devices bootloader . . . . . . . . . . . . . . . . . . . . . . . . . 106 25.1 bootloader configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106 25.2 bootloader selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .110 25.3 bootloader version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111 contents AN2606 6/155 docid13801 rev 21 26 stm32f411xx devices bootloader . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112 26.1 bootloader configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .112 26.2 bootloader selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .116 26.3 bootloader version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .117 27 stm32l1xxx6(8/b)a devices bootlo ader . . . . . . . . . . . . . . . . . . . . . . 118 27.1 bootloader configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .118 27.2 bootloader selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .119 27.3 bootloader version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .119 28 stm32l1xxxe devices bootloader . . . . . . . . . . . . . . . . . . . . . . . . . . . 120 28.1 bootloader configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120 28.2 bootloader selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122 28.3 bootloader version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 29 stm32l05xxx/06xxx devices bootload er . . . . . . . . . . . . . . . . . . . . . . 124 29.1 bootloader configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124 29.2 bootloader selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126 29.3 bootloader version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126 30 stm32l476xx/486xx devices bootload er . . . . . . . . . . . . . . . . . . . . . . 127 30.1 bootloader configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127 30.2 bootloader selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130 30.3 bootloader version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132 31 stm32f446xx devices bootloader . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133 31.1 bootloader configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133 31.2 bootloader selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137 31.3 bootloader version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138 32 device-dependent bootloader parameters . . . . . . . . . . . . . . . . . . . . . 139 33 bootloader timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 33.1 bootloader startup timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 33.2 usart connection timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 docid13801 rev 21 7/155 AN2606 contents 7 33.3 usb connection timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144 33.4 i2c connection timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146 33.5 spi connection timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147 34 revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149 list of tables AN2606 8/155 docid13801 rev 21 list of tables table 1. applicable products . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 table 2. bootloader activation patterns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 table 3. embedded bootloaders. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 table 4. stm32 f2 and f4 voltage range configuration us ing bootloader . . . . . . . . . . . . . . . . . . . 22 table 5. supported memory area by write, read, eras e and go commands. . . . . . . . . . . . . . . . . 22 table 6. stm32f10xxx configuration in system memory boo t mode . . . . . . . . . . . . . . . . . . . . . . . 23 table 7. stm32f10xxx bootloader versions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 table 8. stm32f105xx/107xx configuration in system me mory boot mode . . . . . . . . . . . . . . . . . . 25 table 9. stm32f105xx/107xx bootloader versions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 table 10. stm32f10xxx xl-density configuration in syst em memory boot mode . . . . . . . . . . . . . . 31 table 11. stm32f10xxx xl-density bootloader versions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 table 12. stm32l1xxx6(8/b) configuration in system memo ry boot mode. . . . . . . . . . . . . . . . . . . . 33 table 13. stm32l1xxx6(8/b) bootloader versions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 table 14. stm32l1xxxc configuration in system memory boot mode . . . . . . . . . . . . . . . . . . . . . . . 35 table 15. stm32l1xxxc bootloader versions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 table 16. stm32l1xxxd configuration in system memory boot mode . . . . . . . . . . . . . . . . . . . . . . . 38 table 17. stm32l1xxxd bootloader versions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 table 18. stm32f2xxxx configuration in system memory boot mode. . . . . . . . . . . . . . . . . . . . . . . . 42 table 19. stm32f2xxxx bootloader v2.x versions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 table 20. stm32f2xxxx configuration in system memory boot mode. . . . . . . . . . . . . . . . . . . . . . . . 45 table 21. stm32f2xxxx bootloader v3.x versions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 table 22. stm32f40xxx/41xxx configuration in system memo ry boot mode . . . . . . . . . . . . . . . . . . 49 table 23. stm32f40xxx/41xxx bootloader v3.x versions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 table 24. stm32f40xxx/41xxx configuration in system memo ry boot mode . . . . . . . . . . . . . . . . . . 53 table 25. stm32f40xxx/41xxx bootloader v9.x versions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 table 26. stm32f05xxx and stm32f030x8 devices configuration in system memory boot mode . 59 table 27. stm32f05xxx and stm32f030x8 devices bootloader versions . . . . . . . . . . . . . . . . . . . . 60 table 28. stm32f03xxx configuration in system memory boo t mode . . . . . . . . . . . . . . . . . . . . . . . 61 table 29. stm32f03xxx bootloader versions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 table 30. stm32f373xx configuration in system memory boot mode . . . . . . . . . . . . . . . . . . . . . . . 63 table 31. stm32f373xx bootloader versions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 table 32. stm32f302xb(c)/303xb(c) configuration in sy stem memory boot mode . . . . . . . . . . . . 66 table 33. stm32f302xb(c)/303xb(c) bootloader versions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 table 34. stm32f378xx configuration in system memory boot mode . . . . . . . . . . . . . . . . . . . . . . . 69 table 35. stm32f378xx bootloader versions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 table 36. stm32f358xx configuration in system memory boot mode . . . . . . . . . . . . . . . . . . . . . . . 71 table 37. stm32f358xx bootloader versions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 table 38. stm32f42xxx/43xxx configuration in system memo ry boot mode . . . . . . . . . . . . . . . . . . 73 table 39. stm32f42xxx/43xxx bootloader v7.x versions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 table 40. stm32f42xxx/43xxx configuration in system memo ry boot mode . . . . . . . . . . . . . . . . . . 79 table 41. stm32f42xxx/43xxx bootloader v9.x versions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 table 42. stm32f04xxx configuration in system memory boo t mode . . . . . . . . . . . . . . . . . . . . . . . 86 table 43. stm32f04xxx bootloader versions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 table 44. stm32f07xxx configuration in system memory boo t mode . . . . . . . . . . . . . . . . . . . . . . . 89 table 45. stm32f07xxx bootloader versions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 table 46. stm32f301xx/302x4(6/8) configuration in system memory boot mode . . . . . . . . . . . . . . 92 table 47. stm32f301xx/302x4(6/8) bootloader versions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 table 48. stm32f318xx configuration in system memory boot mode . . . . . . . . . . . . . . . . . . . . . . . 95 docid13801 rev 21 9/155 AN2606 list of tables 9 table 49. stm32f318xx bootloader versions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 table 50. stm32f303x4(6/8)/334xx/328x x configuration in system memory boot mode . . . . . . . . . 98 table 51. stm32f303x4(6/8)/334xx/328xx bootloader versions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 table 52. stm32f401xb(c) configuration in system memory boot mode. . . . . . . . . . . . . . . . . . . . 100 table 53. stm32f401xb(c) bootloader versions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 table 54. stm32f401xd(e) configuration in system memory boot mode. . . . . . . . . . . . . . . . . . . . 106 table 55. stm32f401xd(e) bootloader versions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111 table 56. stm32f411xx configuration in system memory bo ot mode . . . . . . . . . . . . . . . . . . . . . . 112 table 57. stm32f411xx bootloader versions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 table 58. stm32l1xxx6(8/b)a configuration in system me mory boot mode . . . . . . . . . . . . . . . . . 118 table 59. stm32l1xxx6(8/b)a bootloader versions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119 table 60. stm32l1xxxe configuration in system memory bo ot mode . . . . . . . . . . . . . . . . . . . . . . 120 table 61. stm32l1xxxe bootloader versions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 table 62. stm32l05xxx/06xxx configuratio n in system memory boot mode . . . . . . . . . . . . . . . . . 124 table 63. stm32l05xxx/06xxx bootloader versions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126 table 64. stm32l476xx/486xx configuration in system memo ry boot mode . . . . . . . . . . . . . . . . . 127 table 65. stm32l476xx/486xx bootloader v10.x versions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132 table 66. stm32f446xx configuration in system memory bo ot mode . . . . . . . . . . . . . . . . . . . . . . 133 table 67. stm32f446xx bootloader v9.x versions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138 table 68. bootloader device-dependent parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139 table 69. bootloader startup timings of stm32 devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 table 70. usart bootloader minimum timings of stm32 device s . . . . . . . . . . . . . . . . . . . . . . . . . 143 table 71. usb bootloader minimum timings of stm32 devices. . . . . . . . . . . . . . . . . . . . . . . . . . . . 145 table 72. i2c bootloader minimum timings of stm32 devices. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147 table 73. spi bootloader minimum timings of stm32 devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148 table 74. document revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149 list of figures AN2606 10/155 docid13801 rev 21 list of figures figure 1. usart connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 figure 2. usb connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 figure 3. i2c connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 figure 4. spi connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 figure 5. can connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 figure 6. bootloader for stm32f10xxx with usart1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 figure 7. bootloader selection for stm32f105xx/107xx device s . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 figure 8. bootloader selection for stm32f10xxx xl-density devices. . . . . . . . . . . . . . . . . . . . . . . . 32 figure 9. bootloader selection for stm32l1xxx6(8/b) devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 figure 10. bootloader selection for stm32l1xxxc devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 figure 11. bootloader selection for stm32l1xxxd devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 figure 12. bootloader v2.x selection for stm32f2xxxx devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 figure 13. bootloader v3.x selection for stm32f2xxxx devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 figure 14. bootloader v3.x selection for stm32f40xxx/41xxx devices . . . . . . . . . . . . . . . . . . . . . . . 51 figure 15. bootloader v9.x selection fo r stm32f40xxx/41xxx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 figure 16. bootloader selection for stm32f05xxx and st m32f030x8 devices . . . . . . . . . . . . . . . . . 60 figure 17. bootloader selection for stm32f03xxx devices. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 figure 18. bootloader selection for stm32f373xx devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 figure 19. bootloader selection for stm32f302xb(c)/303xb(c ) devices. . . . . . . . . . . . . . . . . . . . . . 68 figure 20. bootloader selection for stm32f378xx devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 figure 21. bootloader selection for stm32f358xx devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 figure 22. dual bank boot implemen tation for stm32f42xxx/43xxx bootloader v7.x . . . . . . . . . . . . 76 figure 23. bootloader v7.x selection fo r stm32f42xxx/43xxx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 figure 24. dual bank boot implemen tation for stm32f42xxx/43xxx bootloader v9.x . . . . . . . . . . . . 83 figure 25. bootloader v9.x selection fo r stm32f42xxx/43xxx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 figure 26. bootloader selection for stm32f04 xxx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 figure 27. bootloader selection for stm32f07 xxx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 figure 28. bootloader selection for stm32f301xx/302x4(6/8) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 figure 29. bootloader selection for stm32f318xx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 figure 30. bootloader selection for stm32f303x4(6/8)/334xx /328xx . . . . . . . . . . . . . . . . . . . . . . . . . 99 figure 31. bootloader selection for stm32f401xb(c) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104 figure 32. bootloader selection for stm32f401xd(e) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110 figure 33. bootloader selection for stm32f411xx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116 figure 34. bootloader selection for stm32l1xxx6(8/b)a device s. . . . . . . . . . . . . . . . . . . . . . . . . . . 119 figure 35. bootloader selection for stm32l1xxxe devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122 figure 36. bootloader selection for stm32l05xxx/06xxx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126 figure 37. dual bank boot implementation for stm32l 476xx/486xx bootloader v10.x . . . . . . . . . . 130 figure 38. bootloader v10.x selection for stm32l476xx/486xx . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131 figure 39. bootloader v9.x selection for stm32f446xx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137 figure 40. bootloader startup timing description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 figure 41. usart connection timing descript ion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 figure 42. usb connection timing description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145 figure 43. i2c connection timing description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146 figure 44. spi connection timing descript ion. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147 docid13801 rev 21 11/155 AN2606 related documents 154 1 related documents for each supported product (listed in table 1 ), please refer to the following documents available from www.st.com : ? datasheet or databrief ? reference manual 2 glossary f0 series: stm32f05xxx and stm32f030x8 devices is used to refer to stm32f051x4, stm32f051x6, stm32f051x8, stm3 2f058x8 and stm32f030x8 devices. stm32f03xxx is used to refer to stm32f031x4, stm32f031x6, stm32f030f4, stm32f038x6 and stm32f030x6 devices. stm32f04xxx is used to refer to stm32f042x4 and stm32f042x6 devices. stm32f07xxx is used to refer to stm32f072x8 and stm32f072xb and stm32f071xb devices. f1 series: stm32f10xxx is used to refer to low-density, medium-density, high-density, low- density value line, medium-d ensity value line and high- density value line devices: low-density devices are stm32f101xx, stm32f102xx and stm32f103xx microcontrollers where the flash memory density ranges between 16 and 32 kbytes. medium-density devices are stm32f101xx, stm32f102xx and stm32f103xx microcontrollers where the flash memory density ranges between 64 and 128 kbytes. high-density devices are stm32f101xx and stm32f103xx microcontrollers where the flash memory density ra nges between 256 and 512 kbytes. low-density value line devices are stm32f100xx microcontrollers where the flash memory density ranges between 16 and 32 kbytes. medium-density value line devices are stm32f100xx microcontrollers where the flash memory density ranges between 64 and 128 kbytes. high-density value line devices are stm32f100xx microcontrollers where the flash memory density ranges between 256 and 5128 kbytes. stm32f105xx/107xx is used to refer to stm32f105xx and stm32f107xx devices. stm32f10xxx xl-density is used to refer to stm32f101xx and stm32f103xx devices where the flash memory density ranges between 768 kbytes and 1 mbyte. f2 series: stm32f2xxxx is used to refer to stm32f215xx, stm32f205xx, stm32f207xx and smt32f217xx devices. glossary AN2606 12/155 docid13801 rev 21 f3 series: stm32f373xx is used to refer to stm32f373x8, stm32f373xb and stm32f373xc devices. stm32f302xb(c)/303xb(c) is used to refer to stm32f302xb, stm32f302xc, stm32f303xb and stm32f303xc devices. stm32f378xx is used to refer to stm32f378xc devices. stm32f358xx is used to refer to stm32f358xc devices. stm32f301xx/302x4(6/8) is used to refer to stm32f301x4, stm32f301x6, stm32f301x8, stm32f302x4, stm3 2f302x6 and stm32f302x8 devices. stm32f318xx is used to refer to stm32f318xc devices. stm32f303x4(6/8)/334xx/328xx is used to refer to stm32f303x4, stm32f303x6, stm32f303x8, stm32f334x4, stm32f33 4x6, stm32f334x8, and stm32f328x8 devices. f4 series: stm32f40xxx/41xxx is used to refer to stm32f405xx, stm32f407xx, stm32f415xx and smt32f417xx devices. stm32f401xb(c) is used to refer to stm32f401xb and stm32f401xc devices. stm32f401xd(e) is used to refer to stm32f401xd and stm32f401xe devices. stm32f411xx is used to refer to stm32f411xd and stm32f411xe devices. stm32f42xxx/43xxx is used to refer to stm32f427xx, stm32f429xx, stm32f437xx and stm32f439xx devices stm32f446xx is used to refer to stm32f446xe and stm32f446xc devices l0 series: stm32l05xxx/06xxx is used to refer to stm32l051xx, stm32l052xx, stm32l053xx, stm32l062xx and stm3 2l063xx ultralow power devices. l1 series: stm32l1xxx6(8/b) is used to refer to stm32l1xxv6t6, stm32l1xxv6h6, stm32l1xxr6t6, stm32l1xxr6h6, stm32l1xxc6t6, stm32l1xxc6h6, stm32l1xxv8t6, stm32l1xxv8h6, stm32l1xxr8t6, stm32l1xxr8h6, stm32l1xxc8t6, stm32l1xxc8h6, stm32l1xxvbt6, stm32l1xxvbh6, stm32l1xxrbt6, stm32l1xxrbh6, st m32l1xxcbt6 and stm32l1xxcbh6 ultralow power devices. stm32l1xxx6(8/b)a is used to refer to stm32l1xxv6t6-a, stm32l1xxv6h6-a, stm32l1xxr6t6-a, stm32l1xxr6h6-a, stm32l1xxc6t6-a, stm32l1xxc6h6-a, stm32l1xxv8t6-a, stm32l1xxv8h6-a, stm32l1xxr8t6-a, stm32l1xxr8h6-a, stm32l1xxc8t6-a, stm32l1xxc8h6-a, stm32l1xxvbt6-a, st m32l1xxvbh6-a, stm32l1xxrbt6-a, stm32l1xxrbh6-a, stm32l1xxcbt6-a and stm32l1xxcbh6-a ultralow power devices. stm32l1xxxc is used to refer to stm32l1xxvct6, stm32l1xxvch6 , stm32l1xxrct6, stm32l1xxucy6, stm32l1xxcct6 and stm32l1xxccu6 ultralow power devices. stm32l1xxxd is used to refer to stm32l1xxzdt6, stm32l1xxqdh6, stm32l1xxvdt6, stm32l1xxrdy6, stm32l1xxrdt6, stm32l1xxzct6, docid13801 rev 21 13/155 AN2606 glossary 154 stm32l1xxqch6, stm32l1xxrcy6, stm32l1xxvct6-a and stm32l1xxrct6-a ultralow power devices. stm32l1xxxe is used to refer to stm32l1xxzet6, stm32l1xxqeh6, stm32l1xxvet6, stm32l1xxvey6 , and stm32l1xxret6 ul tralow power devices. l4 series: stm32l476xx/486xx is used to refer to stm32l476xe, stm32l476xg and stm32l486xg devices note: bl_usart_loop refers to the usart bootloader execution loop. bl_can_loop refers to the ca n bootloader execution loop. bl_i2c_loop refers to the i2c bootloader execution loop. bl_spi_loop refers to the spi bootloader execution loop. general bootloader description AN2606 14/155 docid13801 rev 21 3 general bootloader description 3.1 bootloader activation the bootloader is activated by applying one of these patterns: table 2. bootloader activation patterns note: the bootloader activation procedure is not the same for all stm32 products. in each stm32 product bootloader section we specify which pattern is used to execute bootloader. in addition to patterns described above, us er might execute bootloader by performing a jump to system memory from user code (refer to table 64 for system memory address). before jumping to bootloader user must: ? disable all peripheral clocks ? disable used pll ? disable interrupts ? clear pending interrupts system memory boot mode can be exited by getting out from bootloader activation condition and generating hardware reset or using go command to execute user code. note: for some products with dual bank mechanism, the jump to bootloader might result in jumping again to user code (and thus bootload er communication protoc ol is not executed). please refer to product's "dual bank boot implementation" flowchart for more details. i.e. in order to jump and execute bootloade r communication protocol, you might configure syscfg register by software to map system memory on a ddress 0x000000 00 prior to jumping, when this feature is available. patterns condition pattern1 boot0(pin) = 1 and boot1(pin) = 0 pattern2 boot0(pin) = 1 and nboot1(bit) = 1 pattern3 boot0 (pin)= 1, boot1(pin) = 0 and bfb2 (bit) = 1 boot0(pin) = 0, bfb2 (bit) = 0 and both banks don?t contain valid code boot0(pin) = 1, boot1(pin) = 0, bfb2 (bit) = 0 and both banks don?t contain valid code pattern4 boot0 (pin)= 1, boot1(pin) = 0 and bfb2 (bit) = 1 boot0(pin) = 0, bfb2 (bit) = 0 and both banks don?t contain valid code boot0(pin) = 1, boot1(pi n) = 0 and bfb2 (bit) = 0 pattern5 boot0 (pin)= 1, boot1(pin) = 0 and bfb2 (bit) = 0 boot0(pin) = 0, bfb2 (bit) = 1 and both banks don?t contain valid code boot0(pin) = 1, boot1(pi n) = 0 and bfb2 (bit) = 1 pattern6 boot0(pin) = 1, nboot1(bit) = 1 and nboot0_sw(bit) = 1 nboot0(bit) = 0, nboot1(bit) = 1 and nboot0_sw(bit) = 0 boot0(pin) = 0, nboot0_sw(bit) = 1 and main flash empty docid13801 rev 21 15/155 AN2606 general bootloader description 154 note: if you choose to execute the go command, t he peripheral registers used by the bootloader are not initialized to their default reset values before jumping to the user application. they should be reconfigured in the user application if they are used. so, if the iwdg is being used in the application, the iwdg prescaler value has to be adapted to meet the requirements of the application (since t he prescaler was set to its maximum value ). 3.2 bootloader identification depending on the stm32 device used, the bootloader may support one or more embedded serial peripherals used to download the code to the internal flash memory. the bootloader identifier (id) provides information abo ut the supported serial peripherals. for a given stm32 device, the bootloader is identified by means of the: 1. bootloader (protocol) version : version of the serial peripheral (usart, can, usb, etc.) communication protocol used in the bootloader. this version can be retrieved using the bootloader get version command. 2. bootloader identifier (id) : version of the stm32 device bootloader, coded on one byte in the 0xxy format , where: ? x specifies the embedded serial periphera l(s) used by the device bootloader: x = 1: one usart is used x = 2: two usarts are used x = 3: usart, can and dfu are used x = 4: usart and dfu are used x = 5: usart and i 2 c are used x = 6: i 2 c is used x = 7: usart, can, dfu and i 2 c are used x = 8: i 2 c and spi are used x = 9: usart, can, dfu, i 2 c and spi are used x = 10: usart, dfu and i 2 c are used x = 11: usart, i 2 c and spi are used x = 12: usart and spi are used x = 13: usart, dfu, i 2 c and spi are used ? y specifies the device bootloader version let us take the example of a bootloader id equal to 0x10. this means that it is the first version of the device bootl oader that uses only one usart. the bootloader id is programmed in the la st byte address - 1 of the device system memory and can be read by using the bootloader ?read memory? command or by direct access to the system memory via jtag/swd. the table below provides identification in formation about the bootloaders embedded in stm32 devices. general bootloader description AN2606 16/155 docid13801 rev 21 table 3. embedded bootloaders stm32 series device supported serial peripherals bootloader id bootloader (protocol) version id memory location f0 stm32f05xxx and stm32f030x8 devices usart1/usart2 0x21 0x1ffff7a6 usart (v3.1) stm32f03xxx usart1 0x10 0x1ffff7a6 usart (v3.1) stm32f04xxx usart1/usart2/ i2c1/ dfu (usb device fs) 0xa0 0x1ffff6a6 usart (v3.1) dfu (v2.2) i2c (v1.0) stm32f07xxx usart1/usart2/ i2c1/ dfu (usb device fs) 0xa1 0x1ffff6a6 usart (v3.1) dfu (v2.2) i2c (v1.0) f1 stm32f10xxx low-density usart1 na na usart (v2.2) medium-density usart1 na na usart (v2.2) high-density usart1 na na usart (v2.2) medium-density value line usart1 0x10 0x1ffff7d6 usart (v2.2) high-density value line usart1 0x10 0x1ffff7d6 usart (v2.2) stm32f105xx/107xx usart1 / usart2 (remapped) / can2 (remapped) / dfu (usb device) na na usart (v2.2 (1) ) can (v2.0) dfu(v2.2) stm32f10xxx xl-density usart1/usart2 (remapped) 0x21 0x1ffff7d6 usart (v3.0) f2 stm32f2xxxx usart1/usart3 0x20 0x1f ff77de usart (v3.0) usart1/usart3/ can2/ dfu (usb device fs) 0x33 0x1fff77de usart (v3.1) can (v2.0) dfu (v2.2) f3 stm32f373xx usart1/usart2/ dfu (usb device fs) 0x41 0x1ffff7a6 usart (v3.1) dfu (v2.2) stm32f378xx usart1/usart2/ i2c1 0x50 0x1ffff7a6 usart (v3.1) i2c (v1.0) stm32f302xb(c)/303xb(c) usart1/usart2/ dfu (usb device fs) 0x41 0x1ffff796 usart (v3.1) dfu (v2.2) stm32f358xx usart1/usart2/ i2c1 0x50 0x1ffff796 usart (v3.1) i2c (v1.0) stm32f301xx/302x4(6/8) usart1/usart2/ dfu (usb device fs) 0x40 0x1ffff796 usart (v3.1) dfu (v2.2) stm32f318xx usart1/usart2/ i2c1/ i2c3 0x50 0x1ffff796 usart (v3.1) i2c (v1.0) stm32f303x4(6/8)/334xx/328xx usart1/usart2/ i2c1 0x50 0x1ffff796 usart (v3.1) i2c (v1.0) docid13801 rev 21 17/155 AN2606 general bootloader description 154 f4 stm32f40xxx/41xxx usart1/usart3/ can2/ dfu (usb device fs) 0x31 0x1fff77de usart (v3.1) can (v2.0) dfu (v2.2) usart1/usart3/ can2 / dfu (usb device fs) /i2c1/i2c2/i2c3/spi1/ spi2 0x90 0x1fff77de usart (v3.1) can (v2.0) dfu (v2.2) spi(v1.1) i2c (v1.0) stm32f42xxx/43xxx usart1/usart3/ can2 /dfu (usb device fs) / i2c1/i2c2/i2c3 0x70 0x1fff76de usart (v3.1) can (v2.0) dfu (v2.2) i2c (v1.0) usart1/usart3/ can2 / dfu (usb device fs) / i2c1/i2c2/i2c3/spi1/ spi2/ spi4 0x90 0x1fff76de usart (v3.1) can (v2.0) dfu (v2.2) spi(v1.1) i2c (v1.0) stm32f401xb(c) usart1/usart2/ dfu (usb device fs)/ i2c1/i2c2/i2c3/ spi1/spi2/ spi3 0xd1 0x1fff76de usart (v3.1) dfu (v2.2) spi(v1.1) i2c (v1.0) stm32f401xd(e) usart1/usart2/ dfu (usb device fs)/ i2c1/i2c2/i2c3/ spi1/spi2/ spi3 0xd1 0x1fff76de usart (v3.1) dfu (v2.2) spi(v1.1) i2c (v1.1) stm32f411xx usart1/usart2/ dfu (usb device fs)/ i2c1/i2c2/i2c3/ spi1/spi2/ spi3 0xd0 0x1fff76de usart (v3.1) dfu (v2.2) spi(v1.1) i2c (v1.1) stm32f446xx usart1/usart3/ can2 / dfu (usb device fs) / i2c1/i2c2/i2c3/spi1/ spi2/ spi4 0x90 0x1fff76de usart (v3.1) can (v2.0) dfu (v2.2) spi(v1.1) i2c (v1.2) l0 stm32l05xxx/06xxx usart1/usart2/spi 1/ spi2 0xc0 0x1ff00ffe usart (v3.1) spi (v1.1) table 3. embedded bootloaders (continued) stm32 series device supported serial peripherals bootloader id bootloader (protocol) version id memory location general bootloader description AN2606 18/155 docid13801 rev 21 l1 stm32l1xxx6(8/b) usart1/usart2 0x20 0x1ff00ffe usart (v3.0) stm32l1xxx6(8/b)a usart1/usart2 0x20 0x1ff00ffe usart (v3.1) stm32l1xxxc usart1/usart2/ dfu (usb device fs) 0x40 0x1ff01ffe usart (v3.1) dfu (v2.2) stm32l1xxxd usart1/usart2/ dfu (usb device fs) 0x45 0x1ff01ffe usart (v3.1) dfu (v2.2) stm32l1xxxe usart1/usart2/ dfu (usb device fs) 0x40 0x1ff01ffe usart (v3.1) dfu (v2.2) l4 stm32l476xx/486xx usart1/usart2/ usart3/ i2c1/ i2c2/ i2c3/ dfu (usb device fs) 0xa3 0x1fff6ffe usart (v3.1) dfu (v2.2) i2c (v1.2) 1. for connectivity line devic es, the usart bootloader returns v2.0 instead of v2 .2 for the protocol version. for more details please refer to the ?stm32f105xx and stm32f107xx revision z? errata sheet available from http://www.st.com . table 3. embedded bootloaders (continued) stm32 series device supported serial peripherals bootloader id bootloader (protocol) version id memory location docid13801 rev 21 19/155 AN2606 general bootloader description 154 3.3 hardware connection requirements to use the usart bootloader, the host has to be connected to the (rx) and (tx) pins of the desired usartx interface via a serial cable. figure 1. usart connection 1. a pull-up resistor should be added, if pull- up resistor are not connected in host side. 2. an rs232 transceiver must be connected to adapt voltage level (3.3v - 12v) between stm32 device and host. note: +v typically 3.3 v and r value typically 1 00kohm.this value depend on the application and the used hardware. to use the dfu, connect the microcontroller's usb interface to a usb host (i.e. pc). figure 2. usb connection 1. this additional circuit permits to connect a pull-up resistor to (dp) pin using vbus when needed. refer to product section (table which describes stm32 configur ation in system memory boot mode) to know if an external pull-up resistor mu st be connected to (dp) pin. note: +v typically 3.3 v.this value depends on the application and the used hardware. h z d ,}?? ^ d d?? d]?}}v??}oo? z y d y d y z y ' e ' e z ^??? d?v?]? = s z z ? 0 6 y 9 0 6 9 h ^ ,}?? ^ d d?? d]?}}v??}oo? w d = s w d ' e ' e s ? x? < < ? < general bootloader description AN2606 20/155 docid13801 rev 21 to use the i2c bootloader, connect the host (m aster) and the desired i2cx interface (slave) together via the data (sda) and clock (scl) pins. a 1.8 kohm pull-up resistor has to be connected to both (sda) and (scl) lines. figure 3. i2c connection note: +v typically 3.3 v.this value depends on the application and the used hardware. to use the spi bootloader, conn ect the host (master) and the desired spix interface (slave) together via the (mos i), (miso) and (sck) pins. the (nss) pin must be connected to (gnd). a pull-down resistor should be connected to the (sck) line. figure 4. spi connection note: r value typically 10kohm. this value depe nds on the application and the used hardware. to use the can interface, the host has to be connected to the (rx) and (tx) pins of the desired canx interface via can transceiver and a serial cable. a 120 ohm resistor should be added as terminating resistor. 0 6 9 /? ,}?? ^ > ^ = s x? < x? < ^ > ^ ' e ' e ^ d d?? d]?}}v??}oo? 0 6 9 ^ w / ,}?? ^ d d?? d]?}}v??}oo? d k ^ / d / ^ k ' e e ^ ^ ^ < d k ^ / d / ^ k ' e ^ < z docid13801 rev 21 21/155 AN2606 general bootloader description 154 figure 5. can connection note: when a bootloader firmware supports dfu, it is mandatory that no usb host is connected to the usb peripheral during the selection phase of the other interfaces. after selection phase, the user can plug a u sb cable without impacting the selected bootloader execution except commands which generate a system reset. it is recommended to keep the rx pins of unused bootloader interfaces (usart_rx, spi_mosi, can_rx and usb d+/d- lines if presen t) at a known (low or high) level at the startup of the bootloader (detection phase). leav ing these pins floating during the detection phase might lead to activating unused interface. 3.4 bootloader memory management all write operations using bootloader command s must only be word-aligned (the address should be a multiple of 4). the number of data to be written must also be a multiple of 4 bytes (non-aligned half page write addresses are accepted). some products embed a bootloader that has some specific features: ? some products don?t support mass erase operation. to perform a mass erase operation using bootloader, two options are available: ? erase all sectors one by one using the erase command ? set protection level to level 1. then, set it to level 0 (using the read protect command and then the read unprotect command). this operation results in a mass erase of the internal flash memory. ? bootloader firmware of stm32 l1 and l0 series supports data memory in addition to standard memories (internal flash, internal sram, option bytes and system memory). the start address and the size of this area depend on the product, please refer to product reference manual for more information. data memory can be read and written but cannot be erased using the erase command. when writing in a data memory location, the bootloader firmware manages the erase operation of this location before any write. a write to data me mory must be word-aligned (address to be written should be a multiple of 4) and the number of data must also be a multiple of 4. to erase a data memory location, you can wr ite zeros at this location. ? bootloader firmware of stm32 f2, f4 and l4 series supports otp memory in addition to standard memories (internal flash, internal sram, option bytes and system memory). the start address and the size of this area depend on the product, please refer to product reference manual for more information. otp memory can be read and written but cannot be erased using erase command. when writing in an otp memory 0 6 9 e ,}?? ^ d d?? d]?}}v??}oo? z y d y d y z y ' e ' e e d?v?] ? e d?v?] ? ez , ez > ? ? general bootloader description AN2606 22/155 docid13801 rev 21 location, make sure that the relative protection bit (in the last 16 bytes of the otp memory) is not reset. ? for stm32 f2 and f4 series the internal flash write oper ation format depends on the voltage range. by default write operation ar e allowed by one byte format (half-word, word and double-word operations are not allowed). to increase the speed of write operation, the user should apply the adequate voltage range that allows write operation by half-word, word or double-word and upda te this configuration on the fly by the bootloader software through a virtual memory location. this memory location is not physical but can be read and written usin g usual bootloader read/write operations according to the protocol in use. this memory location contains 4 bytes which are described in table below. it can be accessed by 1, 2, 3 or 4 bytes. however, reserved bytes should remain at thei r default values (0xff), ot herwise the request will be nacked. table 4. stm32 f2 and f4 voltage range configuration using bootloader the table below lists the valid memory area depending on the bootloader commands. address size description 0xffff0000 1 byte this byte controls the current value of the voltage range. 0x00: voltage range [1.8 v, 2.1 v] 0x01: voltage range [2.1 v, 2.4 v] 0x02: voltage range [2.4 v, 2.7 v] 0x03: voltage range [2.7 v, 3.6 v] 0x04: voltage range [2.7 v, 3.6 v] and double word write/erase operation is used. in this case it is mandatory to supply 9 v through the vpp pin (refer to the product reference manual for more details about the double-word write procedure). other: all other values are not supported and will be nacked. 0xffff0001 1 byte reserved. 0xff: default value. other: all other values are not supported and will be nacked. 0xffff0002 1 byte reserved. 0xff: default value. other: all other values are not supported and will be nacked. 0xffff0003 1 byte reserved. 0xff: default value. other: all other values are not supported and will be nacked. table 5. supported memory area by write, read, erase and go commands memory area write command read command erase command go command flash supported supported supported supported ram supported supported not supported supported system memory not supported supported not supported not supported data memory supported supported not supported not supported otp memory supported supported not supported not supported docid13801 rev 21 23/155 AN2606 stm32f10xxx devices bootloader 154 4 stm32f10xxx devices bootloader 4.1 bootloader configuration the stm32f10xxx bootloader is activated by applying pattern1 (described in table 2: bootloader activation patterns ). the following table shows th e hardware resources used by this bootloader. the system clock is derived from the embedded internal high-speed rc, no external quartz is required for the bootloader execution. table 6. stm32f10xxx configuration in system memory boot mode bootloader feature/peripheral state comment usart1 bootloader rcc hsi enabled the system clock frequency is 24 mhz using the pll. ram - 512 bytes starting from address 0x20000000 are used by the bootloader firmware. system memory - 2 kbytes starting from address 0x1ffff000 contain the bootloader firmware. iwdg - the independent watchdog (iwdg) prescaler is configured to its maximum value and is periodically refreshed to prevent watchdog reset (in case the hardware iwdg option was previously enabled by the user). usart1 enabled once initialized, the usart1 configuration is: 8 bits, even parity and 1 stop bit. usart1_rx pin input pa10 pin: usart1 in reception mode usart1_tx pin output push-pull pa9 pin: usart1 in transmission mode systick timer enabled used to automatically detect the serial baud rate from the host. stm32f10xxx devices bootloader AN2606 24/155 docid13801 rev 21 4.2 bootloader selection the figure below shows the bootloader selection mechanism. figure 6. bootloader for stm32f10xxx with usart1 4.3 bootloader version the following table lists the stm32f10xxx devices bootloader versions: 0 6 9 6 \ v w h p 5 h v h w 6 \ v w h p , q l w & |