Hi, I want to use S32K144 eeprom quick mode to fast writes, call the following API:
void eeprom_write(....){
......
ret = FLASH_DRV_SetFlexRamFunction(&flashSSDConfig, EEE_QUICK_WRITE, 128, NULL);
while ((FTFC->FCNFG & FTFC_FCNFG_EEERDY_MASK) == 0);
ret = FLASH_DRV_EEEWrite(&flashSSDConfig, relAddr, 124, src);
......
}
when i call eeprom_write this function the second time, FSTAT register 5 bit will set 1 (flash access error), why?
If the FlexRAM is set for a 128-byte quick write.
You need to write exactly 128 bytes in the FlexRAM, not 124 bytes.
BR, Daniel
Hi Daniel,
when i write 128 bytes in the FlexRAM, i find eeprom quick write don't work. It looks like normal mode.
when i call the API(eeprom_write) this way, only 384(3*128)bytes is fast write mode, more data will be normal mode, if I want to use fast mode, what should I do?
ret = FLASH_DRV_SetFlexRamFunction(&flashSSDConfig, EEE_QUICK_WRITE, 0x200u, NULL); //This function is called only once
void eeprom_write(....) //Call this function multiple times to write 128bytes each time
{
......
while ((FTFC->FCNFG & FTFC_FCNFG_EEERDY_MASK) == 0);
ret = FLASH_DRV_EEEWrite(&flashSSDConfig, relAddr, 128, src);
......
}
When you call this:
FLASH_DRV_SetFlexRamFunction(&flashSSDConfig, EEE_QUICK_WRITE, 0x200u, NULL);
you need to write exactly 512 bytes.
If you want to write next 512 bytes after the first write, call the function again
FLASH_DRV_SetFlexRamFunction(&flashSSDConfig, EEE_QUICK_WRITE, 0x200u, NULL);
And write 512 bytes again.
Regards,
Daniel
Hi Daniel,
when i call this way:
void eeprom_write(....){
......
ret = FLASH_DRV_SetFlexRamFunction(&flashSSDConfig, EEE_QUICK_WRITE, 128, NULL);
while ((FTFC->FCNFG & FTFC_FCNFG_EEERDY_MASK) == 0);
ret = FLASH_DRV_EEEWrite(&flashSSDConfig, relAddr, 128, src);
......
}
I've found that using this quick mode doesn't work
What exactly does not work?
I have tested your code in the flash_partitioning_s32k144 SDK example:
The FTFC module didn't report any error.
After power-cycling the MCU, I can see all the data in FlexRAM.
Regards,
Daniel
Hi Daniel:
I know I can write the data in, but the writing speed is the same as normal mode.
In normal mode, The 128bytes I tested are 12~13ms, and the 128bytes I tested in the fast mode you gave me are also 12~13ms. Is this reasonable?
start_time = k_cycle_get_32();
ret = FLASH_DRV_SetFlexRamFunction(&flashSSDConfig, EEE_QUICK_WRITE, len, NULL);
__ASSERT_NO_MSG(STATUS_SUCCESS == ret);
while ((FTFC->FCNFG & FTFC_FCNFG_EEERDY_MASK) == 0);
ret = FLASH_DRV_EEEWrite(&flashSSDConfig, relAddr, len, src); //len = 128;
stop_time = k_cycle_get_32();
cycles_spent = stop_time - start_time;
ms_spent = cycles_spent / sys_clock_hw_cycles_per_tick();
LOG_INF("eeprom write info: cycles_spent = %d, ms_spent = %d", cycles_spent, ms_spent);
The print information is as follows:
eeprom write info: cycles_spent = 999628, ms_spent = 12 //ms_spent is for how much ms
Looking forward to your reply;
Please have a look at the S32K1xx datasheet, rev13, Table 35.
You can estimate the max. execution time for 128B of normal writes and 128B of quick writes (including the cleanup after the last write).
AN11983 Using the S32K1xx EEPROM Functionality
The code that posted measures not only the execution time of the quick writes but the SetFlexRAM function and the SW overhead of the driver as well.
Regards,
Daniel
Hi Daniel,
when i call this way:
void eeprom_write(....){
......
ret = FLASH_DRV_SetFlexRamFunction(&flashSSDConfig, EEE_QUICK_WRITE, 128, NULL);
while ((FTFC->FCNFG & FTFC_FCNFG_EEERDY_MASK) == 0);
ret = FLASH_DRV_EEEWrite(&flashSSDConfig, relAddr, 128, src);
......
}