Skip to content

Instantly share code, notes, and snippets.

@thetrung
Last active September 12, 2024 15:28
Show Gist options
  • Save thetrung/4c323357b6dedfa3abe7fe07bd1a3779 to your computer and use it in GitHub Desktop.
Save thetrung/4c323357b6dedfa3abe7fe07bd1a3779 to your computer and use it in GitHub Desktop.
Setup PlatformIO + CH32v / Ubuntu 24.04.1

How to setup PlatformIO & CH32 on Ubuntu 24.04.1

  1. Setup
  • Don't use sudo apt install platformio but if you did, try sudo apt remove platformio before proceeding further.

  • Install python-venv :

    sudo apt-get install python3-venv
    
  • Install PlatformIO :

    curl -fsSL -o get-platformio.py https://raw.githubusercontent.com/platformio/platformio-core-installer/master/get-platformio.py && python3 get-platformio.py
    
  • It will be installed in /home/YOUR_USERNAME/.platformio/penv/bin/platformio, so you need to include it into your PATH or SYMLINK it like below to use pio CLI command from Terminal.
  • Symlink into your ~/.local/bin :

    ln -s /home/YOUR_USERNAME/.platformio/penv/bin/platformio ~/.local/bin/pio
    
  • Now try updating a library :

    pio pkg update -g -p "ch32v"    
    

** You now also may install PlatformIO plugin into your vscode.

  • Install ch32v platform package :

    pio pkg install -g -p https://github.com/Community-PIO-CH32V/platform-ch32v.git
    
  • Create udev-rule for ch32v usb access :

    sudo touch /etc/udev/rules.d/99-platformio-udev.rules
    
  • Paste below lines into the rules :

    SUBSYSTEM=="usb", ATTR{idVendor}="1a86", ATTR{idProduct}=="8010", GROUP="plugdev"
    SUBSYSTEM=="usb", ATTR{idVendor}="4348", ATTR{idProduct}=="55e0", GROUP="plugdev"
    SUBSYSTEM=="usb", ATTR{idVendor}="1a86", ATTR{idProduct}=="8012", GROUP="plugdev"
    

That's it. Enjoy !

References :

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment