您好! 我感谢这个社区论坛。
问题-禁用 FIFO 时 UART 标志寄存器的 RXFE 位的行为
场景-在禁用 FIFO 的情况下使用 UART0。 使用 PC 上运行的终端应用程序通过 UART 将一个数据字节发送到 Tiva 板。 我看到的 RXFE (接收 FIFO 空)位
即使接收到通过终端应用发送的1字节数据、UART FR (标志寄存 器)也为1;因此我无法使用 UARTCharGetNonBlocking ()进行读取。 数据表显示-
如果 FIFO 被禁用、则空和满标志将根据1字节深的保持寄存器的状态进行设置。
因此、我希望在接收到数据后该标志位为0。
此外、正如数据表提到的-
两个 FIFO 都可以通过 UART 数据(UARTDR)寄存器访问。
我能够通过直接读取 UART 数据寄存器来访问接收到的字节。
我在这里有2个问题-
为什么 RXFE 指示 UART 接收保持寄存器为空、即使我能够通过直接访问 UART 数据寄存器来读取接收到的字节也是如此?
数据表提到了以下有关 UART 数据寄存器的信息-
重要提示:该寄存器是读敏感的。
读取敏感的含义是什么?
/*** main.c ***/ #include #include #include #include "driverlib/sysctL.h" #include "driverlib/rom.h" #include "UART_handler .h" void controllerInit(); int main () { controllerInit(); UART0_init (); while (1); } void controllerInit() { //设置控制器 rom_sysctl | SYSC_sysctl 1 | SYSC_sysctl 1 | SYSC_sysctl 1 | SYSC_sysctl 1
/*** UART_handler.c ***/ #include "UART_handler .h" // UART0中断服务例程 void UART0_ISR () { volatile UART32_t ui32Status、ui32ReceivedData=0; volatile uint8_t ui8RxData =0; ui32Status = ROM_UART0 (UART0 ) UART0 ) UARTxbase (UART0_UART0_UART0_UART0+ UART0+ UART0+ UART0+ UART0+ UART0+ UART0+ UART0+ UART0+ UART0+ UART0+ UART0+ UART0+ UART0+ UART0+ UART0+ UART0+ UART0+ UART } void UART0_init () { // UART 外设使能 ROM_SysCtlPeripheralEnable (SYSCTL_Periph_UART0); // GPIO 使能、其中包含 UART 引脚 ROM_SysCtlPeripheralEnable (SYSCTL_PERIPH_GPIOA); //主中断使能 ROM_IntMasterEnable (); //配置 UART_PIN_0_GPIO_PUTx (UART_GPIO0) ;//配置 UART_GPIO_PIN_PIN_0_GPIO1引脚 //配置 UART 时钟 ROM_UARTConfigSetExpClk (UART0_BASE、ROM_SysCtlClockGet ()、115200、 (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE); //禁用 FIFO UARTFIFODisable (UART0_BASE); / 启用 UART0_INT_INT_INTERRUPT ;/启用 UART0中断 UARTINT_INT_INT_INT_INT_RIN
/*** UART_handler.h ***/ #ifndef __UART_handler __ #define __UART_handler__ #include #include #include "inc/hw_ints.h" #include "inc/hw_memmap.h" #include "driverlib/debug.h" #include "driverlib/fpu.h" #include "driverlib/gpio.h" #include "driverlib/interrupt.h" #include "driverlib/pin_map.h" #include "driverlib#driver.h"#include "driverlib.idt.idt.idt.idr.eh"#include "#include "driverlib.unicl"#include "driverlib.id.id.id.idr.idr.idr.idr.idr.idr.idr.idr.idr.idr.idr.idr.idr.
