Flash sector sizes

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 
9,894件の閲覧回数
mjbcswitzerland
Specialist V

Hi All

 

I am trying to work out the FLASH sectors sizes in all of the Kinetis parts.

 

What I know is:

- The 100MHz 512k parts have 2k Flash sector size and use the long word programming command when writing

- The 120MHz FPU 1M parts have 4k Flash sector size and don't support the long word programming command but instead the "phrase" programming command (8 bytes)

 

However I don't find the sector size specified in either the user manual or the data sheets (apart from some timing which have 4k in brackets which is probably pointing out that the is the sector size that the timing refers to).

 

Unsure is whether FPU devices with smaller Flash sizes use 2k or 4k sectors. Or whether non-FPU types with 1M (if they exist) will have 2k or 4k?

 

Anyone know the details?

 

Regards

 

Mark

 

0 件の賞賛
返信
1 解決策
4,104件の閲覧回数
DavidS
NXP Employee
NXP Employee

Joe is correct.

The Reference Manual for the specific device mentions the flash sector size in Chapter 3 with subtitle "Flash Memory Sizes".

Example:

K10P32M50SF0RM.pdf has following

• 1 block of program flash consisting of 1 KB sectors

• 1 block of FlexNVM consisting of 1 KB sectors

• 1 block of FlexRAM

K60P144M100SF2RM.pdf has following

• For devices with program flash only: 2 blocks of program flash consisting of 2 KB

sectors

• For devices that contain FlexNVM: 1 block of program flash consisting of 2 KB

sectors

• For devices that contain FlexNVM: 1 block of FlexNVM consisting of 2 KB sectors

• For devices that contain FlexNVM: 1 block of FlexRAM

K70P256M150SF3RM.pdf has following

• For devices with program flash only: 4 blocks of program flash consisting of 4 KB

sectors

• For devices that contain FlexNVM: 2 blocks of program flash consisting of 4 KB

sectors

• For devices that contain FlexNVM: 2 blocks of FlexNVM consisting of 4 KB sectors

• For devices that contain FlexNVM: 1 block of FlexRAM

Sorry you have to hunt a bit to find.

Regards,

David

元の投稿で解決策を見る

0 件の賞賛
返信
6 返答(返信)
4,104件の閲覧回数
ignisuti
Contributor IV

Mark,

Any luck with figuring this out?
I have the same question.

When I protect my flash, I can do it 32 segments. Since my flash is 512KB, that means I can protect flash in 16KB increments. Is this the same with programming and erasing flash? i.e. Done in 32 equal sized segments?

If so, what address do I use, the first address of the range? Any address in the range?

0 件の賞賛
返信
4,104件の閲覧回数
mjbcswitzerland
Specialist V

Hi Joe

The protection sizes are not releated to the erase sector sizes.

The Flash commands specify their requirements so it is best to check in the manual to be absolutely sure. When I delete sectors I always align the address to the start of the sector but I have a note in the code saying that the address should be "phrase aligned", meaning that the last three bits [2:0] should be 0 - practically, aligning to the segment is as easy as aligning to a phrase and I suppose that is why I did it that way.

Regards

Mark

0 件の賞賛
返信
4,104件の閲覧回数
ignisuti
Contributor IV

Thanks Mark. I believe I found what I was looking for.

In case anyone else is looking for this.

I found it in section 3.5.1.2 Flash Memory Sizes of my manual.

It claims my 512KB flash is divided into 2 blocks that are each 0x4_0000 bytes large. Each block contains 128 2KB sectors.

So the starting addresses (in hex) for each sector should be the following (only a handful of the 256 sectors listed here):

10
2800
31000
41800
52000
62800
73000
83800
94000
104800
115000
125800
136000
146800
157000
167800
178000

Other gotchas worth mentioning:

  1. Flash Module must be enabled. I'm learning from the AN2295_Kinetis example code which uses a function called FTFL_Initialization() to do this.
  2. Can not erase/write to a sector that is protected.
0 件の賞賛
返信
4,105件の閲覧回数
DavidS
NXP Employee
NXP Employee

Joe is correct.

The Reference Manual for the specific device mentions the flash sector size in Chapter 3 with subtitle "Flash Memory Sizes".

Example:

K10P32M50SF0RM.pdf has following

• 1 block of program flash consisting of 1 KB sectors

• 1 block of FlexNVM consisting of 1 KB sectors

• 1 block of FlexRAM

K60P144M100SF2RM.pdf has following

• For devices with program flash only: 2 blocks of program flash consisting of 2 KB

sectors

• For devices that contain FlexNVM: 1 block of program flash consisting of 2 KB

sectors

• For devices that contain FlexNVM: 1 block of FlexNVM consisting of 2 KB sectors

• For devices that contain FlexNVM: 1 block of FlexRAM

K70P256M150SF3RM.pdf has following

• For devices with program flash only: 4 blocks of program flash consisting of 4 KB

sectors

• For devices that contain FlexNVM: 2 blocks of program flash consisting of 4 KB

sectors

• For devices that contain FlexNVM: 2 blocks of FlexNVM consisting of 4 KB sectors

• For devices that contain FlexNVM: 1 block of FlexRAM

Sorry you have to hunt a bit to find.

Regards,

David

0 件の賞賛
返信
4,104件の閲覧回数
ignisuti
Contributor IV

I'm running into an issue where I can't erase a sector at address 0x8000? When I try this, I get a hard fault.

If I move up by a sector (2KB), I can erase 0x8800 and up, and all works well. I can even erase at address 0x8001. So, I appear to be off by 1 byte.

Note: I’ve protected my flash from 0x0 to 0x7FFF. Is this related?

0 件の賞賛
返信
4,104件の閲覧回数
DavidS
NXP Employee
NXP Employee

Hi Joe,

What happens when you do not use the protection?

Regards,

David

0 件の賞賛
返信