cancel
Showing results for 
Search instead for 
Did you mean: 

what are boot loader reserved pins for first programming?

PR.10
Associate III

Hi, I have a board with STM32G071KBU6N with new and empty flas.

I have difficulty programming it because it seems to set some pins as output after power up. for example PA6 and PB7. This is causing a over current in the circuit.

I suspect some kind of built in boot loader is running and doing this.

There is 100nF to gnd on reset pin without any pull resistor. I also tried add pull up and pull down on pb14/boot0 without any effect.

how to prevent the boot loader from running and keep all pins as inputs until the device is programmed?

Is it even possible or do I have to reserve some pins to be outputs because of this?

 

1 ACCEPTED SOLUTION
13 REPLIES 13
Kraal
Senior III

Hello,
We have the same issue currently (I made a post yesterday), but in our case we are still able to program our microcontroller and then the I/O conflict is done. I guess you are missing (like us) a series resistor somewhere.
What you see is that when the flash is empty (the first word is 0xFFFFFFFF) then the system bootloader is starting and configures what it needs as I/O, which can interfere with your design. I never saw that before with other STM32 uC (F0, L0 and L4) but maybe I was not paying attention since this state does not last long.

Check AN2606 which lists which pins are used for each interface for each microcontroller family.

Best regards,
Kraal

PA6 is SPxI_MISO and but PB7... there's I2C and maybe pullup is switched on, is this what you have in mind, or do you see PB7 pulled hard up?

Btw. on 'G0, you should also watch out for USBC Dead Battery related issues, although I don't know if the default bootloader does switch this off or not.

JW

PS. Thread started/mentioned by @Kraal above is here.

TDK
Guru

The G0 and C0 families have an empty-flash check where it will jump to the bootloader if the flash is empty. There is no way to avoid this. Other families don't do this.

If you feel a post has answered your question, please click "Accept as Solution".
Kraal
Senior III

@TDKF0 family does it as well, but only for F04x and F09x devices.

On the G0, there is a BOOT_LOCK bit in the FLASH_SECR register that disables completely the system bootloader, however one must first set the according option bytes. It seems that in conjunction with RDP level 1 it can make your device unrecoverable, depending on your application, so use with caution.

TDK
Guru

Looks like the F0, L0, L4, WB and WLE families have at least some chips do that do the empty check as well.

pattern 6
STM32F070x6
STM32F09xxx
STM32L01xxx/02xxx
STM32L412xx/422xx
STM32L43xxx/44xxx
STM32L45xxx/46xxx
STM32L496xx/4A6xx
STM32L4Rxxx/4Sxxx
STM32WB10xx/15xx

pattern 11
STM32C011xx
STM32C031xx
STM32G03xxx/STM32G04xxx
STM32G07xxx/08xxx
STM32G0B0xx
STM32G0B1xx/0C1xx
STM32G05xxx/061xx

pattern 13
STM32WLE5xx/55xx

pattern 16
STM32WB30xx/35xx/50xx/55xx

 

If you feel a post has answered your question, please click "Accept as Solution".

Hi Jan, thanks for the fast response.

It is difficult to verify what is output when soldered in to the circuit but at least PA6 seems to cause ~50mA short current.

According AN2606 it seems that PA6 is the main problem since it it set to 3V output.

STM32G071KBU6N does not have PB14.so perhaps the spi2 is not used by boot loader then?

It does not have PB10, BP11 either, but it does have 2 I2C, so I am wondering if the boot loader remaps it so some other pin? (not noticed that in the document)

It does have PB6 PB7 so I have to be careful about those.I assume the I2C only listens so it should not act as output, not even as "open drain" unless there is a valid message and it generates ack. Is that correct?

In that case the only real problem is SPI1 and PA6 and there need to be a serial resistor in the design.

Do you agree or did I miss something?

 

 

PR.10
Associate III

Hi you are correct. Unfortunately I was testing on nucleo before which was not empty so I have not noticed that. There should definitely be a bigger note somewhere, so I would not feel like an armature :-). I would prefer the spi output to enable only after a message like the uart output. that would be safer.

 

Is there a way to hold active reset from cube programmer before I click on connect? I do not have a reset button on the board so it would be nice if the the programmer could hold it low even before I enable power to the board and connect.