WCH has introduced a line of small RISC-V MCUs with USB and BLE.  The 3 major branches of the family are the CH573, CH582 and CH592.  They mostly only differ in the level of BLE - from 5.2 to 5.4.  Looking for an inexpensive way to check them out I ordered a small devKit of each made by WeAct Studios from AliExpress.  My thoughts were to make a simple remote station for my diyNOW project with BLE communication.  These modules offer plenty of I/O so I wanted to operate a relay, monitor room temperature, and it's own battery voltage.

To get started the Moun River Systems (MRS) IDE needs to be installed.  Be sure to download the latest version.  This hack was written using V160 for x64 Linux (Mint in my case). After downloading the ".xz" file, extract it to the folder of your choice.  Then enter this directory/beforeinstall and make "start.sh" and MounRiver Studio_Community executable.

chmod +x start.sh
cd ../MRS_Community
chmod +x "MounRiver Studio_Community"

 the start.sh will set the appropriate "udev" parameters so that Linux will recognize the USB device of the CH5xx.

At this point you should be able to navigate to ..../MRS_Community directory from the file browser and double click on the "MounRiver Studio_Community" icon to run the IDE.

At this point I want to clarify some difference from programming the WCH MCUs such as the CH32V003 or CH32V203.  The MCUs use an external "LinkE" module which uses the SWD/SWC pins to upload the hex file. This method allows uploading directly from the IDE with no buttons to push - and it is very fast.  In contrast the WeAct modules are programmed via the USB interface and require a button push.  A program external to the IDE called "wchisp" needs to be called from outside the IDE to initiate an upload. There is an equivalent program for windows users called WCHISPTool.  I have not found an "official" Linux version but I have found that the lads at "ch32-rs" have written a version in RUST. I always figured I was too long in the tooth to play with another new language, BUT, the executable ran right out of the box, at least for this Linux bigot.

I would appreciate any comments re this situation - ie is a SWD/SWC bootloader available for the CH5xx? - has anyone done the config to MRS to allow running the wchisp program from within the IDE? (I'm a little under the weather right now - I plan to tackle this last question once my brain fog clears.)

I downloaded wchisp into /usr/sbin to make it available from any directory and did a chmod +x wchisp to make it executable.  A quick test is to run  wchisp --help from anywhere to confirm it is installed correctly.
I the created a bash script to execute from within the "obj" directory which is where the ".hex" file is located.  I called the script CHisp and placed it in /usr/local/sbin so it can be called from anywhere.  The script looks like this:  It will upload the .hex file from the directory from which it was called.

FIL=$(ls ./*.hex)

echo Upload $FIL

wchisp -v flash $FIL

 Usage is as follows:

ch5@XEON:~/workspace/CH592F$ cd obj
ch5@XEON:~/workspace/CH592F/obj$ CHisp
Upload ./CH592F.hex

You will need to cycle power to the module just before hitting Enter after typing CHisp.  Else you will get Error: No WCH ISP USB device found.  You could also get unpredictable results if there is more than1 .hex file in the obj directory.

So - here is the modified "Main.c" source file - quite simple, as RISC-V should be.  Just replace the Main.c generated by MRS with this:

#include "CH59x_common.h"
#include "CanHobby.h"

int main()

    GPIOA_SetBits(GPIO_Pin_9);  //  settle down the TX output driver

    GPIOA_ModeCfg(GPIO_Pin_8, GPIO_ModeOut_PP_20mA); // LED pin to OutPut
    GPIOA_ModeCfg(GPIO_Pin_9, GPIO_ModeOut_PP_5mA);  // TXD pin to OutPut

    CHprint( "\nCanHobby CH5xx Blink/Serial...
Read more »