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.

Using UART MDR x13 Oversampling

Hi,

I changed the UART MDR's OSM_SEL from  x16 oversampling to x13, and left other setting unchanged. So the Input Clock Frequency is 150 MHz. With x16 oversampling, everything works well, but it didn't work (nothing was sent out from the UART) when I changed it to x13 oversampling. I tested both codes with a Baudrate (38400) that yields low error. So it should work.

Does anyone know what had I done wrong? Is there other things to be changed?

Thanks for your help. Appreciate it.

CB

  • Dear Chee-Beng,

    What is your processor ?
    Which package are you using ?
    Starterware or Linux OS ?

    The following code is based on UART module clock and sampling rate.

    Actual example code:
    /* Configuring the UART parameters*/
    UARTConfigSetExpClk(SOC_UART_2_REGS, SOC_UART_2_MODULE_FREQ,
    BAUD_115200, config,
    UART_OVER_SAMP_RATE_16);

    Modified:

    /* Configuring the UART parameters*/
    UARTConfigSetExpClk(SOC_UART_2_REGS, SOC_UART_2_MODULE_FREQ,
    BAUD_115200, config,
    UART_OVER_SAMP_RATE_13);

    Driver part:

    void UARTConfigSetExpClk (unsigned int baseAdd, unsigned int uartClk,
    unsigned int baudrate, unsigned int config,
    unsigned int overSampRate)
    {
    unsigned int divisor = 0;

    /* Calculating the divisor value */
    switch (overSampRate)
    {
    case UART_OVER_SAMP_RATE_13:
    divisor = uartClk/(baudrate * 13);
    HWREG(baseAdd + UART_MDR) = UART_OVER_SAMP_RATE;
    break;

    case UART_OVER_SAMP_RATE_16:
    default:
    divisor = uartClk/(baudrate * 16);
    HWREG(baseAdd + UART_MDR) &= ~UART_OVER_SAMP_RATE;
    break;
    }