Most of us do know the ST line of ARM chips called STM32. They come in multiple flavours and the STM32F103 is one of the most common entry level family of chips. They are called by ST as mainstream. They are a full featured 32 bit ARM Cortex M3 chip running at max. 72MHz with all the requisite peripherals like ADC, DAC, USB, CAN, I2C, I2S, SPI, SDIO, PWM, RTC, interrupts and various timers. Lets zoom into the STM32F103C8 chip (which seems the be the go-to choice of the Chinese el-cheapo development breakout boards):
- upto 72Mhz clock speed, 1.25 DMIPS/MHz
- 128K byte Flash ROM
- 20K byte SRAM
- RTC with 20 bytes battery backup RAM
- 2x 12-bit ADC (1μs sampletime, 10 channels)
- 7 channel DMA (support for timers, ADC, SPI, I2C and USART)
- 36 I/O (about half of that is 5V tolerant)
- Serial wire debug (SWD) & JTAG interfaces
- 7 timers (3x 16bit for PWM, 1x 16bit for PWM motor control, 2 watchdog, 1x systick)
- 2x I2C (PMBUS and SMBUS compatible)
- 3x USARTs (ISO 7816 interface, LIN, IrDA capability, modem control)
- 2x SPIs (18 Mbit/s)
- 1x CAN interface (2.0B Active)
- USB 2.0 full-speed interface
The GD32F103C8, manufactued by Gigadevice, has similar specifications and thus many people think the chip is a cloned version of the STM32 part. The chip appears to be the same from a programmers point of view as almost all registers and peripherals are the same. Major differences are the execution speed and flash size. The chip is capable of running a much higher clockfrequency (108MHz) and have less waitstates for flashrom then the ST counterpart. The size of the flash memory goes up to 3076KB, compared to the 1024KB ST offers.
The differences can be explained by the decapping pictures (done by Zeptobars). The chip appears to consist of two dies: one microcontroller die and a separate flash die. They seem to use just one large single design and a varying size flash chip to serve the whole GD32F103 range. On the controller die there is 128KB SRAM caching the flashrom. This explains the 0 waitstates for flash access. This is a similar way the ESP8266 runs (albeit the flash is user replacable :)). Not very surprizing as Gigadevice is a big Chinese flash company. Some tweaks to silicon will allow a higher clockspeed (108MHz) and some people report it being 50% faster then the ST part.
Sounds to good to be true! Not very much is found on the internet about this chip, except some people report that not everything is working exactly the same as the STM32, The next weeks I’ll be using real world examples to test some of the peripherals of the chip. For this I’ve designed a breakout board (newer revision of this one) .
This post is part of a series where the STM32 is compared to the GD32:
- Part 1: Solderability
- Part 2: Blink a led
- Part 3: UART
- Part 4: SPI Master
Hi Sjaak, where do you get your GD chips from? I would need some to replace the broken ones on my toy quadcopter flight controllers.
You can find them on taobao or in the Shenzhen market. If they are the f103 you can replace them with stm parts, assuming they don’t need the 108MHz clock.
Which part you need exactly?
GD32F130G8 or G6
I run some OpenSource flight controller firmware on it: https://github.com/silver13/H101-dual
And no STM replacement, as the 108 MHz are needed by that firmware.
I wonder whether they have cloned also the various I2C bugs that the STM32F103 silicon is famous for.
F1 is an old design, replacements for F0, F3/F4 series would be more interesting.
They aren’t exactly clones (see the decap pictures) but I guess they have their own silicon problems. Dunno if I2C is flawed too.
The next few week I’m going to test the chips with stm32 code and see how they perform.
Can you share ypur experiences after testing code on GD32? What is the effort to run ST32 code on SG32? Did you make any bad suprizes? Any comments regarding environment, we use KEIL. thx.
GigaDevice offers F1, F2 and F3 series. There is also the F1x0 serie which aims to be a replacement for the F0 series, but has an M3 in stead of M0.
I could find some on Taobao, but not Aliexpress.
These days I’d get them on LCSC.com It’s a Chinese electronic parts wholesale (like RS and Farnell)
That feels a lot more trustworthy than some eBay/AliExpress/Taobao like website.