Daily Archives: 2019-06-29

VoCore2: Interesting issue of UART

I find a weird issue, if I use one VoCore2 UART0 to read another VoCore2 UART2(debug output), I will get some random chars at uboot output stage, then once Linux load UART driver, the output become normal.

Finally I find out the problem, this is because uboot serial port baudrate is not correct…

From MT7628 datasheet, if we want set serial port to 115200Hz, we should set register to 2500000 / 115200Hz = 21.7, but the register only accept integer…in uboot code, it sets register to 21, but in Linux driver code, set it to 22, you see that is a very big difference. In uboot, the real frequency is 2500000 / 21 = 119007Hz, but in Linux, it is 2500000 / 22 = 113636Hz. This difference make the UART can not decode the wave correctly then cause it display the random chars.

Interesting thing is, CP2102 and GD32F150 both do not have such issue. They must using some other way to decode the UART wave, so it can ignore the big gap 🙂

I have updated uboot code(set register to 22, same as Linux UART driver) and uploaded to vocore.io/v2.html download zone, please update and have a try 🙂

To upgrade uboot, in uboot menu, choose ‘7’, then use kermit protocol upload the uboot, rest uboot will do it automatically.