Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootloader on STM32F303: built in from factory or externally programmed?

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

like image 513
Pedro Ramilo Avatar asked Dec 18 '22 04:12

Pedro Ramilo


1 Answers

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.

like image 127
followed Monica to Codidact Avatar answered Dec 20 '22 16:12

followed Monica to Codidact