This my uart code. When i change uart1 interrupt, it doesn't work. but uart0 wroks. Where is my mistake?
Thanks
#include <stdint.h> #include <stdbool.h> #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/rom.h" #include "driverlib/sysctl.h" #include "driverlib/uart.h" #include "utils/uartstdio.h" void ConfigureUART0(void) { ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0); ROM_GPIOPinConfigure(GPIO_PA0_U0RX); ROM_GPIOPinConfigure(GPIO_PA1_U0TX); ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1); UARTClockSourceSet(UART0_BASE, UART_CLOCK_PIOSC); UARTStdioConfig(0, 115200, 16000000); } void ConfigureUART1(void) { SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB); SysCtlPeripheralEnable(SYSCTL_PERIPH_UART1); GPIOPinConfigure(GPIO_PB0_U1RX); GPIOPinConfigure(GPIO_PB1_U1TX); GPIOPinTypeUART(GPIO_PORTB_BASE, GPIO_PIN_0 | GPIO_PIN_1); UARTClockSourceSet(UART1_BASE, UART_CLOCK_PIOSC); UARTConfigSetExpClk(UART1_BASE, 16000000, 115200, (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE)); UARTEnable(UART1_BASE); } //***************************************************************************** // // The UART interrupt handler. // //***************************************************************************** void UARTIntHandler(void) { unsigned long ulStatus; // Get the interrrupt status. ulStatus = ROM_UARTIntStatus(UART1_BASE, true); // Clear the asserted interrupts. ROM_UARTIntClear(UART1_BASE, ulStatus); // Loop while there are characters in the receive FIFO. while (ROM_UARTCharsAvail(UART1_BASE)) { // Read the next character from the UART and write it back to the UART. ROM_UARTCharPutNonBlocking(UART1_BASE, ROM_UARTCharGetNonBlocking(UART1_BASE)); } GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, GPIO_PIN_2); SysCtlDelay(SysCtlClockGet() / (1000 * 3)); GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, 0); } //***************************************************************************** // // Send a string to the UART. // //***************************************************************************** void UART0Send(const uint8_t *pui8Buffer, uint32_t ui32Count) { while(ui32Count--) { ROM_UARTCharPutNonBlocking(UART0_BASE, *pui8Buffer++); } } void UART1Send(const uint8_t *pui8Buffer, uint32_t ui32Count) { while(ui32Count--) { ROM_UARTCharPutNonBlocking(UART1_BASE, *pui8Buffer++); } } //***************************************************************************** // // This example demonstrates how to send a string of data to the UART. // //***************************************************************************** int main(void) { ROM_FPUEnable(); ROM_FPULazyStackingEnable(); ROM_SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN |SYSCTL_XTAL_16MHZ); ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF); // Enable the GPIO pins for the LED (PF2). ROM_GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_2); ConfigureUART0(); ConfigureUART1(); ROM_IntMasterEnable(); ROM_IntEnable(INT_UART1); ROM_UARTIntEnable(UART1_BASE, UART_INT_RX | UART_INT_RT); // Prompt for text to be entered. UART0Send((uint8_t *)"\033[2JEnter text: ", 16); UART1Send((uint8_t *)"UART1\n\r", 7); // UART2Send((uint8_t *)"UART2\n\r", 7); while(1) { } }