Qinheng CH32V103C8T6 Development Environment Notes

Publisher:PeacefulAuraLatest update time:2022-06-07 Source: eefocus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

CH32V103C8T6

CH32V103C8T6 is Qinheng's RISC-V core MCU, based on the RISC-V3A processor. The core uses a 2-level pipeline, sets up static branch prediction, instruction prefetch mechanism, and supports DMA. The main parameters are as follows


CPU: 32-bit RISC-V3A, RV32IMAC instruction set, up to 80MHz, typical 72MHz

RAM: 20KB

Flash: 64KB

BootLoader: 3.75KB system boot program storage area

Power supply: 2.7V - 5.5V (compatible with 3.3V and 5V)

Timer: General 3, Advanced 1, Watchdog 2, System Clock 1

ADC: 12bit, 10CH

SPI: 2

I2C: 2

UART: 3

USBHD: 1

Package: LQFP48


Hardware parts

WCH-Link programmer

You need to prepare a WCH-Link for burning Qinheng's chip. There are burners on the market that are compatible with DAP-Link and WCH-Link. Pay attention to the instructions of the burner. Its mode can be switched by pressing the button before powering on. When burning CH32V103, it must be in the WCH-Link state.


Development Board Blue Pill

Because the pin layout of CH32V103C8T6 is exactly the same as STM32F103C8T6 and CH32F103C8T6, the hardware design is universal, and the PIN is compatible, so the STM32F103C8T6 core board (Blue Pill) can be directly used as a development board. I happened to have a STM32F103C6T6 development board in my hand. The circuit is the same as that of STM32F103C8T6, but the chip model is different, so I used hot air soldering to blow off the C6T6 and replaced it with CH32V103C8T6.


The temperature of the hot air gun is set to 290 degrees, and the MCU is added with flux oil.


STM32F103C6T6 pad after blowing off

I soldered the CH32V103C8T6, but it was a little crooked the first time.

I blew it again, carefully placing it in the correct position this time.

I measured the resistance between each PIN and found that some PINs were poorly soldered, so I used a soldering iron to clean them again.


Connection

WCH-Link -> Blue Pill

3V3      -> 3V3

GND      -> GND

SWD      -> SWIO

SCK      -> SWCLK

RX       -> PA9 

TX       -> PA10


If you do not want to observe the serial port output, RX/TX can be disconnected.


Software

The software part is actually MounRiver Studio. After downloading, unzip and install it. MounRiver Studio is an extended development environment based on Eclipse, which is relatively convenient for people who are familiar with Eclipse. When installing MounRiver Studio, the WCH-Link driver is installed, and there is no need to install it separately.


Download address: http://mounriver.com/download

Instructions

https://bbs.21ic.com/icview-3037572-1-1.html

https://blog.csdn.net/qq_36353650/article/details/108321298

https://zhuanlan.zhihu.com/p/413153955

If you need to observe the serial port output, you also need to use a serial port tool, such as putty.


Test items

Create a project

Let's build a test project to drive the PC13 LED on the board through GPIO


File -> New -> MounRiver Project, in the dialog box


Select chip model WCH -> CH32V103 [RIsC-V] -> CH32V103C8T6

Enter the Project Name, for example Test001

Check Use default location. If you need to put it in another directory, you can uncheck it and choose it yourself.

Select NoneOS for Template Type, because this is just a simple test and only requires a while loop

Click Finish

The directory structure will appear in the Project Explorer.


Editing Code

The user code is in the User directory. Expand User, open main.c and modify the content to


#include "debug.h"



void GPIO_Toggle_INIT(void)

{

    GPIO_InitTypeDef GPIO_InitStructure = {0};


    RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC, ENABLE);

    GPIO_InitStructure.GPIO_Pin = GPIO_Pin_13;

    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;

    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;

    GPIO_Init(GPIOC, &GPIO_InitStructure);

}



int main(void)

{

    u8 i = 0;


    NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);

    Delay_Init();

    USART_Printf_Init(115200);

    printf("SystemClk:%drn", SystemCoreClock);

    printf("GPIO Toggle TESTrn");

    GPIO_Toggle_INIT();


    while(1)

    {

        Delay_Ms(500);

        GPIO_WriteBit(GPIOC, GPIO_Pin_13, (i == 0) ? (i = Bit_SET) : (i = Bit_RESET));

        printf("TESTrn");

    }

}


Compile the project

The compilation and burning process is well packaged by MounRiver, so this part is relatively simple.

Use the compile button in the icon bar, or press F7 to compile the project (use Shift+F7 for a complete compile)


Burn

First check Ports (COM & LPT) in the device manager. If the writer is in WCH-Link state and connected to the computer, a device like WCH-LinkRV SERIAL (COMx) will appear.


Use the Download button in the icon bar, or press F8 to burn.


If the above steps are normal, you should see the LED on the development board switch on and off every half a second. The serial port is connected at a baud rate of 115200, and the output text "TEST" can be seen.


reference

Hardware and wiring https://blog.51cto.com/u_15127636/4347970

MounRiver Studio Burn

https://blog.csdn.net/qq_36353650/article/details/108513094

https://blog.csdn.net/weixin_41784968/article/details/123770290

https://github.com/weimingtom/wmt_ch32_study

Reference address:Qinheng CH32V103C8T6 Development Environment Notes

Previous article:STC8H Development (Ten): SPI driver Nokia5110 LCD (PCD8544)
Next article:STM8S103F3P6 development, burning and debugging notes

Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号