This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
您好!
我尝试使用闪存 API 并尝试对闪存进行编程、但它始终返回失败。 如果我尝试在闪存中写入0到1、则会根据手册设置 INVDAT。 在我写入闪存之前、我已经擦除了闪存(也使用函数进行了检查)、一切都正常、使用内存浏览器完全为0xFFFF)、但它没有帮助。 我出了什么问题?
下面是我如何尝试执行它的一些代码:
uint32_t 地址 ToErase = 0x8F000;
uint16_t DATA[4];
data[0]= 0x10;
data[1]= 0x11;
data[2]= 0x12;
DATA[3]= 0x13;
Fapi_StatusType flashStatus = Fapi_issueCommandAddress (Fapi_EraseSector、(UINT32_t *) addressToErase);
while (Fapi_checkFsmForReady ()!= Fapi_Status_FsmReady);
if (flashStatus!= 0)
{
//处理错误
}
否则
{
if (fapi_getFsmStatus()!= 0U)
{
//处理错误
}
其他
{
//检查是否为空
Fapi_FlashStatusWordType flashStatusWord;
flashStatus = fapi_doBlankCheck (((uint32_t *) address ToErase、0x1000、flashStatusWord);
if (flashStatus!= fapi_Status_Success)
{
//处理错误
}
其他
{
flashStatus = fapi_issueProgrammingCommand (&addressToErase、&data[0]、4、NULL、0U、 Fapi_AutoEccGeneration);
//等待闪存程序操作完成
while (fapi_checkFsmForReady()!= fapi_Status_FsmReady);
if (flashStatus!= fapi_Status_Success)
{
将始终出现在这里、因为 INVDAT 为1
//处理错误
}
...}
}
我刚刚测试了我的代码(因为这不是我正在使用的实际代码、而是相关的部分)、并注意到如果缓冲区只有4个字、即使 我只想写入4个字、我也会得到 Fapi_Error_correctDataBufferLength 错误。 为什么是这样? 在我的实际代码中、缓冲区要大得多、但在这种情况下无关紧要。 我将该示例的缓冲区增加到了8个字、并得到了增益 INVDAT 1误差。
JHi
只是发现了它是什么。 我的编程地址命令错误。 它实际上应该指向我不需要编程的位置、如空白支票:
Fapi_issueProgrammingCommand (&addressToErase、&data[0]、4、NULL、0U、 Fapi_AutoEccGeneration);
应该是
fapi_issueProgrammingCommand ((uint32_t *) addressToErase、&data[0]、4、NULL、0U、 Fapi_AutoEccGeneration);
JHi
JHi、
很高兴它能为您服务。
请搜索“一次可以使用 Fapi_issueProgrammingCommand()对多少位进行编程?” 闪存 API wiki 中的链接 、网址为 https://processors.wiki.ti.com/index.php/C2000_Flash_FAQ
谢谢、此致、
Vamsi