FLASH_ReadOnce KSDK2.0 parameter

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

FLASH_ReadOnce KSDK2.0 parameter

Jump to solution
660 Views
manfredschnell
Contributor IV

Hi,

 

I use K64, IAR Workbench, with KSDK2.0.

I'm confused about parameter of FLASH_ReadOnce(flash_config_t * config, uint32_t index, uint32_t * dst, uint32_t lengthInBytes)

 

In API Reference Manual parameter  description is no Parameter "index", instead there ist "start".

I got the following code working.

But I'm insecure about the Parameter "index".

 

Can someone please make things clearer?!?

 

Best regards

Manfred

 

    /* Get flash properties*/
    FLASH_GetProperty(&flashDriver, kFLASH_propertyPflashBlockBaseAddr, &pflashBlockBase);
    FLASH_GetProperty(&flashDriver, kFLASH_propertyPflashTotalSize, &pflashTotalSize);
    FLASH_GetProperty(&flashDriver, kFLASH_propertyPflashSectorSize, &pflashSectorSize);
    FLASH_GetProperty(&flashDriver, kFLASH_propertyDflashTotalSize, &dflashTotalSize);
    FLASH_GetProperty(&flashDriver, kFLASH_propertyDflashBlockBaseAddr, &dflashBlockBase);
    FLASH_GetProperty(&flashDriver, kFLASH_propertyEepromTotalSize, &eepromTotalSize);    

    // read before programming
    result = FLASH_ReadOnce(&flashDriver, 0/*index*/, ulTestBufferRead, sizeof(ulTestBufferRead));
    if (kStatus_FLASH_Success != result)
    {
        __no_operation();   // error_trap();
    }
    
    // program
    FLASH_ProgramOnce(&flashDriver, 0, ulTestBuffer, 8 );

    // read back
    result = FLASH_ReadOnce(&flashDriver, 0/*index*/, ulTestBufferRead, sizeof(ulTestBufferRead));
    if (kStatus_FLASH_Success != result)
    {
        __no_operation();   // error_trap();
    }
Labels (1)
0 Kudos
1 Solution
470 Views
DavidS
NXP Employee
NXP Employee

Hi Manfred,

Each flash block has a IFR (Information Register) associated with each block and only accessible using the Flash Command Sequence.

The IFR is a Write Once set of bytes (cannot be erased).  Look at K64 Reference Manual section "29.3.2 Program flash 0 IFR map".  It will show flash 0 has 64 bytes for you to use however you want (ex: configuration data, serial number, product information, etc..).

Since the Flash Commands write to 8 bytes at a time and also will read 8 bytes, the index parameter offset to one of the 8 records (each record is 8 bytes, ergo 8 records x 8 bytes/record = 64 bytes IFR user write once flash).

Section 29.4.12.10 has good verbage to describe this.

Regards,

David 

View solution in original post

0 Kudos
3 Replies
471 Views
DavidS
NXP Employee
NXP Employee

Hi Manfred,

Each flash block has a IFR (Information Register) associated with each block and only accessible using the Flash Command Sequence.

The IFR is a Write Once set of bytes (cannot be erased).  Look at K64 Reference Manual section "29.3.2 Program flash 0 IFR map".  It will show flash 0 has 64 bytes for you to use however you want (ex: configuration data, serial number, product information, etc..).

Since the Flash Commands write to 8 bytes at a time and also will read 8 bytes, the index parameter offset to one of the 8 records (each record is 8 bytes, ergo 8 records x 8 bytes/record = 64 bytes IFR user write once flash).

Section 29.4.12.10 has good verbage to describe this.

Regards,

David 

0 Kudos
470 Views
manfredschnell
Contributor IV

Hi David,

thank you for your fast response.

So I have to put the variable "index" with values (0x00 ... 0x07) in the function call FLASH_ReadOnce() and FLASH_ProgramOnce().

There is only a correction of "Kinetis SDK v.2.0 API Reference Manual.pdf", section 19.5.9 in the table of parameters "start" --> "index" (with a meaningful description) necessary.

Best regards

Manfred

0 Kudos
470 Views
DavidS
NXP Employee
NXP Employee

I will notify the Documentation team of this.

Thank you,

David 

0 Kudos