- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I am currently using the flash driver functions from the files cy_flash.c and cy_mw_flash.c. The function Cy_FlashWriteCode is void so there is no information about the status of the operation. Same for the Cy_FlashWriteCode function.
Is there any way to check the status of the last flash operation ?
Thank you,
Ana
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Ana,
I assume you are referring to SDL api Cy_FlashWriteCode. The definition can be found in \..\<SDL directory>\common\src\mw\flash\cy_mw_flash.c file. Kindly note that CY_ASSERT is used inside this function to check the status of api, so if it fail- then the processor will halt. If the program does not halt and goes to next line in code after executing this function, that will indicate it was executed successfully.
Regards,
Ashish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Ana,
I assume you are referring to SDL api Cy_FlashWriteCode. The definition can be found in \..\<SDL directory>\common\src\mw\flash\cy_mw_flash.c file. Kindly note that CY_ASSERT is used inside this function to check the status of api, so if it fail- then the processor will halt. If the program does not halt and goes to next line in code after executing this function, that will indicate it was executed successfully.
Regards,
Ashish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Ashish,
Thank you for your response.
I can't allow the program to halt, so I previously defined NDEBUG so that the CY_ASSERT is empty. I need to obtain the status of the flash operation and escalate an error in my software.
Is that possible ?
Thank you,
Ana
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Then you can modify it (or make a similar function) to return the "status" instead of doing assert. Since it's just a middleware, and it calls Cy_Flash_ProgramRow which in turn calls system call api Cy_Flash_CallSromApiForFlashWrite for writing operation. Cy_Flash_ProgramRow will return the status as success or fail (with error code). You can refer chapter 33 "Nonvolatile memory programming" for details on system calls and various error codes.
Regards,
Ashish