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.

C6747 PSP 1.30.01 and UART baud rate calculation

Other Parts Discussed in Thread: TL16C752C

Hello,

I am using the PSP 1.30.01 and the UART calculation for the baud rate divider could done a little better.  The code in Uart.c:

   value = (Uint32)((instHandle->deviceInfo.inputFrequency) /
                 (Uint32)((Uint32)Uart_BAUD_MULTIPLIER * (Uint32)baudRate));

    (instHandle->deviceInfo.baseAddress)->DLL = (Uint8)(value & 0xFF);
    (instHandle->deviceInfo.baseAddress)->DLH =  \
                                             (Uint8)((value & 0xFF00) >> 8);

So for my C6747 at 372 MHz (UART clock is 186MHz)  and baud rate of 115200, I get

186000000/(16x115200) = 100.  However 100 produces a baud rate of 116250 (about 0.9% out). This 1% error can be high enough to cause an issue with another TI device I am using (TL16C752C).

A better calculation could be to make the division in float and round it correctly.  This would produce a divider of 101 and the new rate would be 115099 kBaud (about 0.1% error).

In addition maybe both 16 and 13 dividers could be tried to see which comes closet to the requested data rate too.

Thanks,

Fawad