cancel
Showing results for 
Search instead for 
Did you mean: 

How to determine FLASH page size

jrd
Associate II
Posted on May 07, 2010 at 22:40

How to determine FLASH page size

8 REPLIES 8
Posted on May 17, 2011 at 13:50

Try DBGMCU_IDCODE pg 1034

http://www.st.com/stonline/products/literature/rm/13902.pdf

The built in boot-loader also returns an ID code, and there is the RAM/FLASH size at the end of the boot loader memory.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
swhite2
Associate III
Posted on May 17, 2011 at 13:50

Unfortunately DBGMCU_IDCODE is not reliable on all devices.On some it is 0 out of reset.

See the ''device limitations'' PDF's.

e.g.

''Debug registers cannot be read by user software

Description

The DBGMCU_IDCODE and DBGMCU_CR debug registers are accessible only in debug mode (not accessible by the user software). When these registers are read in user mode, the returned value is 0x00.

Workaround

None.''

mcuisp2
Associate II
Posted on May 17, 2011 at 13:50

The Flash Size Infomation At 0x1ffff7e0 contain the KB size of Flash,

if Flash>=128KB,then FLASH PAGE size is 2KB

if not , page size is 1KB

trevor23
Associate III
Posted on May 17, 2011 at 13:50

As per last post I use this C code:

#define FLASH_SIZE_IN_K_ADDRESS     0x1FFFF7E0

PageSize = ((*(u16*)FLASH_SIZE_IN_K_ADDRESS) > 128) ? 2048 : 1024;

jrd
Associate II
Posted on May 17, 2011 at 13:50

Trevor,

I thought I'd be able to use that, but the ST web site shows Connectivity Line devices, such as the STM32F105V8, with 64K of FLASH.  PM0042 reads:

''The memory organization is based on a main memory block containing 32 pages of 1 Kbyte (for low-density devices), 128 pages of 1 Kbyte (for medium-density devices), 128 pages of 2 Kbyte (for connectivity line devices) or 256 pages of 2 Kbyte (for high-density devices), ...''

I take from this that the Connectivity Line devices are available with as little as 64K of FLASH, but that the page size is still 2K.  This tells me that the memory size, in itself, does not imply a page size.

ST has NOT done a good job documenting this.  It doesn't have to be this ambiguous!

Justin

jrd
Associate II
Posted on May 17, 2011 at 13:50

James,

That's what I originally thought, too, but I haven't found anything in the ST documentation that actually states this.  How did you learn this?

Justin

Posted on May 17, 2011 at 13:50

''The memory organization is based on a main memory block containing 32 pages of 1 Kbyte (for low-density devices), 128 pages of 1 Kbyte (for medium-density devices), 128 pages of 2 Kbyte (for connectivity line devices) or 256 pages of 2 Kbyte (for high-density devices), ...''

I take from this that the Connectivity Line devices are available with as little as 64K of FLASH, but that the page size is still 2K.  This tells me that the memory size, in itself, does not imply a page size.

 

It tells you the 256KB version has 128 x 2KB pages, it makes no reference to your 64KB version. You would be better served looking in the ''Flash Loader Demonstrator'' application and it's MAP files, which does appear to confirm your belief that they all have 2KB pages.

[Product]

Name=STM32_Connectivity-line_64K

FlashSize=0040     ;;ADDR_FLASH_SIZE=1FFFF7E0;

RAMSize=0014       ;;ADDR_RAM_SIZE  =1FFFF7E2;

PacketSize=FF

ACKVAL=79

MAPNAME=Pages

PagesPerSector=2

family = 1;

[Page0]

Name=Page0

Index=00

Address=08000000

Size=00000800

Type=111

UFO=111

...

[Product]

Name=STM32_Connectivity-line_128K

FlashSize=0080     ;;ADDR_FLASH_SIZE=1FFFF7E0;

RAMSize=0020       ;;ADDR_RAM_SIZE  =1FFFF7E2;

PacketSize=FF

ACKVAL=79

MAPNAME=Pages

PagesPerSector=2

family = 1;

[Page0]

Name=Page0

Index=00

Address=08000000

Size=00000800

Type=111

UFO=111

...

[Product]

Name=STM32_Connectivity-line_256K

FlashSize=0100     ;;ADDR_FLASH_SIZE=1FFFF7E0;

RAMSize=0040       ;;ADDR_RAM_SIZE  =1FFFF7E2;

PacketSize=FF

ACKVAL=79

MAPNAME=Pages

PagesPerSector=2

family = 1;

[Page0]

Name=Page0

Index=00

Address=08000000

Size=00000800

Type=111

UFO=111

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
infoinfo976
Associate II
Posted on May 17, 2011 at 13:50