1
\$\begingroup\$

I am trying to learn more about the STM32's FLASH memory (on the Nucleo-64 STM32L433RCT6P) so that I can use a page of the FLASH memory to store some user configuration (so that the data is retained even when power is not supplied to the microcontroller).

Page 1 of the datasheet states that the STM32L433RCTxP has 256KB of Flash memory. In Page 85 of the same datasheet, the FLASH memory goes up to 0x0803_FFFF. The Keil toolchain that I am using also states that there is 256KB of Flash memory on this board, also confirmed by the address range (0x0803_FFFF - 0x0800_0000 = 0x03_FFFF = 262143 in base10/decimal):

Flash Memory on Keil Settings/Configuration

Page 78 of the Reference Manual tells something different regarding the FLASH memory of the STM32L43xx family device, where some regions of the address range above are not available to use as FLASH memory. On that page, only Pages 0-3, Page 63, Page 127, and Page 255 of the FLASH memory are usable, with 2KB of FLASH per page (14KB combined total FLASH for those pages). The Address range also extends up to 0x0807_FFFF, and not 0x0803_FFFF.

The Memory Map in page 67 of the Reference Manual actually lists the whole 0x0800_0000 to 0x0807_FFFF as FLASH memory, but
this would mean that there is actually 512KB of FLASH on the board. There is also some FLASH memory from the region 0x0000_0000 to 0x0008_0000.

How much FLASH memory does the STM32L433 Nucleo-64 has? If I were to follow the datasheet where the FLASH goes up to 0x0803_FFFF only, and parts of the RM that states only Pages 0-3, 63, and 127 are available as FLASH memory, does that mean that this board has 12KB usable FLASH memory?

Thanks!

\$\endgroup\$
3
\$\begingroup\$

You're completely misinterpreting page 78 of the reference manual.
Firstly, that document applies to more than just your 256kB STM32L433 - it also applies to 128kB and 512kB devices in the same family.
Secondly, Table 8 does not list every identical page of 2k flash. There is flash between pages 3 and 63, and between 63 and 127, and between 127 and 255 (depending on if the specific device in the family has that much flash). Listing them all would simply be a waste of space.
You'll also notice that the lines for 63, 127 & 255 each have a superscript number which refers to the notes immediately underneath the table telling you that these are the end pages for each device variant.

The datasheet for your specific STM32L433 part is correct and unambiguous in stating that it has 256kB of flash.
The reference manual for the family of which your STM32L433 is just one member does not contradict the datasheet.

\$\endgroup\$
4
  • \$\begingroup\$ Thanks for the explanation! I noticed the superscript notes previously, but did not understood what it referred to, glad you gave an explanation on that too! \$\endgroup\$ – Cimory Nov 6 '20 at 10:42
  • 1
    \$\begingroup\$ Since the last section of the FLASH memory is Page 127 for my device, would using that FLASH page for user configuration variables be safe? I read somewhere on this site that using the last sector/page of the FLASH memory is normally safe. Also, if I were to use that FLASH sector, do I exclude that page's address range on the Keil's settings in the picture above? Or would I modify the scatter file that can be generated through Keil? Thanks! \$\endgroup\$ – Cimory Nov 6 '20 at 10:47
  • 1
    \$\begingroup\$ I don't use Keil, but my recommendation would be to leave those settings as they are, and change the scatter file to exclude the page you're going to use for your config variables from the space allocated for code. You still want Keil to 'know about' that page so that you can refer to it and place variable there, just not use it for code. \$\endgroup\$ – brhans Nov 6 '20 at 14:58
  • \$\begingroup\$ Thanks for the suggestion! I'll try that \$\endgroup\$ – Cimory Nov 6 '20 at 21:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.