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.

[参考译文] TMS570LC4357:可以使用中断/通知而不是轮询来接收/发送消息

Guru**** 2468610 points
Other Parts Discussed in Thread: HALCOGEN

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

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1107951/tms570lc4357-can-receive-send-messages-using-interrupt-notification-instead-of-polling

器件型号:TMS570LC4357
主题中讨论的其他器件:HALCOGEN

我想使用中断/通知来接收或发送 CAN 消息。

如果我使用 MessageBox 1、我已经使用 Halcogen 为 canREG3上的 Msg1链接"启用 Int "和"高优先级"接触点。

我可以

canEnableStatusChangeNotification (canREG3);

以及有的

canMessageNotification (节点、MessageBox)

适当组装。

canMessageNotification()上的断点永远不会触发,因此不会发生中断。

这些东西目前在轮询时可以正常工作、因此我知道数据是由 Rx 板发送和接收的(两个轮询)。

我可能缺少中断路由功能。

感谢所有帮助。

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

    整个丑陋的斑点看起来像:

    while ((canREG3->IF1STAT & 0x80U)=0x80U)

    }/*等待*/
    CANREG3->IF1MSK = 0xC0000000U |(UINT32)((UINT32)((UINT32) 0x000007FFU &(UINT32) 0x000007FFU)<<(UINT32) 18U);
    CANREG3->IF1ARB =(uint32) 0x8000000000U |(uint32) 0x000000000000 U |(uint32) 0x20000000U |(uint32)(((uint32) 1U &(uint32) 0x000007FFU)<<(uint32) 18U);
    CANREG3->IF1MCTL = 0x00001000U |(UINT32) 0x00000800U |(UINT32) 0x00000000U |(UINT32) 0x00000000U |(UINT32) 8U;
    CANREG3->IF1CMD =(uint8) 0xF8U;
    canREG3->IF1NO = 1U;
    canUpdateID (canPort、canMessageBox[n]、(0x1 << 29)|(id << 18)));//发送、11位标识符
    printf ("canUpdateID msgbx=%d val=0x%x id=0x%x\n"、canMessageBox[n]、(0x1 << 29)|(id << 18)、id);

    当然、希望 API 以端口通用的方式提供此功能。

    谢谢。

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

    类似如下:

    void canUpdateInterrupt (node、messagebox、enable、direction);

    当然、与 MSK、ARB、MCTL 寄存器管理的任何其他设置合并。

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

    也可以使用"优化"HL API 函数、这样可以同时设置多个消息框、就像底层硬件寄存器的组织/管理方式一样。  无需64个调用即可设置/清除位掩码的各个位。

    类似的东西

    void canUpdateInterruptAll (canBASE-t *节点,uint64 messageboxEnableBitArray,uint64 messageboxDirectionBitArray);

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

    更简单的解决方案、至少满足我的需求。  只需在新的 canUpdateIDInterrupt() API 函数中加入中断使能(或将 interruptEnable 参数添加到当前的 canUpdateID()中)。

    因此、呼叫变得简单:

    canUpdateIDInterrupt (canPort、canMessageBox[n]、(0x1 << 29)|(id << 18)、1);//发送、11位标识符、IE
    printf ("canUpdateIDInterrupt msgbx=%d val=0x%x id=0x%x\n"、canMessageBox [n]、(0x1 << 29)|(id << 18)、id);

    ===

    void canUpdateIDInterrupt (canbase_t *节点、uint32 MessageBox、uint32 msgBoxArbitVal、uint32 interruptEnable)

    while ((node->IF2STAT & 0x80U)=0x80U)

    }/*等待*/
    NOD->IF2CMD = 0x10U;//读取控制
    while ((node->IF2STAT & 0x80U)=0x80U)

    }/*等待*/
    NODE->IF2MCTL &=~0xC00;//清除 TxIE、RxIE
    if (interruptEnable & 0x1){
    IF (msgBoxArbitVal &(1 << 29))
    NODE->IF2MCTL |= 0x800;//设置 TxIE
    其他
    NODE->IF2MCTL |= 0x400;//设置 RxIE

    NOD->IF2CMD = 0xB0U;//写入 ARB、控制
    /*将传递的值复制到仲裁寄存器中。 *
    NODe->IF2ARB &= 0x80000000U;
    NODe->IF2ARB |=(msgBoxArbitVal & 0x7FFFFFFFU);

    /*SAFETYMCUSW 93 S MR:6.1、6.2、10.1、10.2、10.3、10.4 "LDRA 工具问题"*/
    NOode->IF2NO =(uint8) MessageBox;

    while ((node->IF2STAT & 0x80U)=0x80U)

    }/*等待*/