Skip to main content
Pkhot.1
Visitor II
March 8, 2021
Solved

What are the prerequisites to disable DBANK(dual to single bank mode)..??

  • March 8, 2021
  • 1 reply
  • 1436 views

We are using STM32L5 Nucleo board and TZEN is enabled and DBANK mode is enabled too..!

How to switch dual bank mode to single bank mode in option bytes(if any h/w or s/w changes)??

Please explain the procedure to understand what are the changes needed to be done before I uncheck DBANK option byte in Cube programmer...?

This topic has been closed for replies.
Best answer by Imen.D

Hello @Pkhot.1​ and welcome to the STM32 Community =)

To disable DBANK and switch from DBANK=1 to DBANK=0 (from dual bank to single) it is recommended to execute the code from the SRAM or use the bootloader.

To avoid reading corrupted data from the Flash when the memory organization is changed, any access (either CPU or DMAs) to Flash memory should be avoided before reprogramming.

  • If any secure Flash protection is enabled (watemark or block-based), all must be disabled.
  • Disable the instruction cache if it is enabled
  • Clear the DBANK option bit and all WRP write protection (follow user option modification and option bytes loader procedure).
    • Once OBL is done with DBANK=0, perform a mass erase.
    • Start a new programing of code in 128 bits mode with DBANK=0 memory mapping.
    • Set the new secure protection if needed.

This is applicable when TZEN is disabled or enabled, with a small difference when TZEN = 1 being that the DBANK can only be modified when all secure protections are disabled : secure watermark (SEC WM) or block-based area (SECBB) .

For more details, you can refer to the RM0438 :

  • De-activating dual-bank mode (switching from DBANK=1 to DBANK=0) (page 194)
  • Rules for modifying specific option bytes (page 195)

Please mark my answer as best by clicking on the "Select as Best" button, if it answered your question :smiling_face_with_smiling_eyes: This will help other users find this solution more quickly.

Imen

1 reply

Imen.DBest answer
Technical Moderator
March 10, 2021

Hello @Pkhot.1​ and welcome to the STM32 Community =)

To disable DBANK and switch from DBANK=1 to DBANK=0 (from dual bank to single) it is recommended to execute the code from the SRAM or use the bootloader.

To avoid reading corrupted data from the Flash when the memory organization is changed, any access (either CPU or DMAs) to Flash memory should be avoided before reprogramming.

  • If any secure Flash protection is enabled (watemark or block-based), all must be disabled.
  • Disable the instruction cache if it is enabled
  • Clear the DBANK option bit and all WRP write protection (follow user option modification and option bytes loader procedure).
    • Once OBL is done with DBANK=0, perform a mass erase.
    • Start a new programing of code in 128 bits mode with DBANK=0 memory mapping.
    • Set the new secure protection if needed.

This is applicable when TZEN is disabled or enabled, with a small difference when TZEN = 1 being that the DBANK can only be modified when all secure protections are disabled : secure watermark (SEC WM) or block-based area (SECBB) .

For more details, you can refer to the RM0438 :

  • De-activating dual-bank mode (switching from DBANK=1 to DBANK=0) (page 194)
  • Rules for modifying specific option bytes (page 195)

Please mark my answer as best by clicking on the "Select as Best" button, if it answered your question :smiling_face_with_smiling_eyes: This will help other users find this solution more quickly.

Imen

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks