这些小活动你都参加了吗?快来围观一下吧!>>
电子产品世界 » 论坛首页 » 行业应用 » 汽车电子 » 【S32K3XX】功能安全BIST功能

共1条 1/1 1 跳转至

【S32K3XX】功能安全BIST功能

高工
2026-01-05 16:35:53     打赏

【简介】

在车规功能安全的项目中通常需要MCU芯片集成BIST自检功能来确保芯片的工作安全状态,在S32K3XX系列的芯片是支持芯片的BIST自检功能,Self-Test Control Unit (STCU2) IP 集成了芯片的自检功能。

 在S32DS的 SPD 外设中将Bist 的驱动加入到工程中。

image.png

生成代码后工程中会添加 bist 相关的驱动和配置文件。

image.png

image.png

对于 BIST 功能的实现逻辑是芯片内部的硬件自检机制,对于软件来说我们只需要使用SPD的BIST的接口就可以实现bist 自检功能,本地实现代码如下:

unsigned int bist()
{
    Std_ReturnType ret;
    /*BIST self-test just run once after power on or destructive reset*/
    ret = Bist_Run(BIST_SAFETYBOOT_CFG);
    if (ret == E_OK)
    {
        PRINTF("BIST Run Success\r\n");
    }
    else
    {
        PRINTF("BIST Run Failed\r\n");
    }
    return 0;
}


以下代码是官方的 SPD 驱动库中,对bist 的示例代码

    /**************************************************/
    /* Bist example code                              */
    /**************************************************/
    if (MCU_POWER_ON_RESET == resetReason)
    {
#if (BIST_MODULE_ENABLED == 1U)
        Bist_Run(BIST_SAFETYBOOT_CFG);
    }
    else if(MCU_ST_DONE_RESET == resetReason)
    {
        bistStatus = Bist_GetExecStatus(BIST_SAFETYBOOT_CFG);
        if( bistStatus != BIST_OK )
        {
            if(bistStatus == BIST_ERROR)
            {
                /* Reads STCU ERR_STAT register to identify what HW error occurred */
                stcuStatus = Bist_GetRawErrorStatus();
                (void) stcuStatus;
            }
            else if(bistStatus == BIST_FAILED)
            {
                /* Analyze which reset domain is failing */
                retStatus = Bist_GetFailRDs(&Bist_LBistRDList, &Bist_MBistRDList);
                (void) retStatus;
            }
            else if(bistStatus == BIST_BUSY)
            {
                while( 1U );   /* Handle BIST HW busy state */
            }
            else if(bistStatus == BIST_INTEGRITY_FAIL)
            {
                while( 1U );   /* Handle the integrity fail state */
            }
        }
#endif /* #if (BIST_MODULE_ENABLED == 1U) */
    }

以下是bist 的执行流程,和上述代码的流程也是一致的。

image.png

本地添加上述代码触发bist 后在重启后读取结果信息,运行后读取bist 状态为OK状态。

image.png

           


共1条 1/1 1 跳转至

回复

匿名不能发帖!请先 [ 登陆 注册 ]