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.

[参考译文] TMS320F28069M:CAN STDMSGID 和本地接受屏蔽

Guru**** 2589265 points
Other Parts Discussed in Thread: CODECOMPOSER

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

https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1300196/tms320f28069m-can-stdmsgid-and-local-acceptance-mask

器件型号:TMS320F28069M
主题中讨论的其他器件:CODECOMPOSER

我在 spra876b 中提到了 can_LAM 示例、但我仍在努力地配置一个接收邮箱、可以接受所有标准(11位) msgids。

到目前为止、我已经尝试了:

    //
    // Disable all Mailboxes
    // Required before writing the MSGIDs
    //
    ECanaRegs.CANME.all = 0;
    
    // set the STDMSGIDs to anything, it doesn't matter because all
    // msgids will be transmitted out on mailbox 0, and all
    // msgids will be received on mailbox 1.
    ECanaMboxes.MBOX0.MSGID.all = 0;
    ECanaMboxes.MBOX1.MSGID.all = 0;
    ECanaMboxes.MBOX0.MSGID.bit.STDMSGID = 0x649;
    ECanaMboxes.MBOX1.MSGID.bit.STDMSGID = 0x648;
    
    ECanaMboxes.MBOX1.MSGID.bit.AME = 1;  // use the mbox1 acceptance mask to accept any msgid

    // set the flag indicating standard msgids (11 bit) only
    // IDE = 0 indicates 11 bits
    ECanaMboxes.MBOX0.MSGID.bit.IDE = 0;
    ECanaMboxes.MBOX1.MSGID.bit.IDE = 0;
    
    ECanaShadow.CANMD.all = ECanaRegs.CANMD.all;
    ECanaShadow.CANMD.bit.MD0 = 0;                // mailbox 0 is transmit
    ECanaShadow.CANMD.bit.MD1 = 1;                // mailbox 1 is receive
    ECanaRegs.CANMD.all = ECanaShadow.CANMD.all;
    
    ECanaLAMRegs.LAM1.all  = 0xFFFFFFFF;  // set mbox 1 local acceptance mask to ignore all bits so any msgid is received

    ECanaLAMRegs.LAM1.bit.LAMI = 0;         // mbox 1 IDE bit should determine that only 11 bit msgids should be accepted

    //
    // Enable Mailboxes 0, and 1
    //
    ECanaShadow.CANME.all = 0x00000000;
    ECanaShadow.CANME.bit.ME0 = 1;
    ECanaShadow.CANME.bit.ME1 = 1;
    ECanaRegs.CANME.all = ECanaShadow.CANME.all;
    
    //
    // Specify that 8 bits will be sent/received
    //
    ECanaMboxes.MBOX0.MSGCTRL.bit.DLC = 8;
    ECanaMboxes.MBOX1.MSGCTRL.bit.DLC = 8;

我能够通过复位 ECanaMbags.MBOX0.MSGID.bit.STDMSGID 的每次传输来配置单次发送邮箱(0)。

但我的接收邮箱(1)将只接收标准 msgid = 0x648。

感谢您的任何建议。