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.

[参考译文] RTOS/TM4C123GH6PM:将 UART.h 与 UART0以外的 UART 模块配合使用。

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

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/584439/rtos-tm4c123gh6pm-using-uart-h-with-a-uart-module-other-than-uart0

器件型号:TM4C123GH6PM

工具/软件:TI-RTOS

大家好、我正在尝试在 TI RTOS 环境中使用 UART 读取距离传感器输出。 是否可以将驱动程序库(UART.h、Board_initUART)与 UART0以外的 UART 外设一起使用? UART0的引脚不可用。 在此代码中,我尝试使用不同的外设进行设置,并已将 EK_TM4C123GXL 文件中的引脚更改为将 pd6和 pd7用于 uart2,但我不确定要用于 UART_open()索引的内容,因为它只接受0,或提供错误。 请提供任何帮助。 谢谢你。

char dist[100];

void task_sonar_fxn (void)
{
UART_Handle uartSonar;
UART_Params uartParams;

UART_PARAMS_INIT (uartParams);
uartParams.baudrate = 9600;
uartParams.readEcho = UART_ECHO_OFF;
uartSonar = UART_open (2、&uartParams);//问题在此行。
if (uartSonar = NULL){
System_abort ("创建 UART 时出错!");
}
UART_READ (uartSonar、dist、100);
} 

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    您是否修改了 UARTTiva_HWAttrs 结构以对 UART2使用 baseAddr 和 intNum? ("EK_TM4C123GXL.c"的第591行和592行?
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    是的、我也编辑了这个结构。 我应该改用 UARTTiva.c 吗?