TI中文支持网
TI专业的中文技术问题搜集分享网站

TMS320F280049C: 使用SYSBIOS+C2000WARE+Sysconfig,用Sysconfig配置CAN生成board.c文件存在的BUG

Part Number:TMS320F280049COther Parts Discussed in Thread:C2000WARE, SYSCONFIG

.syscfg文件中CAN配置:

can1.$name= "CAN";
can1.enableInterrupt= true;
can1.interruptFlags= ["CAN_INT_ERROR","CAN_INT_IE0","CAN_INT_IE1","CAN_INT_STATUS"];
can1.interruptLine= ["CAN_GLOBAL_INT_CANINT0","CAN_GLOBAL_INT_CANINT1"];
can1.can.$assign= "CANA";
can1.can.can_rxPin.$assign = "GPIO30";
can1.can.can_txPin.$assign = "GPIO31";

生成borad.c文件中CAN初始化代码:

void CAN_init(){//CAN initializationCAN_initModule(CAN_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_setBitRate(CAN_BASE, DEVICE_SYSCLK_FREQ, 500000, 20);// Enable CAN InterruptsCAN_enableInterrupt(CAN_BASE, CAN_INT_ERROR|CAN_INT_IE0,CAN_INT_IE1,CAN_INT_STATUS);CAN_enableGlobalInterrupt(CAN_BASE, CAN_GLOBAL_INT_CANINT0);CAN_enableGlobalInterrupt(CAN_BASE, CAN_GLOBAL_INT_CANINT1);
}

C2000WARE中CAN_enableInterrupt原型:

static inline void CAN_enableInterrupt(uint32_t base, uint32_t intFlags);

Sysconfig生成的board.c文件与C2000WARE的CAN_enableInterrupt不对应。导致编译错误。

编译错误提示:

Susan Yang:

若是可以的话,能否给出或私信一下您的工程,我们具体看一下?谢谢

,

Gaobao Li:

简单来说:

sysconfig生成的文件中,CAN_init部分实际生成:

CAN_enableInterrupt(CAN_BASE, CAN_INT_ERROR|CAN_INT_IE0,CAN_INT_IE1,CAN_INT_STATUS);

正确应该生成:

CAN_enableInterrupt(CAN_BASE, CAN_INT_ERROR | CAN_INT_IE0 | CAN_INT_IE1 | CAN_INT_STATUS);

更简单地说:就是中断标志应该用或("|")运算而不是使用逗号,使用逗号使一个参数变成了多个参数。

,

Susan Yang:

我会在测试后给您回复

,

Susan Yang:

下面有一个关于如何将 C2000Ware/driverlib 支持添加到现有 SYS/BIOS 项目的教程:

https://e2e.ti.com/support/microcontrollers/c2000/f/c2000-microcontrollers-forum/989425/faq-how-do-i-use-c2000ware-files-in-a-sys-bios-project

创建 C2000Ware+SYS/BIOS 项目后,请按照本教程将 SysConfig 添加到现有项目:

https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/910829/faq-how-do-i-add-sysconfig-support-pinmux-and-peripheral-initialization-to-an-existing-driverlib-project

我大体试了一下,并没有编译错误。

能否给出您的工程?

赞(0)
未经允许不得转载:TI中文支持网 » TMS320F280049C: 使用SYSBIOS+C2000WARE+Sysconfig,用Sysconfig配置CAN生成board.c文件存在的BUG
分享到: 更多 (0)

© 2024 TI中文支持网   网站地图 鲁ICP备2022002796号-1