cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeProgrammer doesn't show DBANK option byte

SDpy.1
Associate II

Hi !

I'm using STM32CubeProgrammer v2.12.0 (according to the updater it is the latest at this time) and I want to enable Dualbank on my Nucleo board.

The Nucleo board is a NUCLEO-L476RG and is correctly recognized as such:


_legacyfs_online_stmicro_images_0693W00000bhiDwQAI.png 

However in the Option bytes -> User Configuration tab, the DUALBANK option is missing:


_legacyfs_online_stmicro_images_0693W00000bhiELQAY.png 

The BFB2 option is present though, but as I understand it:

  • DUALBANK controls whether or not the flash is divided into 2 banks
  • BFB2 controls which bank to use in case DUALBANK is set

Am I right ?

In any case, shouldn't DUALBANK be shown since it is user configurable ?

Thanks in advance !

1 ACCEPTED SOLUTION

Accepted Solutions
FBL
ST Employee

Hello @SDpy.1​,

According to the reference manual, section 3.4 FLASH option bytes, DUALBANK Option Byte is present on 512 KB or 256 KB Flash memory devices. However, STM32L476RG MCU is 1MB Flash.

BFB2 controls dual bank boot not bank selection. Please refer to the reference manual or this post for further explanation.

Hope this helps!

Firas

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.


I'm out of offce with limited access to my emails.
Happy New Year!

View solution in original post

4 REPLIES 4
FBL
ST Employee

Hello @SDpy.1​,

According to the reference manual, section 3.4 FLASH option bytes, DUALBANK Option Byte is present on 512 KB or 256 KB Flash memory devices. However, STM32L476RG MCU is 1MB Flash.

BFB2 controls dual bank boot not bank selection. Please refer to the reference manual or this post for further explanation.

Hope this helps!

Firas

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.


I'm out of offce with limited access to my emails.
Happy New Year!
SDpy.1
Associate II

Hi !

Thanks for your reply, I just read the posts and also the RM you mentioned. Things are still not very clear, and based on the different posts on this subject, I think I am not alone in this case.

So there seems to be 3 different bits of configuration:

  • FB_MODE in SYSCFG: tells which bank is currently running. It is RW so do I need to manipulate it if I am on Bank1 and want to reboot into Bank2, or vice versa ?
  • DUALBANK option byte for <=512kB flash memory devices, to enable dualbank ?
  • BFB2 option byte, its description seems to be the same as DUALBANK so that's really confusing

My assumptions are:

DUALBANK is always implicitly enabled for >512kB flash memory devices, so that's why there is no need for a DUALBANK option byte on those devices. On smaller flash size devices, we need to explicitly enable it by setting this option byte.

You say that BFB2 controls dual bank boot, not boot bank, so what's the difference with DUALBANK for <= 512kB devices ? Does it replace DUALBANK for >512kB devices ?

In my software, if I just want to swap banks, i.e reboot into the other bank without caring about which bank I'm currently in, which register to need to manipulate. DUALBANK (on <= 512kB devices) ? BFB2 ? FB_MODE ?

FBL
ST Employee

Hello @SDpy.1​,

Thank you for your feedback.

Let me clarify some points:

  1. For flash memory size <= of 512kB, we need to set the DUALBANK option byte to enable dual bank implementation.
  2. For flash memory sizes > than 512kB, we can use the BFB2 option byte to configure the boot bank selection. If we need to run firmware from bank2 then BFB2 option byte need to be configured, or the boot will be always from bank 1.
  3. FB_MODE in SYSCFG can be used in run time to swap flash banks if needed.

BFB2 flag essentially triggers the attempt to boot from Bank2 on reset. See AN4767 section 3.1.3 BFB2 flag in user option bytes. 

It is important to keep BFB2 flag set when there is no code in Bank1, thus being safe in case of unexpected power failures.

With BFB2 set, the system bootloader is activated to evaluate if a code is present in Bank2 and then puts it in control, as explained in AN2606. Then, the firmware has to detect that the code in Bank1 must be replaced, and that the process is running from Bank2.

Hope this answers your questions!

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.


I'm out of offce with limited access to my emails.
Happy New Year!
SDpy.1
Associate II

Thanks for your clarification !