[BPI-M1] UART only works with baud rates of 9600 and 115200 but not higher speeds

Hello everyone,

Using BPI-M1 here. We are currently connecting a device to UART 7 on J12 and it works great at baud rates of 9600 and 115200. Works as expected. no problems at these speeds at all.

But when we try to communicate at higher speeds and test the signals using a scope we see that the actual baud rate is different. for example when try to set the speed to 460,800 the actual speed we get is 500,000.

The device we connected to the BPI via UART works great at higher speeds. we tested that and made sure its not the source of the problem.

Is there some additional setting that I’m missing for the UART baud rate to work at higher speeds than 115200 ?

Thank you!

Hi behappy,

I don’t know if this can help but from the A20 manual

https://www.google.it/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0ahUKEwjF8O3by4jMAhXMbRQKHfygD4oQFgggMAA&url=http%3A%2F%2Fdl.linux-sunxi.org%2FA20%2FA20%20User%20Manual%202013-03-22.pdf&usg=AFQjCNEBXwpQYxEeTNNOv6wgrgstSFGc2g

the UART baud is derived from the following rule: Baud Rate = (serial clock freq)/(16*divisor)

Where divisor is stored in the following UART registers UART_DLL and UART_DLH, holding the lower and higher 8 bits of the divisor respectively. (Page 648).

So not all baud rates can be generated exactly, but only with approximation. First thing to check, in my opinion, is how this approximation is evaluated in the driver or better how divisor is evaluated from baudrate value you pass to the driver. Second thing to check is the value of serial clock freq.

Now the serial clock freq is derived from the external 24MHz crystal, according to the manual (Page 33), all peripherals (including UART) are driven by APB_clk, you can see how APB_clk is generated in clock tree diagram (Page 34).

I didn’t find any indication to understand if serial clock freq is APB0 or APB1, maybe sinovoip has this information.

Hope this can help to try to find the nature of the problem.

Please post any solution you can find to the problem.

Regards Snafuzz