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.

280049C 寄存器CanbRegs.CAN_IF1MCTL.bit.DLC 值会变



在仿真中,右边的图是我赋值后的CanbRegs.CAN_IF1MCTL寄存器的值,表示数据长度为4,但是经过发送数据后发现值变成0,如左图。请问什么情况下这个寄存器的值会变(没有写入的情况),上面怎么解决。

发送程序,用的是C2000的例程里面的函数如下;

void CAN_sendMessage(uint32_t base, uint32_t objID, uint16_t msgLen,
const uint16_t *msgData)

仿真发现在上面的函数的如下语句:

msgCtrl = HWREGH(base + CAN_O_IF1MCTL);

//
// Check provided DLC size with actual Message DLC size
//
ASSERT((msgCtrl & CAN_IF1MCTL_DLC_M) == msgLen);

执行是会出错,错误原因是不相等。但是我并没有对CanbRegs.CAN_IF1MCTL.bit.DLC进行其他的操作(只在初始时进行赋值为4),怎么会这样,谢谢