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.

LM4F232 EVK UART0 to UART7

Hi

I have connected PA0 to PK4 directly. Initialize both UART0 and UART7 as the Uart_echo example. Place both UART0/7 interrupt handler in the vector table.

void
UART7IntHandler(void)
{
    unsigned long ulStatus;
    unsigned char prefix[3] = "7";
    
    //
    // Get the interrrupt status.
    //
    ulStatus = UARTIntStatus(UART7_BASE, true);

    //
    // Clear the asserted interrupts.
    //
    UARTIntClear(UART7_BASE, ulStatus);

    //
    // Loop while there are characters in the receive FIFO.
    //
    while(UARTCharsAvail(UART7_BASE))
    {
        UARTSend(prefix, 1);
        //guc_UartRcvd = UARTCharGet(UART7_BASE);
        //UARTCharPutNonBlocking(UART0_BASE,
        //                        UARTCharGetNonBlocking(UART7_BASE));
    }
}

void
UART7Configure(void)
{
    SysCtlPeripheralEnable(SYSCTL_PERIPH_UART7);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOK);

    //
    // Set GPIO K4 and K5 as UART pins.
    //
    GPIOPinConfigure(GPIO_PK4_U7RX);
    GPIOPinConfigure(GPIO_PK5_U7TX);
    GPIOPinTypeUART(GPIO_PORTK_BASE, GPIO_PIN_4 | GPIO_PIN_5);

    //
    // Configure the UART for 115,200, 8-N-1 operation.
    //
    UARTConfigSetExpClk(UART7_BASE, SysCtlClockGet(), 115200,
                            (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |
                             UART_CONFIG_PAR_NONE));

    //
    // Enable the UART interrupt.
    //
    IntEnable(INT_UART7);
    UARTIntEnable(UART7_BASE, UART_INT_RX | UART_INT_RT);
}

One key on PC will trigger the endless of 7 on the hyper-terminal. Why it happens like that?

Thanks,

-Hailin

  • Change the interrupt handler as below. It works.

    void
    UART7IntHandler(void)
    {
        unsigned long ulStatus;
        unsigned char prefix[3] = "7";

        IntDisable(UART7_BASE);
        
        //
        // Get the interrrupt status.
        //
        ulStatus = UARTIntStatus(UART7_BASE, true);

        //
        // Clear the asserted interrupts.
        //
        UARTIntClear(UART7_BASE, ulStatus);

        //
        // Loop while there are characters in the receive FIFO.
        //
        while(UARTCharsAvail(UART7_BASE))
        {
            UARTSend(prefix, 1);
            //guc_UartRcvd = UARTCharGet(UART7_BASE);
            UARTCharPutNonBlocking(UART0_BASE,
                                    UARTCharGetNonBlocking(UART7_BASE));
        }

        IntEnable(UART7_BASE);
    }

  • Use INT_UART7 instead of UART7_BASE in the above interrupt disable and enable lines. Typo.