cancel
Showing results for 
Search instead for 
Did you mean: 

Recommended Practice for Programming Option Bits in Production

Brian H
Senior

I have a project that uses the nBOOT pin for GPIO output and cannot pull it in any direction during POR.  Therefore, the nSWBOOT0 bit needs to be programmed to 0 (its default is 1) before the code will function properly.

What is the recommended practice for programming option bits in a production environment?

I can't rely on, e.g., someone digging through menus in CubeProgrammer for each unit.

I could have my code test for the proper bits at startup and program them if needed (the accepted answer to this similar question), but that does not strike me as an ideal solution because:

  1. It's wasteful (permanent code in the firmware that only operates once in the device's lifetime)
  2. With nBOOT floating at boot, device behavior is unpredictable before nSWBOOT0 is programmed

Is there perhaps some sort of automation available in CubeProgrammer that would require minimal user interaction?

1 REPLY 1
TDK
Guru

Use a script that runs STM32CubeProgrammer CLI to change the option bytes, program the device, and verify in a single statement.

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