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.

How to change UART baudrate divisor during transmission?

Other Parts Discussed in Thread: OMAP-L138

Hi,

Say there's OMAP-L138 running an app based on TI BIOS (5.41.10.36), with tasks and UART driver working with HWI dispatcher in FIFO mode. At some point user wants to switch to lower core frequency, maintaining same UART baudrate. The order to go lower is issued in a task. I would like to make the whole change as soon as possible (and quick).

Before I change clocks, baudarate divisor I need(?) to suspend transmission. I'm trying to detect in UART ISR that there's that order using semaphores, however it doesn't work as I expected.

This is a mockup:

void UART_Send()

{

    SEM_pend(sem_uart, SYS_FOREVER);

}

void UART_Suspend()

{

    SEM_pend(sem_uart, SYS_FOREVER);

}

void UART_TxReady_ISR() // FIFO buffer empty ISR
{

    // here I want to give chance for UART_Suspend
    SEM_post(sem_uart); // this doesn't increase count but rather wCount in some subfields
   
    if(SEM_pend(sem_uart, 0)) // this fails
    {
  

        if(no_more_to_tx)
            SEM_post(sem_uart);
        else
        {
            UART_Tx();
        }
    }
   
    return;
}

Have you got ideas how to make this work?

  • Hi Bartoz,

    Since you are using TI BIOS (5.41.10.36), can you please tell me which BIOS PSP are you referring to(or taking reference from)?.

    Coming to your question, I think you can change the baudrate during transmission(on the fly) provided you sacrifice few data since few bytes might get corrupted.

    In order to change the baudrate, you can follow this sequence:

    1.Check if TX FIFO is empty
    2.Calculate new divisor values
    3.Set the DLL and DLH appropriately
    NOTE: Writing to the divisor latches results in two wait states being inserted during the write access while the baud generator is loaded with the new value.

    In case you are referring to PSP 01.30.01, the UART driver provides IOCTL's to change the baudrate appropriately.

    Hope these inputs help you..

    Actually, I am unable to analyse your issue completely. Can you please provide more details about your requirement and elaborate more about your setup.
    Did you try changing the divisor values? Setting up the DLL and DLH? If so, what did you observe?.

     

    Thanks & regards,
    Raghavendra