Author: OleksandrP_61 Version: **
Translation - Japanese: Em_EEPROM コンポーネントのリード関数が無限ループにとどまってしまう問題 - KBA227502- Community Translated (JA)
Context:
PSoC® Creator™ 4.2 project with Em_EEPROM Component v2_0, v2_10 or v2_20, for PSoC 3, PSoC 4, PSoC 5LP, or PSoC 6 MCU devices.
ModusToolbox™ IDE project with psoc6sw-1.0 or psoc6sw-1.1 libraries which uses the Emulated EEPROM middleware for PSoC 6 MCU.
Issue:
When an unexpected reset or power loss happens during the Em_EEPROM Component write operation, the read operation with the Em_EEPROM_Read() or Cy_Em_EEPROM_Read() functions can stuck in an infinite loop in the next device power-up.
Cause:
This issue is caused by an error in the read function loop organization. An infinite loop occurs only when the sequence number field (seqNum variable) of the em_eeprom header section is set to 0xFFFFFFFF by an incomplete flash write operation.
Workaround:
You can fix the issue using the following workaround:
1. Locate the cy_em_eeprom.c file and create a backup for it. Depending on the PSoC family and Component version, this file is located in the following directory:
PSoC Creator 4.2 and PSoC 3, PSoC 4, or PSoC 5LP:
PSoC Creator 4.2 and PSoC 6 MCU:
ModusToolbox and PSoC 6 MCU:
2. Update the Cy_Em_EEPROM_Read() function code in the cy_em_eeprom.c file.
Note To perform code update for PSoC 6 MCU, run your editor software with Administrator rights.
Find the following code:
if((CY_EM_EEPROM_SUCCESS == ret) && (0u != seqNum)) { numRowReads = (context->numberOfRows <= seqNum) ? (context->numberOfRows) : (seqNum); numRowReads--; for(i = (seqNum - numRowReads); i <= seqNum; i++) { startRowAddr = GetRowAddrBySeqNum(i, context); if (0u != startRowAddr) { ... |
Replace the found above code with the following code containing the workaround:
if((CY_EM_EEPROM_SUCCESS == ret) && (0u != seqNum)) { numRowReads = (context->numberOfRows <= seqNum) ? (context->numberOfRows) : (seqNum); for(i = 0; i < numRowReads; i++) { startRowAddr = GetRowAddrBySeqNum(seqNum - ((numRowReads - 1) - i), context); if (0u != startRowAddr) { ... |