CH32F103 and USB CDC

Anything not related to STM32
Post Reply
wattyka
Posts: 2
Joined: Sun Aug 22, 2021 12:22 pm

CH32F103 and USB CDC

Post by wattyka »

Hi!

It turns out that the last few Bluepill boards I received seem to have repainted CH32F103 on them. There are 3 mold dents on the chip, and from what I read this typical for a CH32F103. They seem to work just fine when being programmed via STLINK.

However I cannot get USB CDC to work on any of these boards. Win 10 device manager says "invalid device descriptor" (specifically not: "device descriptor request failed"). I've fixed the 10k resistor on one board but as expected that didn't do a thing.

Has anyone of you had any luck in getting CDC with these clones to work? Or even anything USB related?

Thanks,
Watz
ag123
Posts: 1657
Joined: Thu Dec 19, 2019 5:30 am
Answers: 25

Re: CH32F103 and USB CDC

Post by ag123 »

did blink work? if blink doesn't work, i'd guess it is nearly a dud, but if usb don't work, it is worth much less than a stm32f103
viewtopic.php?t=786
if they design it from scratch, my guess is usb is one of the more difficult on chip peripheral to clone
wattyka
Posts: 2
Joined: Sun Aug 22, 2021 12:22 pm

Re: CH32F103 and USB CDC

Post by wattyka »

Even way more complex stuff than blink runs as long as I flash it using ST-LINK. It just looks like this devices USB device mode is not as STM32F103 compatible as advertised, and nobody ever bothered to adapt the cores USB CDC code to make it work on this thing.

As practically all Bluepills you can order now carry clones and you hardly can be sure what you get, this platform is finally dead for me. I'd rather spend a few cents more for a STM32F401 board that still carries a working and supported MCU. At least until they put incompatible clones on those, too.
ag123
Posts: 1657
Joined: Thu Dec 19, 2019 5:30 am
Answers: 25

Re: CH32F103 and USB CDC

Post by ag123 »

i've kind of 'upgraded' to stm32f401 black pill boards after i got my first few sketches working on them.
and it turns out that the advantages keep adding as i try out the app scenarios, adding fpu, adding 'art' accelerator (on chip cache), over clock.
try out dma etc. it is simply more fluid and better than stm32f103, and faster as well even for the same mhz

i've 'ported' an adafruit_ili9341_spi lcd library by making some optimizations, libmaple core f4. the speed differences is quite remarkable even between optimised stm32f401 84mhz libmaple and optimized stm32f103 72mhz libmaple
https://github.com/ag88/Adafruit_ILI9341_SPI_stm32duino
mrburnette
Posts: 633
Joined: Thu Dec 19, 2019 1:23 am
Answers: 7

Re: CH32F103 and USB CDC

Post by mrburnette »

ag123 wrote: Mon Aug 23, 2021 12:27 am i've kind of 'upgraded' to stm32f401 black pill boards after i got my first few sketches working on them.
and it turns out that the advantages keep adding as i try out the app scenarios, adding fpu, adding 'art' accelerator (on chip cache), over clock.
try out dma etc. it is simply more fluid and better than stm32f103, and faster as well even for the same mhz
...
Seems this article parallels your thoughts...
https://hackaday.com/2021/01/20/blue-pi ... stm32f411/
ag123
Posts: 1657
Joined: Thu Dec 19, 2019 5:30 am
Answers: 25

Re: CH32F103 and USB CDC

Post by ag123 »

i've a 'grudging' feel that the venerable 'blue pills' is actually used for some real applications, hence the clones appear.
'hobbyist' streams seldom generate so much demand that manufacturers make them en-mass.
try 'millions' of pieces, that's probably the kind of demand that's moving it.

one likely place is they could be powering those premium mechanical keyboards that one is typing on, bluepills are the perfect sizes with usb to fit that use. those can sell by the millions. and it is so programmable you can add features like macros, accelerators etc and create highly distinctive products with it. i've always thought keyboards can have 'pin headers' extensions, that'd add 'infinitely' many use cases, adc, double up as oscilloscope etc! and last but not least, this is a keyboard with a accurate (crystal driven) 'real time clock' built on board. i think the 'real time clock' with usb must be the other use case in the relevant scenario.
mike2mars
Posts: 2
Joined: Wed Jul 19, 2023 9:17 pm

Re: CH32F103 and USB CDC

Post by mike2mars »

ag123 wrote: Sun Aug 22, 2021 1:30 pm did blink work? if blink doesn't work, i'd guess it is nearly a dud, but if usb don't work, it is worth much less than a stm32f103
viewtopic.php?t=786
if they design it from scratch, my guess is usb is one of the more difficult on chip peripheral to clone
Blink works for me so they're not duds, but my computer doesnt recognize it on USB and neither does the WCHISPTool. Anyone had success with these ch32f103's and windows 11? I plugged an Air103(another stm32 clone) into the same usb and it was recognized. Hmmm
mike2mars
Posts: 2
Joined: Wed Jul 19, 2023 9:17 pm

Re: CH32F103 and USB CDC

Post by mike2mars »

I finally got the WCHSPITool to see the MCU and windows to stop showing it as "unknown USB device (descriptor failed)" under device manager. Turns out it was just the usb driver not being installed correctly after installing the wchspitool. wchspitool installs some drivers automatically but theres also a setup.exe in the folder. Which i ran and it tried to install a usb driver and got a fail message. Which i quickly forgot about because i went on to install other usb drivers manually that seemed to install fine but didnt make the board be recognized.. So after uninstalling everything and starting a fresh install of the wchspitool, thats when i had success. I installed the tool first, then went into the directory it installed to and ran the setup.exe. This time no fail message. Therers another driver64 directory that may have helped I installed the first time but didnt 2nd time around to be clear. I then switched the bottom jumper (with usb port facing to the right) the the left position, plugged the usb cable into the bottom usb connector (not top one) and thats when WCHSPITool saw the board. Going into device manager there was no unkown USB device anymore. Having the jumper in the default spot didnt help the board being recognized and connecting to the top didnt as well, so those things are key. Hope this helps. It does actually say to put the jumper over to the other position and plug into HUSB to get ready for flashing, the HUSB is the bottom one labelled. It doesnt tell you which drivers to install and im still confused, as i have a feeling some other drivers i have installed previously may have made it work. But i dont think so since i uninstalled everything before making it work but just incase heres a link to another driver i installed before uninstalling everything https://www.wch-ic.com/downloads/CH343CDC_EXE.html I was about to install all the drivers on that page i jsut linked but then it worked so i dont think its necessary, but you do have to run the setup.exe in the wchisptool folder, thats the driver that had a fail messaeg the first time I ran it and then a success message after i reinstalled everything the 2nd time. Along with setting the jumper and plugging into the husb (bottom) connector those are what seemed to have done it.
Post Reply

Return to “Off topic”