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.

TM4C1231D5PM: UART_ECHO Example Incorrect Baud Rate

Part Number: TM4C1231D5PM

I am running the uart_echo example on a TM4C1231D5PM microcontroller. The baud rate is set for 115,200 bps,

//
// Configure the UART for 115,200, 8-N-1 operation.
//
MAP_UARTConfigSetExpClk(UART0_BASE, MAP_SysCtlClockGet(), 115200,
                        (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |
                         UART_CONFIG_PAR_NONE));

but I only receive correct data at 38,400 bps.

Does any one have an idea on how to increase the baud rate to 115,200? When I set it to 115,200 on my computer the data is scrambled.

I should note I changed the oscillator from an external crystal to the internal oscillator,

//
// Set the clocking to run directly from the crystal.
//
MAP_SysCtlClockSet(SYSCTL_OSC_INT);

Thanks,

Allan

  • Not sure if this is a good idea, but I fixed this problem by increasing the clock speed in uart config.

    //
    // Configure the UART for 115,200, 8-N-1 operation.
    //
    MAP_UARTConfigSetExpClk(UART0_BASE, 3*ROM_SysCtlClockGet(), 115200,
                            (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |
                             UART_CONFIG_PAR_NONE));

  • Hello Allan,

    I don't agree that your issue should be fixed as you have done it.

    Your System Clock setting is missing too many parameters:

    MAP_SysCtlClockSet(SYSCTL_OSC_INT | SYSCTL_USE_OSC | SYSCTL_SYSDIV_1);

    That is the correct clock configuration. Try using that and then remove the 3* from your UART.

    If there is still an issue, look for a UARTClockSourceSet call to see if it's setting the UART clock source to something unexpected.

    Best Regards,

    Ralph Jacobi