In-software flash programming MKL17Z64 fsl_flash driver

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

In-software flash programming MKL17Z64 fsl_flash driver

607 Views
davesturgess
Contributor II

I am trying to in-software program the flash on a MKL17Z64... with the fsl_flash driver, I can find no examples of how to do this.

I have in the past successfully carried out the same on the MKL17Z128 but this has two flash blocks so I programmed block 1 while executing from block zero, this is not possible on the 64K part as there is only 1 block.

I believe that a sequence is loaded into RAM which carries out the programming or erase to circumvent this limitation.

I have tried the following (with breakpoint at each function) to step through the process:-

status_t status;

flash_config_t f_config;

status = FLASH_Init(&f_config);

status = FLASH_Erase(&f_config, 0xf000, 1024, 0);

status = FLASH_Program(&f_config, 0xf000, (uint8_t)0x3000, 32);

status = FLASH_Erase(&f_config, 0xf000, 1024, 0);

delay_sec(1);

I get a hard fault on:-

(kFLASH_ExecuteInRamFunctionTotalNum == flashExecuteInRamFunctionInfo->activeFunctionCount))

in function

static status_t  (kFLASH_ExecuteInRamFunctionTotalNum == flashExecuteInRamFunctionInfo->activeFunctionCount))

called from FLASH_init.

Grateful for any help.

regards

Dave

Labels (1)
0 Kudos
1 Reply

421 Views
jorge_a_vazquez
NXP Employee
NXP Employee

Hi dave sturgess 

I recommend you to check the example provided in the SDK 2.x software package, you can download the latest package in the link:

Welcome | MCUXpresso SDK Builder 

In the path SDK_2.x_KL17_path\boards\frdmkl27z\driver_examples\flash\pflash\

you can find an example using those API with Flash controller.

Hope this helps.

Best regards

0 Kudos