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.

[参考译文] TMS320F280039C:CAN 模块只能发送预设的消息长度。

Guru**** 2461030 points


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

https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1503396/tms320f280039c-only-the-preset-message-length-can-be-sent-in-the-can-module

器件型号:TMS320F280039C

工具/软件:

大家好、TI 工程师、

  调试 CAN 模块时、发现如果我在初始化期间将特定邮箱的长度设置为8个字节。 如果我调用 can_sendMessage()、则传入的 msgLen 为4、而发送的消息的实际长度仍为8个字节。

  我尝试将 can_sendMessage ()函数中 can_writeDataReg ()的 size 参数调整为 msgLen。 即 can_writeDataReg (msgData、(base + CAN_O_IF1DATA)、msgLen)。

  但实际输出仍是8个字节。 因此,我想问 CAN 模块发送的 CAN 总线的实际长度是否只能是 can_setupMessageObject ()设置的长度? 例如、我将其设置为8、但实际上要发送4个字节。 我是否必须将其重置为4个字节然后再发送数据?  

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

    尊敬的 Zhen:

    如果你想发送一条消息与更新的字节有效负载,请使用 API can_sendMessage_updateDLC()。  您可以在参数中指定新的长度。

    此致、

    Joseph