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.
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.
- 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.
To start using the SDK, follow these steps:
-
Download the toolchain: Download the toolchain from Yandex Disk or Google Drive, and place it in the project folder.
-
Install prerequisites: Install the following:
Install the Python library (This is needed to send commands to the MCU):
pip install pyserial
-
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.
-
Install drivers for USB-UART: You can find common drivers in the toolchain folder.
-
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
-
Set your serial port: Update the
COM18
value in tasks.json to match your serial port. -
Start developing: You are now ready to begin development!
- Modify the delay time in the loop: delay
- Open the Task Runner and run
[flash] update from program
. - Observe the results on your board.
- Change the CMAKE_BUILD_TYPE to
Debug
. - Open "Run and Debug" (Ctrl + Shift + D).
- Start debugging.
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);
}
This project is based on and improves upon several existing projects: