AnsweredAssumed Answered

processor expert bug - UART baud rate

Question asked by ZOHAR GOLAN on Jun 10, 2016
Latest reply on Jun 15, 2016 by Alice_Yang

I had to set up uart with 2 modes of operation, one in 115200bps and one in higher baud rate.

When I’ve set the second mode to be 921600bps, it was working fine, but when I set it to be 3250000bps, the transmission was actually at ~900kbs instead.

Found out in file ASerialLdd2.c
in function ASerialLdd2_SelectBaudRate there
is an array holding the possible values for register UART2_C4 field BRFA and registers UART2_BDH and UART2_BDL

BD is holding the baudrate divider and BRFA is holding the fine adjustment value.

 

The calculation is

Baudrate = UART
device clock/(16*(BD+BRFA/32)) = 96MHz/(16*(BD+BRFA/32))

 

The original lines were

static const uint8_t ASerialLdd2_BaudAdjustValueSpeed0[0x02] = {0x02u,0x10u};

static const uint16_t ASerialLdd2_BaudDivisorSpeed0[0x02] = {0x34u,0x06u};

This gave ~900Kbps to mode 1

 

The modified lines are

static const uint8_t ASerialLdd2_BaudAdjustValueSpeed0[0x02] = {0x02u,0x1bu};

static const uint16_t ASerialLdd2_BaudDivisorSpeed0[0x02] = {0x34u,0x01u};

This gives 3250000bps to mode 1 (as intendant)

 

Why is that?

 

Thanks,

Zohar

Outcomes