Well i just made m first 5v run on the CH32F103 board.
I removed:
R10 - USB Pullup Resistor , that goes to VCC
U1 - 3v3 Regulator - Didn't survice the pin lifting ... I did the surgery after soldering pins on the board, leaves very little working (solder) space.
Hotglued a MIC2920-3v3 to some Kapton on the back, for the "Orange 3v3 wire".
Fed the 2920 from the 5v Ceramic (C5) and soldered the "Red 5v wire to the cap to" - Yes i see the pointy solder blop on C5 plus side....
I then connected a 3v3/5v switchable usb-ttl adapter to usart1 , and made a program using the CH32F103 StdPeriph lib - They had a program that could detect if you run 3v3 or 5v on VCC.
Rewrote the serial output rotine , and printed the below stuff...
As you can see the MCU does NOT automatically set the EXTEN-->USB5V bit in the register , despite the RM saying so ... (I suspect xlate error)
SystemClk:72000000
Exten Reg:0x00000200
USB5V Flag :0x00000000
ADC Value: 961
5V
SystemClk:72000000
Exten Reg:0x00000200
USB5V Flag :0x00000000
ADC Value: 962
5V
SystemClk:72000000
Exten Reg:0x00000200
USB5V Flag :0x00000000
ADC Value: 963
5V
SystemClk:72000000
Exten Reg:0x00000200
USB5V Flag :0x00000000
ADC Value: 962
5V
SystemClk:72000000
Exten Reg:0x00000200
USB5V Flag :0x00000000
ADC Value: 963
5V
SystemClk:72000000
Exten Reg:0x00000200
USB5V Flag :0x00000000
ADC Value: 959
5V
USB has not yet been tested on VCC 5v.
I have tested it on VCC 3v3 , using standard STM32duino.
I had to do one mod though ... After removing R10 USB wouldn't be reckognized by Laptop (missing 1k5 USB+ pullup) - But you can enable the builtin USB Pullup in the EXTEN register.
VCC 3v3 still works fine w. STM32duino, after enabling the builtin pullup.
Next ....
Connect an old USB HUB to the Laptop (Laptop USB port saver) - Connect ARM to HUB
Set VCC 3v3
Measure USB Data+ levels on 3v3
Do some port toggling wo. load , and w 1K load.
Switch to 5v
Set USB5V-bit in EXTEN
Repeat above measurements.
Then:
It would be nice to autodetect 3v3 vs 5v , and set the USB5V-bit on startup , before enabling the USB periph.
So ...
Convert the attached CH32F103 Main.c to STM32 register & lib naming, so it can be used w. STM32Duino.
The MCU might be compatible , but the STDPeriph naming is not ... It won't build in STM32Duino.
Edit: The CH32F103 - Has a weird "encrypted"
USB programming protocol, that has already been hacked
Programming MCU
USB Use
isp55e0 -f Main.bin -
https://github.com/frank-zago/isp55e0 (udev script also in there ...) -
USE Lower/Bottom USB plugWatch out when on VCC 5v - Since the chip didn't set the USB5V flag, chances are that the bottom USB in "Boot0" mode will not either ..... And you have no programming control in "Boot0" mode.
SWDI haven't tried it yet, but if VCC 5v - Then it might blow your ST-Link clone unless the ST-Link pins used are 5v tolerant.
DON'T connect USB & SWD VCC pin at the same time - You will have dual PSU's figthing or blow the SWD thingy if running 5v on the CH32
Edit2:Arduino replacement ... depends ...
The MCU has a Max powerusage of 50mA ob VCC & GND pins.
And a pindrive of
- 5..8mA - Though they mention 20mA w relaxed timing ... But remember the 50mA total usage.
I suppose it might be somewhat the same as a "Bluepill, haven't checkked though.
Bought mine on ALI for $2.6 - USB-C version
https://www.aliexpress.com/item/1005001936761405.htmlMake sure to get the "DUAL USB PLUG" version, no matter where you get it.
TOP USB = Normal USB (STM compatible) - Works w STM32duino
BTM USB = USB Boot0 ISP + USB HOST (ST Doesn't have that one)
I ordered 4 , and one is missing the top usb-c plug , the other 3 are fine.
I have decided not to complain, what would i want in compensation ..... ?
I got the board in a closed static bag from seller , must be a factory error.
/Bingo