LPC551x usable on-chip flash - last usable on-chip flash address

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPC551x usable on-chip flash - last usable on-chip flash address

Jump to solution
1,406 Views
danielgull
Contributor IV

References:
- Product Datasheet LPC55S1x/LPC551x Rev. 1.3 - 21 September 2020 page 1 Chapter 2 "Features and benefits"
- LPC55S1x/LPC551x User manual Rev. 1.3 - 16 July 2020 page 4 Chapter 1.2 "Features"
- "Up to 256 kB on-chip flash program memory with flash accelerator and 512 byte page erase and write."

- Product Datasheet LPC55S1x/LPC551x Rev. 1.3 - 21 September 2020 page 47 Table 6 "Memory map overview"
- LPC55S1x/LPC551x User manual Rev. 1.3 - 16 July 2020 page 12 Table 4 "Memory map overview"
- "The last 17 pages (12 KB) are reserved on the 256KB flash devices resulting in 244 KB internal flash memory."

The available on-chip flash with start address 0x00000000 to end address 0x0003FFFF results in 262144 Bytes of on chip flash.

However the last 17 pages are reserved and cannot be used.
With a page size of 512 bytes this results in 17 x 512 = 8704 bytes of on chip flash that cannot be used.

The available on-chip flash with start address 0x00000000 to end address 0x0003DDFF results in 253440 Bytes (i.e. 262144 - 17 x 512 = 253440) of on chip flash that can be used.

How do I match 8704 bytes to 12 KB?
How do I match 253440 bytes to 244 KB?

Am I missing something here?
I cannot comprehend the sentence

"The last 17 pages (12 KB) are reserved on the 256KB flash devices resulting in 244 KB internal flash memory."

Please elaborate and help me understand which is the last usable on-chip flash address.

Labels (1)
0 Kudos
1 Solution
1,403 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello danielgull,

The correct is "LPC55(S)16 it is 244Kbytes for user application, 12Kbytes for PFR region. ".

You can also use ROM api FLASH_GetProperty() to read, refer to flashaip demo under SDK:

/* Get flash properties kFLASH_ApiEraseKey */
FLASH_GetProperty(&flashInstance, kFLASH_PropertyPflashBlockBaseAddr, &pflashBlockBase);
FLASH_GetProperty(&flashInstance, kFLASH_PropertyPflashSectorSize, &pflashSectorSize);
FLASH_GetProperty(&flashInstance, kFLASH_PropertyPflashTotalSize, &pflashTotalSize);
FLASH_GetProperty(&flashInstance, kFLASH_PropertyPflashPageSize, &PflashPageSize);

/* print welcome message */
PRINTF("\r\n PFlash Example Start \r\n");
/* Print flash information - PFlash. */
PRINTF("\tkFLASH_PropertyPflashBlockBaseAddr = 0x%X\r\n", pflashBlockBase);
PRINTF("\tkFLASH_PropertyPflashSectorSize = %d\r\n", pflashSectorSize);
PRINTF("\tkFLASH_PropertyPflashTotalSize = %d\r\n", pflashTotalSize);
PRINTF("\tkFLASH_PropertyPflashPageSize = 0x%X\r\n", PflashPageSize);

 

 

br

Alice

View solution in original post

0 Kudos
4 Replies
1,319 Views
danielgull
Contributor IV

The LPC5516 divides the internal flash into 8 uniform 32 kByte sectors:
- 0x0000'7FFF..0x0000'0000 Sector 1 with 32768 bytes (64 x 512 bytes)
- 0x0000'FFFF..0x0000'8000 Sector 2 with 32768 bytes (64 x 512 bytes)
- 0x0001'7FFF..0x0001'0000 Sector 3 with 32768 bytes (64 x 512 bytes)
- 0x0001'FFFF..0x0001'8000 Sector 4 with 32768 bytes (64 x 512 bytes)
- 0x0002'7FFF..0x0002'0000 Sector 5 with 32768 bytes (64 x 512 bytes)
- 0x0002'FFFF..0x0002'8000 Sector 6 with 32768 bytes (64 x 512 bytes)
- 0x0003'7FFF..0x0003'0000 Sector 7 with 32768 bytes (64 x 512 bytes)
- 0x0003'8000..0x0003'FFFF Sector 8 with 32768 bytes (64 x 512 bytes)

Sector number 8 is a bit special:
- 0x0003'8000..0x0003'CFFF --> 40 x 512 bytes are physcially available according to rom flash API
- 0x0003'D000..0x0003'D7FF --> 4 x 512 bytes seem physically unavailable and not accessible
- 0x0003'D800..0x0003'DDFF --> 3 x 512 bytes seem physcially available and accessible
- 0x0003'DE00..0x0003'FFFF --> 17 x 512 bytes "The last 17 pages are reserved and cannot be used"

0 Kudos
1,319 Views
danielgull
Contributor IV

My finding above - I hope this helps

0 Kudos
1,404 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello danielgull,

The correct is "LPC55(S)16 it is 244Kbytes for user application, 12Kbytes for PFR region. ".

You can also use ROM api FLASH_GetProperty() to read, refer to flashaip demo under SDK:

/* Get flash properties kFLASH_ApiEraseKey */
FLASH_GetProperty(&flashInstance, kFLASH_PropertyPflashBlockBaseAddr, &pflashBlockBase);
FLASH_GetProperty(&flashInstance, kFLASH_PropertyPflashSectorSize, &pflashSectorSize);
FLASH_GetProperty(&flashInstance, kFLASH_PropertyPflashTotalSize, &pflashTotalSize);
FLASH_GetProperty(&flashInstance, kFLASH_PropertyPflashPageSize, &PflashPageSize);

/* print welcome message */
PRINTF("\r\n PFlash Example Start \r\n");
/* Print flash information - PFlash. */
PRINTF("\tkFLASH_PropertyPflashBlockBaseAddr = 0x%X\r\n", pflashBlockBase);
PRINTF("\tkFLASH_PropertyPflashSectorSize = %d\r\n", pflashSectorSize);
PRINTF("\tkFLASH_PropertyPflashTotalSize = %d\r\n", pflashTotalSize);
PRINTF("\tkFLASH_PropertyPflashPageSize = 0x%X\r\n", PflashPageSize);

 

 

br

Alice

0 Kudos
1,327 Views
mse_videotec
Contributor I

Hello Alice

I have a question:

In the project settings menù of the LPC5516 we found that the size of the Flash is 0x38000 that is 224KByte instead of 244KByte.

Capture1.PNG

What is the right flash dimension?

Many thanks

Mirco

0 Kudos