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.

EK-TM4C1294XL UART ERROR

Hi,
I'm trying to get a character by uart by interrupt. But I always get the value 0xff. the interrupt is this:

UARTIntHandler(void)
{
uint32_t ui32Status;
char data = 0;

ui32Status = ROM_UARTIntStatus(UART2_BASE, true);

ROM_UARTIntClear(UART2_BASE, ui32Status);

while(ROM_UARTCharsAvail(UART2_BASE))
{
data = UARTCharGetNonBlocking( UART2_BASE );

UARTCharPut(UART0_BASE, data);

}

}

Any amount you type in uart 2 RX always sends to "data" the value 0xff in uart0. Why?

regards

  • Hello Vitor,

    Can you put a break point for the UART Interrupt Handler and read the data from the UART register using memory browser? What do you get?

    Also when doing this experiment ensure that only one character is being sent to UART2

    Regards

    Amit

  • Hey Vitor,

    can you verify that you are correctly sending on the UART0? Do you have an oscilloscope there?

    Also verify the used UART Settings

    • Baud Rate
    • StopBit
    • Parity
    • Data Bits

    You should also check the DATA Register of your UART0 Module if you are sure you used all the right settings and there actually is something on your RX Line.

    How is your Hardware wired up? Are you sending from your PC to an Evaluation Board? Virtual COM Port over USB?

    Also, the initialization routine of your UART Module would help loads.

    Regards,

     

    Michel

  • Many thanks for your quick response.
    My problem is this: I have to interrupt for the RX 2, when receiving a character in RX2 want to save in "data" and immediately after writing in TX0. But when I write in TX0 the value is always 0xFF!
    Sending the output read by a logic analyzer.

    Write "a" but I read "0xff"?

    Best regards

    Vitor

  • Settings:

    //
    // Configure debug port for internal use.
    //
    UARTStdioConfig(0, 115200, g_ui32SysClock);

    // Enable the peripherals.
    //
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART2);
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);

    //
    // Enable processor interrupts.
    //
    ROM_IntMasterEnable();


    //
    // Set GPIO A6 and A7 as UART 2 pins.
    //
    GPIOPinConfigure(GPIO_PA6_U2RX);
    GPIOPinConfigure(GPIO_PA7_U2TX);
    ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_6 | GPIO_PIN_7);

    //
    // Configure the UART 2 for 38200, 8-N-1 operation EVEN.
    //
    ROM_UARTConfigSetExpClk(UART2_BASE, g_ui32SysClock, 38200,
    (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |
    UART_CONFIG_PAR_NONE)); //UART_CONFIG_PAR_EVEN

    //
    // Enable the UART interrupt.
    //

    ROM_IntEnable(INT_UART2);
    ROM_UARTIntEnable(UART2_BASE, UART_INT_RX | UART_INT_RT);

  • Hello Vitor,

    It looks to be a baud rate problem. The UART-2 is configured for 38200 bps. This would be a total time of 261us for sending one character. The LA plot shows a value less than 100us(~80us). This would be synonymous with 115200 bps. I bet the TX is not configured correctly.

    Regards

    Amit

  • OK had the uart0 baud 115200, and the uart2 baud 38200. Uart0 and UART2 to 38200 and now works correctly. I do not have much experience with microcontrollers from TI, come from micro****  ... TI is currently much more stable...
    Thank you very much for your help!

    Regards

    Vitor