Skip to content

[CH32VM00X] Support for variants ch32v002 ch32v006, TSSOP20, QFN20, QSOP24 and others - #200

Open
maxint-rd wants to merge 43 commits into
openwch:mainfrom
maxint-rd:support-CH32V002F4-CH32V006F8
Open

[CH32VM00X] Support for variants ch32v002 ch32v006, TSSOP20, QFN20, QSOP24 and others#200
maxint-rd wants to merge 43 commits into
openwch:mainfrom
maxint-rd:support-CH32V002F4-CH32V006F8

Conversation

@maxint-rd

@maxint-rd maxint-rd commented Jun 14, 2025

Copy link
Copy Markdown
Contributor

Recently I acquired some CH32V002 and CH32V006 chips in a TSSOP20 package. Since they share the same pinout as the CH32V003, I think they can be useful upgrades for V003 projects. Based on the V006 QFN32 variant K8U6 this PR adds support for the V002 and V006 in TSSOP20 packages.

The V006 has 62KB flash, which makes it a good candidate for debugging V003 projects. I included some handy information such as Arduino pin numbers and installation instructions in
variants/CH32VM00X/README.md.

Note: This PR is not 100% complete but works for me and may be useful for others. It adds peripheral selection from the IDE menu only for certain chips. For others it may break compilation/uploading, so please be selective and know what you want.

To make it useful this PR includes some changes derived from other PR's:

Edit: I've only implemented support for the chips that I could test myself, Although I still don't have the full range of CH32 chips in my collection, the generous donation by @BitByteBeetle allowed me to add many more variants. The README gives further info about this and lists known issues.

@maxint-rd maxint-rd changed the title Support TSSOP20 variants ch32v002f4 ch32v006f8 [CH32VM00X] Support TSSOP20 variants ch32v002f4 ch32v006f8 Jun 21, 2025
define CH32V002 when CH32V002F4 is defined (as done by board selection)
Check if USART2 is defined before using it.
…openwch#65)

- micros was counting backwards (openwch#65)
- micros used 64-bit division; using 32-bit is more than 1K smaller (openwch#204) (requires same change for delayMicroseconds() in ../wiring_time.h)
delayMicroseconds() used 64-bit division; using 32-bit is more than 1K smaller (see openwch#204) (similar change for micros() in ch32/clock.c)
@maxint-rd maxint-rd mentioned this pull request Jan 29, 2026
Note: requires conditional setting of peripherals in variant_CH32....h file:

#ifndef IDE_MENU_PERIPHERALS   // defined when peripherals are enabled/disabled via the IDE menu
#define                         ADC_MODULE_ENABLED
#define                         UART_MODULE_ENABLED
#define                         SPI_MODULE_ENABLED
#define                         I2C_MODULE_ENABLED
#define                         TIM_MODULE_ENABLED
#endif
Note: requires updated boards.txt with section
# Peripherals Options

To see added options in IDE the cache may need to refreshed.
On Windows this can be done by deleting the cache folder prior to restarting.
   C:\Users\<username>\AppData\Roaming\arduino-ide
@maxint-rd maxint-rd changed the title [CH32VM00X] Support TSSOP20 variants ch32v002f4 ch32v006f8 [CH32VM00X] Support for variants ch32v002 ch32v006, TSSOP20, QFN20, QSOP24 and others Jun 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant