Thread 中讨论的其他器件:SysConfig
将 SysConfig 工具更新到 SysConfig (1.10.0+2163)后、我遇到了命名 CAN 接口的问题。
我添加了两个 CAN 模块、并将它们命名 为"CAN_A"和"CAN_B"。 下面是生成的 BoardCfg.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 --device "F2838x" --package "176pin" --part "F2838x_176pin" --product "C2000WARE@3.01.00.00" * @versions {"tool":"1.10.0+2163"} */ /** * Import the modules used in this configuration. */ const can = scripting.addModule("/driverlib/can.js", {}, false); const can1 = can.addInstance(); const can2 = can.addInstance(); /** * Write custom configuration values to the imported modules. */ can1.$name = "CAN_A"; can1.can.$assign = "CANA"; can1.can.can_rxPin.$assign = "ball.83"; can1.can.can_txPin.$assign = "ball.84"; can2.$name = "CAN_B"; can2.can.$assign = "CANB"; can2.can.can_rxPin.$assign = "ball.86"; can2.can.can_txPin.$assign = "ball.85";
生成的"board.c"的问题部分
void CAN_init(){ //CAN_A initialization CAN_initModule(CAN_A_BASE); // Refer to the Driver Library User Guide for information on how to set // tighter timing control. Additionally, consult the device data sheet // for more information about the CAN module clocking. // CAN_setBitTiming(CAN_A_BASE, 15, 0, 15, 7, 3); // // Start CAN module operations // CAN_startModule(myCAN0_BASE); //CAN_B initialization CAN_initModule(CAN_B_BASE); // Refer to the Driver Library User Guide for information on how to set // tighter timing control. Additionally, consult the device data sheet // for more information about the CAN module clocking. // CAN_setBitTiming(CAN_B_BASE, 15, 0, 15, 7, 3); // // Start CAN module operations // CAN_startModule(myCAN0_BASE); }
因此、我无法编译我的项目时出现错误:
说明资源路径位置类型
#20标识符"myCAN0_BASE"未定义 board.c /test_F28384S/Debug/syscfg 第179行 C/C++问题
gmake:***[syscfg/board.obj]错误1 test_F28384S C/C++问题
第一个 CAN 模块唯一可接受的名称是默认值:"myCAN0"。 对默认名称的任何更改都会导致编译错误。
从"board.c" 中可以看到、CAN_init()也存在 CAN_startModule 问题。 对于第二次调用、它使用相同的参数"myCAN0_BASE"而不是"CAN_B"来调用这两次。
//
//启动 CAN 模块操作
//
CAN_startModule (myCAN0_BASE);
(笑声)
//
//启动 CAN 模块操作
//
CAN_startModule (myCAN0_BASE);
作为一种权变措施、我删除了所有 CAN 模块、并使用默认名称再次添加它们、并成功编译了工程。