Skip to content

A simple "Hello World"-like project for the WCH CH32V103 RISC-V MCU

License

Notifications You must be signed in to change notification settings

islandcontroller/hello-ch32v103

Repository files navigation

hello-ch32v103 GitHub license Discord server link

A simple "Hello World"-like project for the WCH CH32V103 RISC-V MCU.

This project contains a simple set of modules to get the MCU running in a minimal configuration:

  • Serial I/O on USART1 (connected to WCH-Link VCP)
  • SysTick enabled and using empty dummy interrupt handler
  • TIM3 Channel 1 configured for PWM output to LED
  • ADC1 internal temperature sensor and Vrefint readout
  • I2C2 interface with 24C64 EEPROM read and write access

ℹ️ See README.vscode.md for VSCode setup information! ℹ️

Requirements

  • Hardware
    • WCH CH32V103R8T6-EVT-R1 Evaluation Kit (available from LCSC, PartNr C2943982) + USB-A to USB-C Cable
    • (optional) Female-female jumper wires
    • (optional) AT24C64 EEPROM IC + Solderless breadboard + 2x 10k Resistors
  • Software

Hardware Setup (optional)

  • Connect the LED1 and PA6 pins on header J3 using a female-female jumper wire
  • Connect the 24C64 EEPROM to PB10 and PB11 and add 10k pull-up resistors to SDA and SCL:
         .___________.  VCC   VCC VCC       VCC  .________________
        1|    |_|    |8  |     |   |         |   |
     +---| A0    VCC |---+    .|. .|.        +---| VCC (3V3)
     |  2|           |7       | | | | R1,R2      |
     o---| A1     WP |---+    |_| |_| 10k    +---| GND
     |  3|           |6  |     |   |         |   |
     o---| A2    SCL |---(-----o---(---------(---| PB10 (I2C2_SCL)
     |  4|           |5  |         |         |   |
     o---| GND   SDA |---(---------o---------(---| PB11 (I2C2_SDA)
     |   |___________|   |                   |   |________________
    GND  U2             GND                 GND  U1
         AT24C64 (DIP8)                          CH32V103R8T6
    

Usage

  • Clone this repository using the following command. Note the use of the --recursive tag.
    git clone --recursive https://github.com/islandcontroller/hello-ch32v103
    
  • Load this project in MounRiver Studio Community and build the executable
  • Open a serial terminal on the WCH-Link programmer's VCP (115200 Baud, 8N1)
  • Flash the firmware to the MCU using the provided .launch script
  • Resume execution once breakpoint in main() is reached
  • Press ? in the serial terminal to show available commands

Note

If you want to use the EEPROM demo, remove the comment at the start of the #define USE_EEPROM_DEMO line at the top of main.c. The demo is disabled by default.

Licensing

If not stated otherwise in the specific file, the contents of this project are licensed under the MIT License. The full license text is provided in the LICENSE file.

SPDX-License-Identifier: MIT

Help and References

If you're looking for further information about WCH products, check out their community Discord server: Discord server link

About

A simple "Hello World"-like project for the WCH CH32V103 RISC-V MCU

Topics

Resources

License

Stars

Watchers

Forks