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.

[参考译文] LP-AM243:AM243x 工业 SDK 发生 Hwip_data_abort_handler_c ()

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

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1450465/lp-am243-hwip_data_abort_handler_c-occur-by-am243x-industrial-sdk

器件型号:LP-AM243

工具与软件:

大家好、团队成员:

我将使用 SDK 版本09_02_00_15中的"ethercat_slave_demo" 401_simple 开发 EtherCAT 应用。

当我  在循环任务中调用 EC_API_SLV_Coe_setObjectEntryData()和 EC_API_SLV_CoE_getObjectEntryData ()后使用 API 时、   

Hwip_data_abort_handler_c ()会在几分钟后出现。

您能告诉我为什么 这些 API 或其他东西发生数据中止、以及如何防止数据中止以及如何反复使用这些 API 吗?  

此致、

小山

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

    您好、Oyama、

    我想了解使用的动机是什么  EC_API_SLV_Coe_setObjectEntryData ()和 EC_API_SLV_Coe_getObjectEntryData ()、该循环的运行速度有多快?

    如果要在"对象字典"中创建更多对象或创建更多 PDO、请确保堆内存足以为对象条目数据分配内存块。

    请提供更多信息、以便我们可以尝试在最后重现此问题

    此致、

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

    您好 Harsha、

    周期时间为直流2ms、PDO 设置如下所示。

    0x1600:01 0x7000110
    0x1600:02 0x7000210
    0x1A00:01 0x6000110
    0x1A00:02 0x6000210

    这是代码将中止数据。

    static void EC_SLV_APP_SS_applicationRun(void *pAppCtxt_p)
    {
        EC_SLV_APP_SS_Application_t* applicationInstace = (EC_SLV_APP_SS_Application_t*)pAppCtxt_p;
        static EC_API_SLV_EEsmState_t state = EC_API_SLV_eESM_uninit;
        static bool flag=true;
        uint16_t alErrorCode;
        uint32_t error;
        uint16_t GetData=0;
        EC_API_SLV_SCoE_ObjEntry_t* TxPdoEntry;
        EC_API_SLV_SCoE_ObjEntry_t* RxPdoEntry;
    
        error = EC_API_SLV_getState(applicationInstace->ptEcSlvApi, &state, &alErrorCode);
    
        //Get PDO Entry in the safeop
        if(flag && EC_API_SLV_eESM_safeop==state){
            error=(EC_API_EError_t)EC_API_SLV_PDO_getEntry(applicationInstace->ptEcSlvApi, applicationInstace->ptRxPdo1600, 1, &RxPdoEntry);
            if (error != EC_API_eERR_NONE)
            {
                OSAL_printf("%s:%d Variable Error code: 0x%08x\r\n", __func__, __LINE__, error);
            } 
            error=(EC_API_EError_t)EC_API_SLV_PDO_getEntry(applicationInstace->ptEcSlvApi, applicationInstace->ptTxPdo1A00, 1, &TxPdoEntry);
            if (error != EC_API_eERR_NONE)
            {
                OSAL_printf("%s:%d Variable Error code: 0x%08x\r\n", __func__, __LINE__, error);
            } 
            if(TxPdoEntry!=NULL && RxPdoEntry!=NULL){
                flag=false; 
            }
        }
        
        //Copy data 0x7000 to 0x6000
        if(EC_API_SLV_eESM_op==state){
            error=EC_API_SLV_CoE_getObjectEntryData(applicationInstace->ptEcSlvApi,RxPdoEntry,2,&GetData);
            if (error != EC_API_eERR_NONE)
            {
                OSAL_printf("%s:%d Variable Error code: 0x%08x\r\n", __func__, __LINE__, error);
            } 
            error=EC_API_SLV_CoE_setObjectEntryData(applicationInstace->ptEcSlvApi,TxPdoEntry,2,&GetData);
            if (error != EC_API_eERR_NONE)
            {
                OSAL_printf("%s:%d Variable Error code: 0x%08x\r\n", __func__, __LINE__, error);
            }
        }
    }

    这是该代码不会中止数据、但是  EC_API_SLV_Coe_getObjectEntryData 和  EC_API_SLV_Coe_setObjectEntryData 返回错误。

    static void EC_SLV_APP_SS_applicationRun(void *pAppCtxt_p)
    {
        EC_SLV_APP_SS_Application_t* applicationInstace = (EC_SLV_APP_SS_Application_t*)pAppCtxt_p;
        static EC_API_SLV_EEsmState_t state = EC_API_SLV_eESM_uninit;
        static bool    flag=true;
        uint16_t alErrorCode;
        uint32_t error;
        uint16_t GetData=0;
        static EC_API_SLV_SCoE_ObjEntry_t* TxPdoEntry=NULL;
        static EC_API_SLV_SCoE_ObjEntry_t* RxPdoEntry=NULL;
    
        error = EC_API_SLV_getState(applicationInstace->ptEcSlvApi, &state, &alErrorCode);
    
        if(flag && EC_API_SLV_eESM_op>state){   ////changed
            error=(EC_API_EError_t)EC_API_SLV_PDO_getEntry(applicationInstace->ptEcSlvApi, applicationInstace->ptRxPdo1600, 1, &RxPdoEntry);
            if (error != EC_API_eERR_NONE)
            {
                OSAL_printf("%s:%d Variable Error code: 0x%08x\r\n", __func__, __LINE__, error);
            } 
            error=(EC_API_EError_t)EC_API_SLV_PDO_getEntry(applicationInstace->ptEcSlvApi, applicationInstace->ptTxPdo1A00, 1, &TxPdoEntry);
            if (error != EC_API_eERR_NONE)
            {
                OSAL_printf("%s:%d Variable Error code: 0x%08x\r\n", __func__, __LINE__, error);
            }
    
            if(TxPdoEntry!=NULL && RxPdoEntry!=NULL){
                flag=false; 
            }
        }
        
        if(EC_API_SLV_eESM_op==state){
            error=EC_API_SLV_CoE_getObjectEntryData(applicationInstace->ptEcSlvApi,RxPdoEntry,2,&GetData);
            if (error != EC_API_eERR_NONE)
            {
                OSAL_printf("%s:%d Variable Error code: 0x%08x\r\n", __func__, __LINE__, error);
            } 
            error=EC_API_SLV_CoE_setObjectEntryData(applicationInstace->ptEcSlvApi,TxPdoEntry,2,&GetData);
            if (error != EC_API_eERR_NONE)
            {
                OSAL_printf("%s:%d Variable Error code: 0x%08x\r\n", __func__, __LINE__, error);
            }
        }
    }

    不过、使用  EC_API_SLV_Coe_GetObjectData  和  EC_API_SLV_Coe_setObjectData  而不是  

    EC_API_SLV_Coe_getObjectEntryData  和  EC_API_SLV_Coe_setObjectEntryData、  会顺利。

    static void EC_SLV_APP_SS_applicationRun(void *pAppCtxt_p)
    {
        EC_SLV_APP_SS_Application_t* applicationInstace = (EC_SLV_APP_SS_Application_t*)pAppCtxt_p;
        static EC_API_SLV_EEsmState_t state = EC_API_SLV_eESM_uninit;
        uint16_t alErrorCode;
        uint32_t error;
        uint16_t GetData[3]={0};
        uint16_t SetData[3]={0};
    
        error = EC_API_SLV_getState(applicationInstace->ptEcSlvApi, &state, &alErrorCode);
    
        if(EC_API_SLV_eESM_op==state){
            EC_API_SLV_CoE_getObjectData(applicationInstace->ptEcSlvApi, applicationInstace->pt7000RecObj,6,&GetData);
            OSAL_MEMORY_memcpy(SetData, GetData, 6);
            EC_API_SLV_CoE_setObjectData(applicationInstace->ptEcSlvApi, applicationInstace->pt6000RecObj,1,4,&SetData[1]);
        }
    }

    为什么它无法从 对象条目中读取和写入数据?

    此致、

    小山

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

    您好、Oyama、

    在会触发数据中止的代码中、我看到参数传递给了 API  EC_API_SLV_PDO_getEntry () 不正确。 字节  EC_API_SLV_SPdoEntry_t** 作为第四个参数、但您提供了它 EC_API_SLV_SEE_ObjEntry_t** . 这可能是导致数据中止的根本原因。   

    EC_API_SLV_SEE_ObjEntry_t* RxPdoEntry;


    错误=(EC_API_EError_t) EC_API_SLV_PDO_getEntry (applicationInstace->ptEcSlvApi、applicationInstace->ptRxPdo1600、1、 RxPdoEntry (&R) );


    此致、

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

    你好、Harasha、

    有 API 可以从中获取和设置数据吗  EC_API_SLV_SPdoEntry_t**?

     

    我尝试使用  EC_API_SLV_Coe_getObjectEntry  和  EC_API_SLV_Coe_getObjectEntryData 、但它也不起作用、但没有中止错误。

    static void EC_SLV_APP_SS_applicationRun(void *pAppCtxt_p)
    {
        EC_SLV_APP_SS_Application_t* applicationInstace = (EC_SLV_APP_SS_Application_t*)pAppCtxt_p;
        static EC_API_SLV_EEsmState_t state = EC_API_SLV_eESM_uninit;
        static bool    flag=true;
        uint16_t alErrorCode;
        uint32_t error;
        uint16_t GetData=0;
        static EC_API_SLV_SCoE_ObjEntry_t* TxPdoEntry;
        static EC_API_SLV_SCoE_ObjEntry_t* RxPdoEntry;
    
        error = EC_API_SLV_getState(applicationInstace->ptEcSlvApi, &state, &alErrorCode);
    
        if(flag && EC_API_SLV_eESM_op>=state){
            error=(EC_API_EError_t)EC_API_SLV_CoE_getObjectEntry(applicationInstace->ptEcSlvApi, 0x7000, 1, &RxPdoEntry);
            if (error != EC_API_eERR_NONE)
            {
                OSAL_printf("%s:%d Variable Error code: 0x%08x\r\n", __func__, __LINE__, error);
            } 
            error=(EC_API_EError_t)EC_API_SLV_CoE_getObjectEntry(applicationInstace->ptEcSlvApi, 0x6000, 1, &RxPdoEntry);
            if (error != EC_API_eERR_NONE)
            {
                OSAL_printf("%s:%d Variable Error code: 0x%08x\r\n", __func__, __LINE__, error);
            } 
            if(TxPdoEntry!=NULL && RxPdoEntry!=NULL){
                flag=false; 
            }
        }
        
        if(EC_API_SLV_eESM_op==state){
            error=EC_API_SLV_CoE_getObjectEntryData(applicationInstace->ptEcSlvApi,RxPdoEntry,2,&GetData);
            if (error != EC_API_eERR_NONE)
            {
                OSAL_printf("%s:%d Variable Error code: 0x%08x\r\n", __func__, __LINE__, error);
            } 
            error=EC_API_SLV_CoE_setObjectEntryData(applicationInstace->ptEcSlvApi,TxPdoEntry,2,&GetData);
            if (error != EC_API_eERR_NONE)
            {
                OSAL_printf("%s:%d Variable Error code: 0x%08x\r\n", __func__, __LINE__, error);
            }
        }
    }

    此致、

    小山

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

    您好、Oyama、

    提供了用于读取和写入 PDO 条目数据的 API。

    • EC_API_SLV_PDO_setEntryData ()- 将数据写入单个 PDO 条目变量。
    • EC_API_SLV_PDO_getEntryData ()- 从单个 PDO 条目变量读取数据。

    有用于读取和写入所有 PDO 条目的 API。

    • EC_API_SLV_PDO_setData ()- 所有 PDO 条目都被写入一个数据块。
    • EC_API_SLV_PDO_getData ()- 所有 PDO 条目都被读取在一个数据块中。


    此致、

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

    你好、Harasha、

     

    我需要从0x7000:2获取数据并将数据设置为0x6000:2。

    我必须使用什么 API?

    此致、

    小山

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

    您好、Oyama、

    我看到唯一的变量  RxPdoEntry 不是 TxPdoEntry .

    error=(EC_API_EError_t) EC_API_SLV_Coe_getObjectEntry (applicationInstace->ptEcSlvApi、0x7000、1、&R RxPdoEntry);
    if (error!= EC_API_eERR_NONE)

    OSAL_printf ("%s":%d 变量错误代码:0x%08x\r\n"、__func__、__line__、error);
    }
    error=(EC_API_EError_t) EC_API_SLV_Coe_getObjectEntry (applicationInstace->ptEcSlvApi、0x6000、1、&R RxPdoEntry);

    if (error!= EC_API_eERR_NONE)

    OSAL_printf ("%s":%d 变量错误代码:0x%08x\r\n"、__func__、__line__、error);
    }
    if (TxPdoEntry!=NULL && RxPdoEntry!=NULL){
    flag=false;
    }

    .

    .

    error=EC_API_SLV_Coe_setObjectEntryData (applicationInstace->ptEcSlvApi、TxPdoEntry、2和 GetData);

    您能告诉我们什么在代码中不起作用吗?

    此致、

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

    你好、Harasha、

     

    我漏掉了、现在能正常工作了。

    谢谢 Harasha