flash sector size across Kinetis series

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

flash sector size across Kinetis series

775 Views
jasonj99
Contributor II

I found that the flash sector size varies from device to device or class to class within Kinetis MCU, and there is no common way to determine the flash sector size at runtime.

Is that true? If I want to determine the flash sector size at runtime to ensure the algorithm works across Kinetis series MCU. How can I achieve this?

0 Kudos
3 Replies

531 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Jason Jiang,

  

     I think maybe you can read the chip's relative register, then you can identify the size of it's flash.

     Actually, in our demo code KINETIS512_V2_SC, and in the start.c code, you will find some code to do this function, eg:

   /* Determine the flash revision */

    flash_identify();  

  

    /* Determine the P-flash size */

  switch((SIM_FCFG1 & SIM_FCFG1_PFSIZE(0xF))>>SIM_FCFG1_PFSIZE_SHIFT)

    {

      case 0x7:

            printf("128 kBytes of P-flash    ");

            break;

        case 0x9:

            printf("256 kBytes of P-flash    ");

            break;

        case 0xB:

            printf("512 kBytes of P-flash    ");

            break;

        case 0xF:

                  /* Determine if the part has P-flash only or FlexNVM */

                if (SIM_FCFG2 & SIM_FCFG2_PFLSH_MASK)

                  printf("512 kBytes of P-flash    ");

                else

                  printf("256 kBytes of P-flash    ");

            break;

     default:

        printf("ERR!! Undefined P-flash size\n");

        break;              

    }

You can download the code from this link:

http://www.freescale.com/webapp/sps/download/license.jsp?colCode=KINETIS512_V2_SC&location=null&fpsp...

I wish it helps you!

Jing

531 Views
jasonj99
Contributor II

HI, what I mean is the size of flash sector, not the total size of flash. I have searched the whole forum but not find the answer, some one suggest to build a list of all devices and get the size of flash sector, the number of blocks, the other information about the flash from it. But it is not efficient and more important hard to maintain. I wonder why Kinetis MCU doesn't have a register or register field about the size of flash sector just like the other vendor does?

0 Kudos

531 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Jason Jiang,

     The kinetis MCU doesn't have the register about the size of the flash sector now, maybe just as you say, you should use the program to identify it.

      If we have another way to solve it, I will tell you !

      Thanks for your understanding!

Best regards!

Jing

0 Kudos