主题中讨论的其他器件:SN65HVD23
工具与软件:
我使用 syscfg 生成驱动程序代码、我在例程中参考了 Ex1、Ex2和 Ex5、预期的效果是当我从外部 CAN 分析仪发送数据时、CANB 收到中断并回复消息。 但实际效果是使用逻辑分析仪直接观察 CANB 收发器引脚(引脚12和引脚13)、只有处于外部环回模式的发送引脚可以观察传出数据、只有在静音模式下接收引脚上的数据才会导致接收中断。
在这里、我插入 syscfg 和我的一些代码:
/** * These arguments were used when this file was generated. They will be automatically applied on subsequent loads * via the GUI or CLI. Run CLI with '--help' for additional information on how to override these arguments. * @cliArgs --board "/boards/LAUNCHXL_F280049C" --context "system" --product "C2000WARE@4.03.00.00" * @versions {"tool":"1.20.0+3587"} */ /** * Import the modules used in this configuration. */ const can = scripting.addModule("/driverlib/can.js", {}, false); const can1 = can.addInstance(); /** * Write custom configuration values to the imported modules. */ can1.$name = "myCAN0"; can1.enableInterrupt = true; can1.registerInterrupts = true; can1.interruptFlags = ["CAN_INT_IE0"]; can1.interruptLine = ["CAN_GLOBAL_INT_CANINT0"]; can1.msgObjsUsed = [1,2]; can1.can.can_rxPin.$assign = "boosterpack1.3"; can1.can.can_txPin.$assign = "boosterpack2.51"; can1.can0Int.enableInterrupt = true; can1.msgObj1.$name = "msgObj0"; can1.msgObj1.msgType = "CAN_MSG_OBJ_TYPE_TX"; can1.msgObj1.flags = ["CAN_MSG_OBJ_TX_INT_ENABLE"]; can1.msgObj1.msgLen = 4; can1.msgObj2.$name = "msgObj1"; can1.msgObj2.flags = ["CAN_MSG_OBJ_RX_INT_ENABLE"]; /** * Pinmux solution for unlocked pins/peripherals. This ensures that minor changes to the automatic solver in a future * version of the tool will not impact the pinmux you originally saw. These lines can be completely deleted in order to * re-solve from scratch. */ can1.can.$suggestSolution = "CANB";