- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
Let me confirm CySysFlashWriteRow() in CyFlash.c of the auto-generated code.
This function seems to return SUCCESS in the return value even if Write Row fails. Do you think this process is appropriate?
When Write Row by system call fails, the "retValue" should contain the status of the failure, as shown below.
if(retValue == CY_SYS_FLASH_SUCCESS)
{
/* Write Row */
parameters[0u] = (uint32) (((uint32) CY_FLASH_KEY_TWO(CY_FLASH_API_OPCODE_WRITE_ROW) << CY_FLASH_PARAM_KEY_TWO_OFFSET) | CY_FLASH_KEY_ONE);
parameters[0u] |= (uint32)(rowNum << 16u);
CY_FLASH_CPUSS_SYSARG_REG = (uint32) ¶meters[0u];
CY_FLASH_CPUSS_SYSREQ_REG = CY_FLASH_CPUSS_REQ_START | CY_FLASH_API_OPCODE_WRITE_ROW;
CY_NOP;
retValue = CY_FLASH_API_RETURN;
}
However, if the subsequent clock processing is successful, the "retValue" will be overwritten with CY_SYS_FLASH_SUCCESS, as below.
if(clkCnfRetValue == CY_SYS_FLASH_SUCCESS)
{
clkCnfRetValue = CySysFlashClockRestore();
if(clkCnfRetValue != CY_SYS_FLASH_SUCCESS)
{
retValue = clkCnfRetValue;
}
}
If Write Row is likely to fail, my customer might consider modifying the auto-generated code themselves. Em_EEPROM component ver 2.20 is used.
Thank you.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Actually in the code:
if(clkCnfRetValue == CY_SYS_FLASH_SUCCESS)
{
clkCnfRetValue = CySysFlashClockRestore();
if(clkCnfRetValue != CY_SYS_FLASH_SUCCESS)
{
retValue = clkCnfRetValue;
}
}
Only if clkCnfRetValue != CY_SYS_FLASH_SUCCESS, retValue will be modified to clkCnfRetValue. If CySysFlashClockRestore(); executed successfully, retValue is still the return status from Write Flash SROM API.
Best Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Actually in the code:
if(clkCnfRetValue == CY_SYS_FLASH_SUCCESS)
{
clkCnfRetValue = CySysFlashClockRestore();
if(clkCnfRetValue != CY_SYS_FLASH_SUCCESS)
{
retValue = clkCnfRetValue;
}
}
Only if clkCnfRetValue != CY_SYS_FLASH_SUCCESS, retValue will be modified to clkCnfRetValue. If CySysFlashClockRestore(); executed successfully, retValue is still the return status from Write Flash SROM API.
Best Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I misunderstood the program. Thank you so much.
Best regards,