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.
您好!
我在我的设计中使用的是 TMS570lS0714。 我想检测 CAN 外设的 BUS_OFF 状态。 我可以通过读取 CAN_ES 寄存器来实现该目的。 我已将自动恢复时间配置为50毫秒、以便 CAN 重新初始化。
如果在 CAN 外设处于 BUS_OFF 状态时使用"canTransmit"功能触发 CAN 消息、CAN 控制器是否会发出该消息? 还是保持空闲50毫秒?
谢谢、此致、
Sreekanth
这是我的测试用例。 DCAN1 TX 数据和 DCAN2 RX 数据。 我在传输期间更改了 CAN1的波特率、并手动将 CAN_H 和 CAN_L 短接(非常短的时间)以生成 BUS_OFF。 每当 BUS_OFF 发生时、代码将运行到 COUNT=COUNT+1 (虚拟)处的断点。 然后删除断点、再次运行代码、将介绍脱离总线。
while (1)
{
count++;
canMsgBox = 1;
TX_PTR =&TX_DATA[0][0];
canTransmit (canREG1、canMsgBox、TX_PTR);//传输8个不同的数据块1 x 1 */
如果(count==20){
canREG1->CTL |=(uint32) 0x41U;
canREG1->BTR =(uint32)((uint32) 0U << 16U)|
(uint32)((uint32)(2U-1U)<<12U)|
(uint32)(((uint32)((3U + 2U)- 1U)<<8U)|
(uint32)((uint32)(2U-1U)<<6U)|
(uint32) 24U;
canREG1->CTL &=~(uint32)(0x00000041U);
}
if ((canREG1->ES & 0x80)=0x80){
count = count +1;
}
}