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.

[参考译文] F28M35H52C:闪存访问 API 失败

Guru**** 2387830 points
Other Parts Discussed in Thread: F28M35H52C, CONTROLSUITE, SYSBIOS
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1013812/f28m35h52c-flash-access-api-fails

器件型号:F28M35H52C
Thread 中讨论的其他器件: controlSUITESYSBIOS

您好!

我们正在尝试使用闪存 API 写入 F28M35H52C 处理器的闪存。  

我们遇到随机故障、函数与 Fapi_setActiveFlashBank 函数卡住。 我们使用闪存组0。

该功能永远不会出现、并且在问题发生后器件崩溃。  

我随附了代码供您参考:

我们已使用链接器文件将闪存 API 放置在 RAM 中。 在执行期间、它不会被放置在闪存中(然后被复制到 RAM 中)。

调用闪存 API 的函数也被放置在 RAM 中。

您能不能回顾一下代码片段、如果我们错过了任何内容、请告知我们。 如果需要、我们可以提供更多详细信息。

uint32_t Fapi_BlockProgram( uint32 u32address, uint8 *u8Data, uint32 SizeInBytes, uint8 u8Writelength)
{
    Fapi_StatusType            oReturnCheck;
    volatile Fapi_FlashStatusType       oFlashStatus;
    uint8_t bytes = 0;

    // To acces the Flash_api
    FlashGainPump();


    if (SizeInBytes < u8Writelength)
        bytes = SizeInBytes;
    else
        bytes = u8Writelength;


    oReturnCheck = Fapi_initializeAPI(F021_CPU0_BASE_ADDRESS, 75);
    if(oReturnCheck != Fapi_Status_Success)
    {
        //Check Flash API documentation for possible errors
        //Example_Error(oReturnCheck);
#if SYSTEM_TEST_GEN2_2_ERROR
        printk("Flash_api Initialize issue : %d \n",oReturnCheck);
        // Send error code to error handler task for processing
        ProcessSystemError(ERROR_PPS_FLASH_ACCESS_FAILURE, PPS_TASK_CAN); // 1008
#endif

    }
    // Fapi_setActiveFlashBank function sets the Flash bank and FMC
    // for further Flash operations to be performed on the bank
    oReturnCheck = Fapi_setActiveFlashBank(Fapi_FlashBank0);
    if(oReturnCheck != Fapi_Status_Success)
    {
        // Check Flash API documentation for possible errors
        //Example_Error(oReturnCheck);
#if SYSTEM_TEST_GEN2_2_ERROR
        printk("Flash_api Flash_Bank issue : %d \n",oReturnCheck);
        // Send error code to error handler task for processing
        ProcessSystemError(ERROR_PPS_FLASH_ACCESS_FAILURE, PPS_TASK_CAN); // 1008
#endif

    }
    while(Fapi_checkFsmForReady() != Fapi_Status_FsmReady){}


    // Disable ECC so that error is not generated when reading Flash
    // contents without ECC
    HWREG(FLASH_ERROR_BASE + FLASHERR_O_ECC_ENABLE) = 0x0;

    while( SizeInBytes > 0)
    {
        oReturnCheck = Fapi_issueProgrammingCommand( (uint32 *)u32address,(uint8 *)u8Data, bytes, 0, 0, Fapi_AutoEccGeneration);
        while( Fapi_checkFsmForReady() == Fapi_Status_FsmBusy );
        //while( Fapi_getFsmStatus() != Fapi_Status_Success);
        printk("Flash_api write Done :[ %x ], Length : %d \n",u32address, SizeInBytes);

        if(oReturnCheck != Fapi_Status_Success)
        {
            // Check Flash API documentation for possible errors
            //Example_Error(oReturnCheck);
#if SYSTEM_TEST_GEN2_2_ERROR
        printk("Flash_api write issue : %d \n",oReturnCheck);
        // Send error code to error handler task for processing
        ProcessSystemError(ERROR_PPS_FLASH_WRITE_FAILURE, PPS_TASK_CAN); // 1008
#endif

        }

        u32address += bytes;
        u8Data += bytes;

        SizeInBytes -= bytes;
        if ( SizeInBytes < u8Writelength)
        {
           bytes = SizeInBytes;
        }

    }

    // Enable ECC
    HWREG(FLASH_ERROR_BASE + FLASHERR_O_ECC_ENABLE) = 0xA;

    // Leave control over pump
    FlashLeavePump();


    return (0);
}

此致、

Lakshmi

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Lakshmi、

    问题发生后崩溃意味着什么?  请提供更多详细信息。  它是否生成了复位或 ECC 错误等?

    您是否能够从 controlSUITE 中成功执行闪存 API 使用示例?   

    关于您的代码: 我已经检查了该函数调用之前的代码。

    在 调用闪存 API 函数之前、应执行 EALLOW (C28x)或 MWRALLOW (ARM)以允许写入受保护寄存器。  请检查是否完成了此操作。

    2. 您是否正确配置 PLL 以生成75MHz?  请检查。

    3. 您在调用闪存 API 函数之前是否正确配置了闪存等待状态?

    请在此常见问题解答 中搜索以下问题:e2e.ti.com/.../faq-faq-on-flash-api-usage-for-c2000-devices

    1.您能简要概述一下如何使用突出的闪存 API 函数吗?

    2. 当闪存 API 无法擦除或编程时、我们可以考虑哪些常见的调试提示?

    请查看 常见问题解答是否有帮助。

    谢谢、此致、

    Vamsi

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Vamsi、

    感谢您的回答。 它有助于解决该问题。

    我们已经完成了第1步、然后按照您的建议执行了第2步和第3步。 当我们没有执行上述步骤时、我们最终遇到 _ti_sysbios_family_arm_m3/hwi_exHandlerAsm__i 故障。

    除此之外、我们还确保 setFlashActiveBank 函数只被调用一次。 我们之前为每一个调用它  

    此信息可在 spnu630.pdf 文档中找到 。

    除了您提到的3个步骤之外、此步骤还有助于解决该问题。  

    此致、

    Lakshmi

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    Lakshmi、

    很高兴它帮助了我们。  我在指南和常见问题解答中提供了该信息。

    常见问题解答有一个问题:  为什么以及何时调用 Fapi_setActiveFlashBank()?

    我要关闭此帖子。

    谢谢、此致、

    Vamsi