2025-10-03 7:51 AM
Hi,
Currently my STM32F767 is coming up in dual bank mode (I'm not sure why, since this does not seem to be the default) but I want to turn this off so I get the full 2Mbytes.
However, I can see from AN4826 that if I turn off dual bank mode while the software is running, it's likely to crash because the flash width changes from 128 bit to 256 bit.
I thought there would be a way to set the bank mode in CubeIDE, but I cannot find it anywhere. If I use CubeIDE to program an image into flash, then that seems to effectively limit me to dual bank mode and only 1Mbyte of flash.
Can you advise me how I can turn off dual bank mode so that the image is programmed in by CubeIDE as a single-bank image?
Regards
Robin Terry
Solved! Go to Solution.
2025-10-06 6:04 AM - edited 2025-10-06 8:12 AM
Hi MOBEJ,
I replaced CubeProgrammer with STLink Utility, and this allows me to change the nDBANK bit.
However, even with nDBANK set to zero, erasing a bank2 sector (sector 12) does not work. It does not give an error, but the flash is not blank. Can you please suggest why this is not working?
Regards
Robin Terry
2025-10-03 8:32 AM
Hello @robinterry-minicam
To switch from dual-bank to single-bank mode , we recommend using STM32CubeProgrammer to modify the flash option bytes by :
1- Connect your device to your PC and open STM32CubeProgrammer.
2- Navigate to the Option Bytes tab on the left sidebar (highlighted as "OB" in the image).
3- Under User Configuration, locate the option named nDBANK.
4- You will see that:
When unchecked, the device operates in dual bank mode with 128-bit read access.
When checked, the device operates in single bank mode with 256-bit read access.
5- To disable dual bank mode, check the nDBANK box to enable single bank mode.
6- Click Apply to program the option bytes.
Br
2025-10-06 12:25 AM
Hi MOBEJ,
Many thanks for your helpful response.
I would still like a little more clarification on this. I have been using CubeIDE on its own quite happily, and I have only just downloaded CubeProgrammer as a result of this answer. How do the two work together?
I'm concerned that the nDBANK setting is only set temporarily from CubeProgrammer, and does not seem controllable from CubeIDE, so how would I ensure that the nDBANK setting I require is preserved across reboots/power downs?
Regards
Robin Terry
2025-10-06 1:31 AM
Hi MOBEJ,
I've just tried erasing the flash sector at 0x08100000 (sector 12) with nDBANK set to 1, and I still get a write-protect error. However, if I do the same to sector 11 (0x080E0000) or any other sector in the first bank, it works fine.
Can you tell me what I'm doing wrong here?
Regards
Robin Terry
2025-10-06 1:42 AM
Also, the nWRP bits are all set to 1.
2025-10-06 2:23 AM
Hi MOBEJ,
Now I am having programs reconnecting using CubeProgrammer. It worked the first time I tried it, but now, I click on Connect, and it simply does not connect, even though the Connect button is faded out.
I have rebooted my laptop and the target, but this has made no difference.
2025-10-06 2:32 AM
In addition, the Option Bytes icon no longer displays the bars at the top (including "User Configuration").
2025-10-06 6:04 AM - edited 2025-10-06 8:12 AM
Hi MOBEJ,
I replaced CubeProgrammer with STLink Utility, and this allows me to change the nDBANK bit.
However, even with nDBANK set to zero, erasing a bank2 sector (sector 12) does not work. It does not give an error, but the flash is not blank. Can you please suggest why this is not working?
Regards
Robin Terry
2025-10-06 8:13 AM
I've worked out that the particular STM32F767 we are using is the 1 Mbyte variant, not the 2 Mbyte variant. So the bank locations are different.