cancel
Showing results for 
Search instead for 
Did you mean: 

STM32G474QB STM32G474QC flash organization

FValm.1
Associate III

I'm trying to understand how flash memory is organized for STMN32G474QB or STM32G474QC flash. I don't have the micros till now so I cannot do any test to understand that.

From the RM0440 manual it seems both are in category 3 device. But when I look at the table displaying the flash organization:

0693W00000KZtUHQA1.pngthen I'm confused if they are organized as a single bank when, dual bank is selected (256 Kbyte for QC and 128 Kbyte for QB), or divided in two bank but I can't figure out which size would have each bank in that case. I guess that only one the first bank is enabled but I'm not sure about that. Or simply there is no option for dual bank for those devices? In that case each page would be 4 Kbyte size...

Hope someone can help me to cancel my doubts! 😊

4 REPLIES 4
TDK
Guru

In dual bank mode:

For a 256kB flash chip, you have two 128kB banks with a gap in the middle.

For a 128kB flash chip, you have two 64kB banks with a gap in the middle.

Page size is always 2kB.

Banks always start at the location given in the table.

In single bank mode, you have all the memory at 0x08000000 with no gap.

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

Thank you TDK!

Can I ask you something more? I have understood that by default the micro chip is programmed (by ST) so that to manage two banks and the configuration is like you have described in you answer.

Now I have the following problem: I have implemented a program in a host PC which communicates to my STM32G chip via USB and program it via DFU protocol (exposed by the internal bootloader of the micro). I would like to program the flash as a single bank (256 or 128 KBytes depending on the chip). Do you think it is possible to change the OB bytes prior to program the flash so that to see in a continuous way the flash and program that in a unique mode for bot the 2 chip (except for the size obviously)? Thanks in advance!

I don't have a lot of experience switching between these modes. I imagine it can be done, but I also imagine it will be a lot easier to program the option bytes only once and stick with the same mode. If you want a contiguous space, single bank mode seems like a good choice. You already have a bootloader so the utility of having a second bank to swap to new firmware seems unnecessary.
If you feel a post has answered your question, please click "Accept as Solution".
FValm.1
Associate III

Yes, that would be my purpose. I really don't understand why ST did the choice to program by default the chip so that to see the flash as dual bank. Considering also that the linker file (the .ld file produced by STM32CubeIde when you compile the project) doesn't take into account that default and flash memory results organized as a unique bank in the memory map. Anyway I will test what's going on if I change the option byte containing the DBANK property before programming the flash. All these operation should be performed by a PC connected with the micro via USB in DFU mode. Hope it works!