2022-02-21 02:01 AM
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:
then 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! :smiling_face_with_smiling_eyes:
2022-02-21 06:52 AM
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.
2022-02-21 08:30 AM
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!
2022-02-21 11:36 AM
2022-02-21 11:33 PM
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!