Since the GD32F103 can run as fast as 108MHz but has not a proper USB clock divider to provide a 48MHz clock for USB communication we need another way to communicate with the outside world. Since the early days of computing the easiest way to go is a asynchronous serial interface using the UART peripheral. I can try to explain how this protocol works, but here is a better write-up.
The test setup is quite simple, but uses all UART ports. Both chips have 3 UART peripherals which I put in series to form a daisy chain. To test if the peripherals work the code echoes each received byte back. If everything is ok the byte is echoed back to the console. I used the onboard usb-serial port provided on the blackmagic probe to check if everything gets across. (In)fortunately it works as expected and both chips worked fine. Both chips generated a bittime of 8.7us which is spot on. I gonna use the UART peripheral in the next challenges for debugging and status reporting.
The reason of the USB clock divder f*ckup is probably they expected that the silicon is able to run with a clock of 120MHz, as there is a divider of 2.5 present. I’m planning to do some overclocking as (one of) the last episodes in this series. Don’t have any experience in this field so help is welcome. As I found a reliable source of GD32 chip I’m planning to spin a small run of development boards (the same as used in this series), the expected price will be around the 10 EUR mark. If interested please leave comment or use the contact us page.
As always the code is found on my GitHub page.
This post is part of a series where the STM32 is compared to the GD32: