AnsweredAssumed Answered

FLASH_ReadOnce KSDK2.0 parameter

Question asked by manfredschnell on Sep 8, 2016
Latest reply on Sep 8, 2016 by David E Seymour

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();
    }

Outcomes