K22 + KSDK 1.3 C90TFS/FTFx Driver, FlashVerifySection(...) method

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

K22 + KSDK 1.3 C90TFS/FTFx Driver, FlashVerifySection(...) method

Jump to solution
852 Views
chriskeeser
Contributor III

I'm using a K22FN512xxx12 device (FTFA flash controller) and I am trying to make sense of the "number" parameter in the FlashVerifySection(config, dest, number, margin, commandSeq) function.  The description for the parameter in the C90TFS/FTFx Driver User Manual states:  "Number of alignment unit to be verified. Refer to corresponding reference manual to get correct information of alignment constrain." [sic]

Searching through the reference manual I am not able to find the relevant information (I have no idea what I am looking for).  What I do know for my K22 device:

Flash size: 512 KB

Block size: 256 KB
Sector size: 2048 B

Program size: 4 B

The example application (For a K64 device) has the following code:

/* Verify section for several sector of PFLASH */
 number = FTFx_PSECTOR_SIZE/FSL_FEATURE_FLASH_PFLASH_SECTION_CMD_ADDRESS_ALIGMENT;
 for(margin_read_level = 0; margin_read_level < 0x2; margin_read_level++)
 {
   ret = FlashVerifySection(&flashSSDConfig, destination, number, margin_read_level, g_FlashLaunchCommand);
   if (FTFx_OK != ret)
   {
     ErrorTrap(ret);
   }
 }

Where 'FTFx_PSECTOR_SIZE' = 4096 (for the example K64 project) and 'FSL_FEATURE_FLASH_PFLASH_SECTION_CMD_ADDRESS_ALIGMENT' = 16 (for the example K64 project).  This means number = 256 (for the example K64 project) which ... doesn't make any sense to me.

How am I supposed to calculate the number parameter for my device (MK22FN512xxx12) and what is its meaning / purpose?

Thanks for any help!

1 Solution
659 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello Chris,

The FlashVerifySection command makes use of the "Read 1s Section" command from the Kinetis Flash module. For K64 you can see in the Reference Manual that the required alignment is 16 bytes (128 bits):

pastedImage_2.png

With 16 x 256 = 4096 bytes you can see that the whole 4 KiB sector is verified.

For the K22FN512 the alignment would be 8 bytes (1 phrase):

pastedImage_3.png

Then Number is calculated as next:

Number = FTFx_PSECTOR_SIZE / FSL_FEATURE_FLASH_PFLASH_SECTION_CMD_ADDRESS_ALIGMENT;

Number = 2048 / 8;

Number = 256;

I hope this clarifies.


Best Regards!,
Jorge Gonzalez

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

2 Replies
660 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello Chris,

The FlashVerifySection command makes use of the "Read 1s Section" command from the Kinetis Flash module. For K64 you can see in the Reference Manual that the required alignment is 16 bytes (128 bits):

pastedImage_2.png

With 16 x 256 = 4096 bytes you can see that the whole 4 KiB sector is verified.

For the K22FN512 the alignment would be 8 bytes (1 phrase):

pastedImage_3.png

Then Number is calculated as next:

Number = FTFx_PSECTOR_SIZE / FSL_FEATURE_FLASH_PFLASH_SECTION_CMD_ADDRESS_ALIGMENT;

Number = 2048 / 8;

Number = 256;

I hope this clarifies.


Best Regards!,
Jorge Gonzalez

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

660 Views
chriskeeser
Contributor III

Jorge, Thank you for clearing that up.

I wish that the documentation for the driver would mention that the VerifySection() made use of the "Read 1's" command so future developers would know where to look when trying to figure out what number  should be.

0 Kudos