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.

UART Interrupt

Hi all, good morning

I'm using the demo board DK-TM4C129x Tiva microcontroller Series  for send/receive data from/to PC via RS232 connection.

I already got a hardware connection. But I can' run  only the Ti polling  examples code.

The code for interrupt driven not warking, because interrupt don't became handled.

I'm using UART5.

In the follow my code:

//*****************************************************************************
//  UART5  interrupt handler.
//*****************************************************************************


void UARTIntHandler(void)
{
    uint32_t ui32Status;

    // Get the interrrupt status.
    ui32Status = UARTIntStatus(UART5_BASE, true);

    // Clear the asserted interrupts.
    UARTIntClear(UART5_BASE, ui32Status);

    // Loop while there are characters in the receive FIFO.
    
    while(UARTCharsAvail(UART5_BASE))
    {
        
        // Read the next character from the UART and write it back to the UART.
        UARTCharPutNonBlocking(UART5_BASE,
                                   UARTCharGetNonBlocking(UART5_BASE));        
    }
}

//*****************************************************************************
// Send a string to the UART.
//*****************************************************************************
void UARTSend(const uint8_t *pui8Buffer, uint32_t ui32Count)
{
    
    // Loop while there are more characters to send
    while(ui32Count--)
    {
        
        // Write the next character to the UART.
        UARTCharPutNonBlocking(UART5_BASE, *pui8Buffer++);
    }
}

//*****************************************************************************
// UART5 interrupt main
//*****************************************************************************
int main(void)
{
    uint32_t ui32SysClock;
    tContext sContext;

    
    // Run from the PLL at 120 MHz.
    
    ui32SysClock = SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ |
                                      SYSCTL_OSC_MAIN |
                                      SYSCTL_USE_PLL |
                                      SYSCTL_CFG_VCO_480), 120000000);

    SysCtlPeripheralEnable(SYSCTL_PERIPH_UART5);                // UART5
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOH);                // GPIOH


    IntMasterEnable();            // Enable processor interrupts.
        
    // Set GPIO PH6 and PH7 as UART5 pins.
    
    GPIOPinConfigure(GPIO_PH6_U5RX);
    GPIOPinConfigure(GPIO_PH7_U5TX);
    ROM_GPIOPinTypeUART(GPIO_PORTH_BASE, GPIO_PIN_6 | GPIO_PIN_7);

    // Configure the UART5 for 115,200, 8-N-1 operation.
    
    UARTConfigSetExpClk(UART5_BASE, ui32SysClock, 115200,
                            (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |
                             UART_CONFIG_PAR_NONE));
            

    IntEnable(INT_UART5);
    UARTIntEnable(UART5_BASE, UART_INT_RX| UART_INT_RT);
       
    // Prompt for text to be entered.
    
    UARTSend((uint8_t *)"Enter text: ", 12);

    // Loop forever echoing data through the UART.


    while(1)
    {
    }
}

Thanks a lot

M