- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi!
I have a problem。
In M4 Core ,I use Cy_Flash_BlankCheck to check the address,the function return CY_FLASH_DRV_FLASH_NOT_ERASED。But I read the address,it will go the hardfault。
code:
uint32_t ReadWFlashU32 (uint32_t add)
{
uint32_t ret;
cy_stc_flash_blankcheck_config_t blankCheckConfig;
blankCheckConfig.addrToBeChecked = (uint32_t*)add;
blankCheckConfig.numOfWordsToBeChecked = 0x1u;
if ( CY_FLASH_DRV_FLASH_NOT_ERASED == Cy_Flash_BlankCheck(NULL, &blankCheckConfig, CY_FLASH_DRIVER_BLOCKING))
{
ret = (*(uint32_t *)add);
}
else
{
ret = 0x00000000uL;
}
return (ret);
}
- Labels:
-
Automotive Traveo_II
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Tian,
It seems that BlankCheck SROM API which in turn gets invoked inside Cy_Flash_BlankCheck() is not successful and hence you are getting the error code (CY_FLASH_DRV_FLASH_NOT_ERASED - 0xF00000A4).
Is the work flash region for which you are trying to do blank check protected? Is there any access restrictions set in your project for this memory address?
Thanks,
Kavya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Kavya,
How many cases will return (CY_FLASH_DRV_FLASH_NOT_ERASED - 0xF00000A4).
I read address is 0x14019de4 ,it is in the chip workflash range.
I do not setting any protected , unless it is the default. How can I know this address is protected?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi yuejin,
As I don't have a CYT2B9 chip right now, I'm testing your code on CYT2B7, where 0x14019de4 is not a valid address in workflash. So I choose another address to test, which is 0x14012de4.
There is one potential problem in your code, which is the
numOfWordsToBeChecked = 0x1u;
You should check the whole sector instead of a word. In other word, CY_WFLASH_LG_SBM_SIZE or CY_WFLASH_SM_SBM_SIZE depending on which region you are trying to access.
After changing this line of code to the following code, your code runs without any issues according to my test.
numOfWordsToBeChecked = CY_WFLASH_SM_SBM_SIZE (as mentioned, the address I am using is 0x14012de4)
You can check it on your device.
Best Regards,
Finn
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
By the way, you don't need to change your address to 0x14012de4. Just keep using your previous address 0x14019de4.
The reason I did so is that my device is a smaller flash variant and 0x14019de4 is invalid to me.
BR,
Finn
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
我估计是ECC错误导致的。这玩意儿一般处理方式就是先做Blank Check 如果Check失败就直接擦除
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Bill-li,
尝试读取Blank区域确实会导致ECC错误。但yuejin已经做了blankcheck显示为non-blank已写入,这种情况应该不会触发ECC错误。
Anyway,先擦除再使用Flash是一个最保险的使用方法。谢谢你的建议
Best Regards,
Finn