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.

[参考译文] TMS320F28384S:SysConfig (1.10.0+2163) CAN 接口命名问题

Guru**** 2394295 points
Other Parts Discussed in Thread: SYSCONFIG

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

https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1048745/tms320f28384s-sysconfig-1-10-0-2163-can-interfaces-naming-problem

器件型号:TMS320F28384S
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 模块、并使用默认名称再次添加它们、并成功编译了工程。

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

    是的、我们已经发现了此问题。 我们在内部对其进行了修复。 这也是一个非常快速的解决方法。

    、您能否指导客户更新其 driverlib/.meta/can 文件夹中的 JS 代码一行?

    我还认为这位客户提到了解决方法。

    https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1046816/bug-in-new-4-0-0-0-c2000-ware

    NIMA

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    [引用 userid="280106" URL"~/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1048745/tms320f28384s-sysconfig-1-10-0-2163-can-interfaces-naming-problem/3880828 #3880828"]您能否指导客户更新其 driverlib/.meta/can 文件夹中的 JS 代码一行?

    转至 driverlib/.meta/can 文件夹和文件"can.board.c.xdt"

    //
    // Start CAN module operations
    //
    CAN_startModule(myCAN0_BASE);                   (line 60)

    将上述代码(第60行)替换如下:

    //
    // Start CAN module operations
    //
    CAN_startModule(`instance.$name`_BASE);

    这将确保 START 函数具有使用 SysConfig 定义的参数。

    Sahil