TI工程师们:
有点简单问题想请教你们下,我在uart接收中断中打印一个字符并中断中加入MAP_UARTIntClear后,程序只能进入一次中断就再也进不去了,不加MAP_UARTIntClear吧, 中断进个不停。这是还需要其他设置什么吗?? 谢谢
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.
TI工程师们:
有点简单问题想请教你们下,我在uart接收中断中打印一个字符并中断中加入MAP_UARTIntClear后,程序只能进入一次中断就再也进不去了,不加MAP_UARTIntClear吧, 中断进个不停。这是还需要其他设置什么吗?? 谢谢
你好:
程序代码如下:
void
PinMuxConfig(void)
{
//
// Configure PIN_55 for UART0 UART0_TX
//
MAP_PinTypeUART(PIN_55, PIN_MODE_3);
//
// Configure PIN_57 for UART0 UART0_RX
//
MAP_PinTypeUART(PIN_57, PIN_MODE_3);
}
static void UARTIntHandler()
{
unsigned long uflag;
static int count = 0;
uflag=MAP_UARTIntStatus(UARTA0_BASE, 1);
Report("\n\ruart interrupt test: %d\n\r", count++);
MAP_UARTIntClear(UARTA0_BASE, uflag);
}
void main()
{
//
// Initailizing the board
//
BoardInit();
MAP_PRCMPeripheralClkEnable(PRCM_UARTA0,PRCM_RUN_MODE_CLK);
MAP_PRCMPeripheralReset(PRCM_UARTA0);
PinMuxConfig();
//
// Register interrupt handler for UART
//
MAP_UARTIntRegister(UARTA0_BASE,UARTIntHandler);
//
// Enable DMA done interrupts for uart
//
MAP_UARTIntEnable(UARTA0_BASE,UART_INT_RX);
//
// Initialising the Terminal.
//
MAP_UARTConfigSetExpClk(CONSOLE,MAP_PRCMPeripheralClockGet(CONSOLE_PERIPH),
UART_BAUD_RATE,
(UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |
UART_CONFIG_PAR_NONE));
UARTFIFOLevelSet(UARTA0_BASE,UART_FIFO_TX1_8,UART_FIFO_RX1_8);
//
// Clear terminal
//
ClearTerm();
DisplayBanner("UartIntTest");
Message("input char:");
while(1);
}}
你本身用的就是UART0, 但是在中断处理函数里面你调用了Report("\n\ruart interrupt test: %d\n\r", count++);, 事实上Report也是用UART0打印。你这样是有问题的。
请问 这个问题解决了没?
MAP_UARTIntRegister(UARTA0_BASE,UARTIntHandler); 这个回调函数 是不是串口只要来数据,就会自动跳转到UARTIntHandler函数去啊, 我实验一直不执行UARTIntHandler这个函数,不回调。