Skip to main content
dmarks-ls
Associate III
February 24, 2025
Solved

STM32U073 - Can you bootload a factory-new device?

  • February 24, 2025
  • 4 replies
  • 1459 views

I have on my desk an STM32F407 Discovery board and an STM32U083 Nucleo board.  My intent is to write software for the F407 to bootload the U083 via I2C.  As far as I can tell, these are the general steps:

  1. Drive BOOT0 high and pulse the NRST pin on the U083 to enter the bootloader.
  2. Send appropriate erase/write/read commands to reprogram flash.
  3. Drive BOOT0 low and pulse the NRST pin to have the U083 boot from flash.

Problem is, I can't even seem to do step 1.  I have a logic analyzer verifying NRST and BOOT0 at the U083 chip, but regardless of the state of BOOT0, if I reset the U083, it boots from flash (i.e. I see my debug output on the UART).

Looking at RM0503, section 2.5 Boot configuration, Table 6 Boot modes, there are two ways to boot into system memory.  Summarizing the table's logic conditions:

  1. BOOT_LOCK bit must be 0.
  2. nBOOT1 bit must be 1.
  3. If nBOOT_SEL bit is 0, BOOT0 pin must be 1.
  4. If nBOOT_SEL bit is 1, nBOOT0 bit must be 0.

Here are the option bytes and their factory default values:

option_bytes_1.pngoption_bytes_2.png

BOOT_LOCK, naturally, defaults to 0, so that's fine.  But all of the other bits default to 1, including nBOOT_SEL, which needs to be 0 to allow BOOT0 to do, well, anything.

Am I correct in that it's not possible to bootload a U083 device via I2C unless you've touched it at least once with a programmer and cleared the nBOOT_SEL bit?  (If so, that's extremely annoying for our rev. A prototype.)

Dana M.

Best answer by mƎALLEm

Hello,

This is an answer from our expert:

STM32U0 remains using pattern 11 but:

BOOT_LOCK(bit) = 0, nBoot1(bit) = 1, Boot0(pin) = 1 and nBOOT0_SEL(bit) = 1
must be changed to
BOOT_LOCK(bit) = 0, nBoot1(bit) = 1, Boot0(pin) = 1 and nBOOT0_SEL(bit) = 0

AN2606 will be updated accordingly.

4 replies

Pavel A.
Super User
February 24, 2025

Some STM32 models have special device to allow first time programming by the built-in bootloader: if the user flash is "empty" (few first bytes are 0xFF) the MCU starts the built-in bootloader no matter what is state of BOOT0. Test whether your U0's behave this way. 

 

TDK
Super User
February 24, 2025

As @Pavel A. suggests, the chip will boot into the bootloader if flash is erased. Per AN2606, relevant table entry for STM32U071 is Pattern 11. Third match is what happens on a fresh chip.

TDK_0-1740441313656.png

 

"If you feel a post has answered your question, please click ""Accept as Solution""."
dmarks-ls
dmarks-lsAuthor
Associate III
February 25, 2025

... those sneaky gits.  They updated the app note.

AN2606 revision 63/64 (I have a partial printed copy here):

AN2606 rev 63.png

AN2606 revision 65 (February 14, 2025):

AN2606 rev 65.png

Reading the revision notes, apparently this rates as "Minor text edits across the whole document".  However... I'm not convinced it was a correction.  If I chip erase my U083 Nucleo, put nBOOT_SEL back to 1 (as it would be from the factory), and then try to engage the bootloader, I still can't do it; I get NAKs on I2C.  If I set nBOOT_SEL to 0 and retry, I get the bootloader version just fine.

So I guess my question now is... was ST correct the first time, and the U083/U073 really is Pattern 15, with no allowance for empty flash?  Or am I still doing something wrong?  A chip erase via ST/LINK is all that's needed to qualify as "empty flash", yes?

Dana M.

TDK
Super User
February 25, 2025

Pretty sure the "flash erase check" is done on power-on, not at reset, and requires a power cycle to refresh. Just erasing won't trigger it.

 

"If you feel a post has answered your question, please click ""Accept as Solution""."
mƎALLEm
Technical Moderator
February 28, 2025

Hello,

Internal ticket 204219 opened for follow-up. Not accessible by the community users.

"To give better visibility on the answered topics, please click on ""Accept as Solution"" on the reply which solved your issue or answered your question."
dmarks-ls
dmarks-lsAuthor
Associate III
April 9, 2025

Hi Meallem,

Has there been any update on this?  Can you confirm that the STM32U073/U083 is Pattern 15, not Pattern 11?  Thanks.

Dana M.

mƎALLEm
Technical Moderator
April 10, 2025

I'm still waiting an answer.

I will let you know as soon as I have any feedback.

Thank you for your patience.

"To give better visibility on the answered topics, please click on ""Accept as Solution"" on the reply which solved your issue or answered your question."
mƎALLEm
mƎALLEmBest answer
Technical Moderator
June 25, 2025

Hello,

This is an answer from our expert:

STM32U0 remains using pattern 11 but:

BOOT_LOCK(bit) = 0, nBoot1(bit) = 1, Boot0(pin) = 1 and nBOOT0_SEL(bit) = 1
must be changed to
BOOT_LOCK(bit) = 0, nBoot1(bit) = 1, Boot0(pin) = 1 and nBOOT0_SEL(bit) = 0

AN2606 will be updated accordingly.

"To give better visibility on the answered topics, please click on ""Accept as Solution"" on the reply which solved your issue or answered your question."
dmarks-ls
dmarks-lsAuthor
Associate III
June 25, 2025

@mƎALLEm wrote:

Hello,

This is an answer from our expert:

STM32U0 remains using pattern 11 but:

BOOT_LOCK(bit) = 0, nBoot1(bit) = 1, Boot0(pin) = 1 and nBOOT0_SEL(bit) = 1
must be changed to
BOOT_LOCK(bit) = 0, nBoot1(bit) = 1, Boot0(pin) = 1 and nBOOT0_SEL(bit) = 0

AN2606 will be updated accordingly.


The correction makes sense.  However, I still dispute that the U0 is pattern 11.  @TDK pointed out the definition of Pattern 11 earlier in the thread:

Existing definition of Pattern 11Existing definition of Pattern 11

According to this chart, if the device is not locked, and neither the nBOOT0_SEL nor nBoot0 bits have been programmed (i.e. they are each set to 1 from the factory), then if the main flash is empty, the bootloader should start automatically.  Based on my previous testing, I did not find this to be the case.

Has your expert confirmed that a factory-new U083 or U073, when powered up, automatically enters the bootloader?

Dana M.