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

CC1310 System_printf 定向到串口 报错

CC1310 进行System_printf的重定向,到串口;

参考的是SimpleLink Academy 中debug任务5,使用empty例程

问题是:

1.没有文中提及的empty.syscfg

2.加入UARTUtils.c和UARTUtils.h编译报错:#1965 cannot open source file "ti_drivers_config.h"

应该是 CONFIG_UART_0引用到上述文件,CONFIG_UART_0未被定义。

请问应该如何修改?谢谢!

Kevin Qiu1:

CC1310 目前还不支持syscfg,直接使用Display_printf比较方便

lin jqi:

回复 Kevin Qiu1:

Display_printf()在Academy中提到不能做为接收:
“When using the UART, the Display_printf API sets up the UART instance to be transmit only (unless you want to modify the code in the SDK). The other debug APIs allow the UART instance to be set up for transmit and receive.”
这样我们就需要再增加另外的引脚进行接收功能,所以想看能否通过System_printf完成串口打印与串口命令输入。

Kevin Qiu1:

回复 lin jqi:

Academy中是基于CC13X2和CC26X2 等支持syscfg 的SDK实现的,ti_drivers_config.h也是syscfg 生成的文件,CC1310SDK中没有此文件

lin jqi:

回复 Kevin Qiu1:

这样还是没有办法解决串口输入的问题啊。。。
是否可以修改一下UARTUtils.c来适应CC1310呢?
比如CONFIG_UART_0这个变量应该是在ti_drivers_config.h定义的,我们直接赋值CONFIG_UART_0?
不确定是否还有其他问题

Kevin Qiu1:

回复 lin jqi:

syscfg是图形化配置工具,相比之前的配置方式改动比较大

ti_drivers_config.h中的配置,你可以看下:

/**======== UART ========*//**TX: DIO3*RX: DIO2*XDS110 UART*/
extern const uint_least8_tCONFIG_DISPLAY_UART_CONST;
#define CONFIG_DISPLAY_UART0
#define CONFIG_TI_DRIVERS_UART_COUNT1

一些说明:

UART Instance Configuration Options
Name [inst.$name = 'CONFIG_UART_{num}']The C/C++ identifier used in applications as the index parameter passed to UART runtime APIs

This name is declared in the generated ti_drivers_config.h file so applications can reference this instance symbolically. Additionally, this name is used to declare an 'extern const' which allows libraries to define symbolic names for required driver configurations without needing to rebuild library source files. The 'const' identifier is declared as the same name with a _CONST suffix. The name can be set to any globally unique name that is also a valid C/C++ identifier.

The SysConfig tooling ensures that all names defined in a configuration are unique. When instances are first created, SysConfig gives them a default name, CONFIG_UART_, that's made unique by appending a numeric id. If you provide a name, it's checked against all other instance names in the configuration and, if another instance has the same name, an error is triggered. The additional 'const' declaration is assumed to also be globally unique.

Note: since not all names are added to ti_drivers_config.h, it's possible that some names will not be allowed even though they do not actually collide in the generated files.

lin jqi:

回复 Kevin Qiu1:

非常感谢,可行!

Kevin Qiu1:

回复 lin jqi:

问题解决就好

赞(0)
未经允许不得转载:TI中文支持网 » CC1310 System_printf 定向到串口 报错
分享到: 更多 (0)