Skip to content

A user-friendly SDK for the CH32V003 microcontroller with an Arduino-like project setup, designed for quick and easy development.

License

Notifications You must be signed in to change notification settings

karasevia/finik-v003

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FINIK CH32V003 SDK

Welcome to the finik-v003 SDK repository! This SDK provides a seamless and efficient development environment for the CH32V003 microcontroller, combining the simplicity of an Arduino-style project structure with the flexibility of CMake.

Overview

The CH32V003 microcontroller is a cost-effective solution for various embedded systems projects. This SDK ensures that both novice and experienced developers can quickly get started without requiring extensive setup or deep technical knowledge.

Specifications

Key Features

  • Ease of Use: Simple and intuitive setup process, similar to the Arduino IDE.
  • CMake Integration: Streamlined project structure managed by CMake, allowing for advanced project configurations.
  • Comprehensive Tooling: Essential VS Code extensions provided to enhance the development workflow.

Getting Started (Windows)

To start using the SDK, follow these steps:

  1. Download the toolchain: Download the toolchain from Yandex Disk or Google Drive, and place it in the project folder.

  2. Install prerequisites: Install the following:

    Install the Python library (This is needed to send commands to the MCU):

    pip install pyserial
  3. Install VS Code and extensions: Install VS Code. Then, in your terminal, run:

    code --install-extension ms-vscode.cpptools
    code --install-extension ms-vscode.cmake-tools
    code --install-extension twxs.cmake
    code --install-extension marus25.cortex-debug
    code --install-extension dan-c-underwood.arm
    code --install-extension zixuanwang.linkerscript
    code --install-extension badlogicgames.serial-plotter
    code --install-extension sanaajani.taskrunnercode
    code --install-extension ms-vscode.cpptools-extension-pack
    code --install-extension awsxxf.serialterminal

    Reload VS Code after installation.

  4. Install drivers for USB-UART: You can find common drivers in the toolchain folder.

  5. Clone the repository: Right-click and choose "Open Git Bash Here" in your desired directory, then run:

    git clone https://github.com/karasevia/finik-v003.git
  6. Set your serial port: Update the COM18 value in tasks.json to match your serial port.

  7. Start developing: You are now ready to begin development!

Development Steps

Board View

  • Modify the delay time in the loop: delay
  • Open the Task Runner and run [flash] update from program.
  • Observe the results on your board.

Debug with OpenOCD

  1. Change the CMAKE_BUILD_TYPE to Debug.
  2. Open "Run and Debug" (Ctrl + Shift + D).
  3. Start debugging.

Configurations

The last two memory pages are reserved for saving configuration data during reloading and flashing. This allows you to store up to 62 bytes. To use this, create an object using the following structure:

union config_u {
    config_t raw;
    struct {
        uint8_t mode;
        uint8_t mac[6];
        uint8_t ipv4[4];
        char password[32];
    };
} config;

To read and write the settings, use the following methods (data is only written if it has changed):

read_config(&config.raw);
save_config(&config.raw);

You can access the configuration like this:

config.mode = 3;
if (config.ipv4[0] == 192 &&
    config.ipv4[1] == 168 &&
    config.ipv4[2] == 0 &&
    config.ipv4[3] == 31) {
    compare(password, config.password);
}

Useful Information

MCU View

Acknowledgements

This project is based on and improves upon several existing projects:

About

A user-friendly SDK for the CH32V003 microcontroller with an Arduino-like project setup, designed for quick and easy development.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published