CH32F103C8T6 core board three kinds of program download mode introduction
2025-01-22
Nanjing Qinheng's CH32F103C8T6 against STMicroelectronics STM32F103C8T6, in order to ensure compatibility, the architecture is basically the same. Because the core is the same, at present I look at the manual only found in the peripherals on the addition and deletion, overall and ST structure is similar. The chip's pin definition in the manual is also compatible with the ST chip.
Registers, memory address mapping, which determines whether the chip peripherals are compatible, whether you can use the st official driver library. The differences, or enhancements, or omissions can be seen at a glance, and according to the changes to add or delete the relevant configuration. Comparison can be seen, the basic peripheral addresses are the same, some of the devices have function increase and decrease, which also means that the vast majority of the function is compatible, but to use some specific functions, you need to refer to the official routines or libraries, or transplant the register address settings. For example, CH has added its own USBHD address mapping at address 0x4002 3400, which is not available on other chips, plus its own BOOT, so it can easily realise USB download firmware.
system resource

Cortex-M3 core, 72MHz system frequency;
Single-cycle multiplication and hardware division;
20KB SRAM, 64KB CodeFlash;
Power supply range: 2.7V-5.5V, GPIO synchronous supply voltage;
Multiple low-power modes: sleep/stop/standby;
Power-on/power-off reset (POR/PDR);
Programmable voltage monitor (PVD);
7-channel DMA controller;
12-bit analogue-to-digital ADC with 1us conversion time;
16-channel TouchKey channel detection;
12-bit digital-to-analogue DAC;
7 timers;
1 USB2.0 FullSpeed host/device interface (full and low speed);
1 USB2.0 FullSpeed device interface (full and low speed);
1 CAN controller (2.0B active);
2 I2C interfaces (SMBus/PMBus support);
3 USART interfaces;
2 SPI interfaces (supports Master and Slave modes);
51 I/O ports, all IO ports can be mapped to 16 external interrupts;
CRC calculation unit with 96-bit chip unique ID;
Serial Single Wire Debug (SWD) interface;
Package form: LQFP64M, LQFP48, QFN48.
Serial download method
Install WCHISPTool software before download, click the official website to download
USB to TTL serial module and CH32 wiring as follows: Rx->A9, Tx---->A10, GND->G, VCC->3.3, boot0 jumper cap set to high level.


If the download option can not be clicked before downloading, please click the contact protection option, sometimes the download is not successful restart the software. Select a compiled STM32F103C8T6 hex file, PC13 blinking light programme. After the download is complete, set boot0 back to low, press the reset button to observe the light is flashing, indicating that the program is running.
USB download
CH32F103 has 2 USB, respectively:
Host HUSB: PB7------>D+, PB6------>D-
Device USB: PA12----->D+, PA11----->D-
The boot0 jumper cap is set to high level, the software downloads HUSB by default, and the core board uses device USB, so you need to connect a separate USB cable.


If the download option can not be clicked before downloading, please click the contact protection option, sometimes the download is not successful restart the software. Select a compiled STM32F103C8T6 hex file, PC13 blinking light programme. After the download is complete, set boot0 back to low, press the reset button to observe the light is flashing, indicating that the program is running.
Use ST-LINK (SWD and other simulation tools), MDK compiler software downloads
Installation of MDK's CH32F1xx device installation package


1. After installation, you can see the device model in the MDK Device tab.
2. Using SWD interface wiring, SWCLK and SWDIO, boot0 jumper cap set low

Open the MDK project file of PC13 blinking and set it accordingly


Debug select the downloader model and add the CH32F1xx algorithm in the flash download option.

Download interface Port select SW, you can see the Arm kernel
Compile and download the project file to the core board

Summary
CH needs to install device library package, also need to add their own algorithms, so that in the MDK can be downloaded properly, unique bootloader and ST is not the same, also supports serial and usb download. In addition there are several other similar benchmark ST chip such as GD32F103c8t6 (Beijing Zhao Yi innovation), APM32F103c8t6 (Zhuhai extreme sea), HK32F103c8t6 (Shenzhen Hangshun), CKSF103c8t6 (Wuxi in the core).
GD32, APM32 can be downloaded via STM32CubeProgrammer software using serial port, and several others cannot, which means that the BootLoader of GD32 and APM is compatible with STM32.GD32, APM32, HS32, CSK32 can be downloaded via MDK or ST-LINK downloader using ST-LINK. STM32CubeProgrammer software download, CH32 can not, CH32 flash algorithm is not compatible with ST.