AnsweredAssumed Answered

Writing flash memory with KL27Z256

Question asked by Paolo Colombo on Jun 18, 2015
Latest reply on Jun 19, 2015 by Paolo Colombo

Hi, to all!

I have a problem with my card realized with KL27Z256 using flash memory for storing parameters. (KDS Mainline SDK 3.0.0 + 1.2.0)

I followed the demo attached to the package SDK 1.2.0 Mainline, made for KL24Z64.

For several days I'm working, but I managed to write and delete only addresses equal to or greater than 0x20000, in the second block of flash then.

I need to be able to use an address in the first 128K and here the problems begin, because in this case the processor reset continuously, and the write / erase are unsuccessful.

I note that, as indicated by the demo, I copied in the ram "CommandSequence" and the "CallBack" (which is empty).

I enclose lines of code involved and screen component inspector.




StartFlashAddr = K_StartFlashAddr;                                     // 0x20000              
Size = K_SectorSize;                                                             // 0x0400        

flash1_InitConfig0.CallBack = (PCALLBACK)RelocateFunction((uint32_t)__ram_for_callback , CALLBACK_SIZE , (uint32_t)flash1_Callback);

MyCommandSequence  = (pFLASHCOMMANDSEQUENCE)RelocateFunction((uint32_t)__ram_func , LAUNCH_CMD_SIZE, (uint32_t)FlashCommandSequence);

          ret = FlashEraseSector(&flash1_InitConfig0, StartFlashAddr, Size, MyCommandSequence);

          ParamSet.Cks = Calc_CKS((byte *)&ParamSet, sizeof(ParamSet) - 1);

          Size = sizeof(ParamSet);

          ret = FlashProgram(&flash1_InitConfig0, StartFlashAddr, Size, (byte*)&ParamSet, MyCommandSequence);

          f_To_Save = FALSE;


}             // Store_Param