5

I have some background on ATMEL and ATMEL bootloaders and we are moving to ARM for a new project. In particular we will be using the STM32F303RET6. This essentially is a a Cortex M4 with a higher number of Analog input pins.

I have been going through the documentation regarding the bootloader and I am extremely confused:

On page 19 of the Getting Started Document it says the following:

"The embedded boot loader is located in the System memory, programmed by ST during production"

Furthermore application note AN2606, page 81 mentions this built in bootloader does not support programming over USB. (only UART, I2C or CAN)

However on other places over the Internet (such as this one, although for an F103) I've read about the need to program the bootloader using the ST-link V2 (ISP).

Among all this I'm quite confused so here are my questions:

  • Do STM32 chips actually come with a bootloader programmed from factory or not?
  • Is the factory embedded bootloader some form of failsafe, "always there" programming interface? Meaning I can later program a second bootloader?
  • The previous question forks to another one: if I use the ST-linkV2 programmer will I overwrite the factory programmed bootloader?
  • I am at a total loss regarding the BOOT1 selection bit. How am I supposed to set it if it's a logic feature of the processor? This seems like a chicken and egg problem.
  • Finally can I reflash this chip over USB or not? It appears I could but the STM32 documentation 1 says the embedde dbootloader programmed by ST can't. Do I need a different bootloader?

I know I am way confused and I'd really appreciate your help on this.

Thank you Pedro

Pedro Ramilo
  • 189
  • 2
  • 13
  • 1
    See https://electronics.stackexchange.com/questions/72274/still-struggling-with-the-stm32f051c8t6-bootloader – MSalters Sep 06 '17 at 13:20

1 Answers1

11

application note AN2606, page 81 mentions this built in bootloader does not support programming over USB. (only UART, I2C or CAN)

The title on page 81 says STM32F303x4(6/8)/334xx/328xx devices bootloader, but you say you have a STM32F303RE6. Look up table 36 on page 77 for your device.

Do STM32 chips actually come with a bootloader programmed from factory or not?

They do.

Is the factory embedded bootloader some form of failsafe, "always there" programming interface?

It's always there, you may think of it as a failsafe. The other failsafe is the JTAG/SWD debugger interface.

Meaning I can later program a second bootloader?

Yes you can. Then you can select which one to run by external pins.

if I use the ST-linkV2 programmer will I overwrite the factory programmed bootloader?

No, there is no danger, the internal one is write protected after production.

I am at a total loss regarding the BOOT1 selection bit. How am I supposed to set it if it's a logic feature of the processor?

BOOT0 and BOOT1 is an input pin. You set it from outside, using a pullup/pulldown resistor, switch, jumper, whatever your board provides. On my Discovery board, they are available on the pin headers.

Finally can I reflash this chip over USB or not?

According the Reference Manual, you can.

Do I need a different bootloader?

No, but you can have a different one, when you are not satisfied with the internal one. There is an example in the STM32CubeF3 library distribution, in Projects/STM32F303RE-Nucleo/Applications/USB_Device/DFU_Standalone.

  • 1
    I would add that the factory bootloader can be invoced by the user application as well (and then boot pin setting is ignored). – 0___________ Sep 06 '17 at 15:37
  • 1
    understand that the stlinkvwhatever is another microcontroller that speaks an st usb protocol then does SWD for you so it attacks your target mcu via SWD, you can use it for non ST parts likewise use non stlink swd solutions (jlink clones for a couple of bucks on ebay) with the st parts. the stlink is independent of the usb programming and bootloader on the target chip itself. – old_timer Sep 06 '17 at 17:46
  • note that some parts dont expose the boot1 pin. the small ones with 16 or so pins for example, the larger ones, esp the ones where that pin would matter, I would expect do. – old_timer Sep 06 '17 at 17:47
  • @old_timer: STM32F303RE6 is definitely a 64 pin part ("R" in the part number), BOOT0 has a dedicated pin, BOOT1 is shared with PB2. – followed Monica to Codidact Sep 06 '17 at 18:06
  • yep, just making a general comment about ST parts, for more well rounded knowledge... – old_timer Sep 06 '17 at 18:09
  • 1
    @berendi how did you determine that BOOT1 is shared with PB2? I am looking at the Pin description in the processor Datasheet and PB2 (pin 28 on LQFP64) does not make any reference to boot 1. Actually no pin references Boot 1. The only remark about this is "At startup, Boot0 pin and Boot1 __option bit__ are used to select one of three boot options:" It seems to be a case similar to the one described here https://electronics.stackexchange.com/questions/72274/still-struggling-with-the-stm32f051c8t6-bootloader . thank you very much for all your info! very helpful! – Pedro Ramilo Sep 07 '17 at 16:54
  • @PedroRamilo: right, it has only the option bit, does not expose BOOT1 on PB2 like other ST product lines do (except F0 and F3 as I've learned now). Makes some sense, because requiring a pullup or pulldown resistor on the pin would limit it's usefulness as an analog input. – followed Monica to Codidact Sep 07 '17 at 18:17
  • Changing BOOT1 is needed only when you want to start a program directly from the system RAM after reset. That's useful only for testing or debugging, and the ST-LINK software can change this option bit. – followed Monica to Codidact Sep 07 '17 at 19:02