Author Topic: <30 cent MCU with USB controllers, capactive touch & more: WCH's CH55X series  (Read 23805 times)

0 Members and 2 Guests are viewing this topic.

Offline Bob-2

  • Newbie
  • Posts: 2
  • Country: ca
Hey, some really awesome projects in this thread! Excited to get to use these micros in some of my own projects. I'd really like to get it working as a USB HID device.

Just curious if anyone has had trouble getting the WCHISPTool to work for them? I believe the problem for me might be driver related. When I plug my CH554 dev board from electrodragon into USB (I am on windows 10) it doesn't seem to respond to windows with a device descriptor and windows stops the device. Attached is a screenshot of what shows up in device manager. Is this normal? The WCHISPTool also does not see the device. I tried updating the device driver using Zadig to libusb which also didn't work but it showed a USB ID as 0000 0002 which I think is wrong.

Don't want to hijack the thread - just hoping for confirmation whether the device descriptor thing is or isn't normal, or if anyone ran into this.

 

Offline PeterZ

  • Regular Contributor
  • *
  • Posts: 54
  • Country: de
I'd check if the board is assembled correctly. My CH559 board from electrodragon had the main chip 90° rotated and installed that way, ontop of that look what i found underneath one of the USB sockets:



They redesigned the board and were improving the QC, so things are hopefully much better now.

Did you power up the board with the bootloader button pressed? If the demo firmware does not use the USB it won't be recognized unless you start the bootloader (VID=0x4348, PID=0x55E0).

If anyone is interested, i have written a python flasher tool for the CH55x series. It's based on work of others, reverse engineered bootloader and lots of my own research.
The script is here:

https://github.com/hexeguitar/CH55x_python_flasher

It requires python3, pyusb and pyserial libraries. Tested and works with CH559, CH554 (bootloader v.2.31) and CH551 (usb only, bootloader v1.1).
I have also implemented the UART flashing for the bootloader v2.31. It might be useful when working on usb host projects, replugging the usb back and forth to program the chip is really annoying.
However there are two little disadvantages:
- baudrate is fixed to 57600, slooow...
- bootloader in uart mode replies only after hard reset (checks a flag on boot), so i designed a small circuit to cycle the power and start the mcu with the bootloader button pressed. For now i have tested the CH559 version only. CH554 is different, the bootloader pin is active high and normally used as USB D-.

Here is the reboot circuit for the CH559:
https://github.com/hexeguitar/CH55x-HW-reboot



The chflasher script uses the DTR line to restart the MCU if it doesn't get any reply. I have another version for the CH554, too, but it's not yet tested in practice. I'll add it to the repo soon.

With the flasher script, SDCC, vscode + CMake/Ninja i was able to make a nice open source programming environment for the CH55x MCUs on Linux.

And here is another small CH554 based board, i plan to use it as a generic USB host ->UART module to interface a keyboard or mouse with various projects:



 
The following users thanked this post: oPossum, ebclr, hidden

Offline Bob-2

  • Newbie
  • Posts: 2
  • Country: ca
LOL is that solder paste under the USB connector?

Thanks for pointing me towards it being a hardware issue. I had actually already checked for incorrect rotation in the chip and probed around a little bit. What I missed was that USB D- to P3.7 wasn't connected! Even though it looked fine at first glance, the pin on the USB connector was bent up slightly and the solder on the pad had missed it!!! Jeez. Funny thing is I think I probed this before but it must have pushed the pin down and made contact.  :palm:

 

 

Offline Noopy

  • Super Contributor
  • ***
  • Posts: 1882
  • Country: de
    • Richis-Lab
Hi all!

Are you interested in some die pictures?
I have taken pictures of the CH551 and the CH552:

https://richis-lab.de/CH55x.htm

The CH551 and the CH552 share the same die (as far as I can evaluate it).
Certainly WHC deactivates some blocks in the CH551.

 :popcorn:
 
The following users thanked this post: oPossum, soFPG, I wanted a rude username

Offline Noopy

  • Super Contributor
  • ***
  • Posts: 1882
  • Country: de
    • Richis-Lab
Hi all!

Are you interested in some die pictures?
I have taken pictures of the CH551 and the CH552:

https://richis-lab.de/CH55x.htm

The CH551 and the CH552 share the same die (as far as I can evaluate it).
Certainly WHC deactivates some blocks in the CH551.

 :popcorn:


Update: https://www.richis-lab.de/CH55x.htm

The CH554 uses the same die as the CH551 and the CH552. That means that most likely all three have USB-Host-Hardware inside.

The CH559 is completely different.

 :-/O



 
The following users thanked this post: oPossum, edavid, soFPG


Offline oPossum

  • Super Contributor
  • ***
  • Posts: 1447
  • Country: us
  • Very dangerous - may attack at any time
 

Offline hidden

  • Contributor
  • Posts: 11
  • Country: cn
BoB is Board On Board ?
 

Offline ds_user

  • Newbie
  • Posts: 9
  • Country: us
I just make an Arduino package for CH55x. Programming CH55x is now a one-click process.

Also, there is a breakout board you can solder without a magnifying glass.



https://github.com/DeqingSun/ch55xduino
 
The following users thanked this post: serisman

Offline knapik

  • Regular Contributor
  • *
  • Posts: 143
  • Country: au
I'm pretty interested in the CH559. Sounds like the perfect microcontroller for a simple project idea I had (USB mouse & keyboard support for SPARCstations).
 

Offline ds_user

  • Newbie
  • Posts: 9
  • Country: us
A few updates on my journey with CH552:

1. The QFN16 version, CH552P is available now. It is a good tiny chip for when you need one.
2. Despite being discouraged in the datasheet, the chip can be programmed reliably at 3.3V. Due to power distribution network dropout, the last 2kB (which is the ISP) may or may not be reliably programmed, but the first 14KB should be fine, as I was told by WCH's tech support.
3. 111.1kbps is 3.6% from 115.2kbps, which means if the other peer is using an accurate divider and an accurate oscillator, you can talk to the peer in 115.2kbps mode at only 16MHz clock. ESP32 users, this is a good news.
4. Librech551 no longer works with newer bootloader versions (currently 2.3), you need ch55xtool, which can be found at: https://github.com/MarsTechHAN/ch552tool.

Hi, where can we get CH552 with new bootloader? Can we get it from LCSC?
 

Offline soFPG

  • Frequent Contributor
  • **
  • Posts: 283
  • Country: de
What is the advantage of the new bootloader? Did anyone ever successfully programmed these uCs without USB? I heard some rumors that programming via SPI would be possible
 

Offline up8051

  • Frequent Contributor
  • **
  • Posts: 305
  • Country: pl
What about  Flash readout protection in new version of bootloader?
 

Offline oPossum

  • Super Contributor
  • ***
  • Posts: 1447
  • Country: us
  • Very dangerous - may attack at any time
Both the old and new bootloader have flawed code protection and can be read. All but the CH551 can be programmed by USB and UART. There is no SPI support in any parts.
 
The following users thanked this post: soFPG

Offline soFPG

  • Frequent Contributor
  • **
  • Posts: 283
  • Country: de
So how do you program the CH551 then? Your first post was about the CH551 and you said it has a USB bootloader?
« Last Edit: June 19, 2020, 06:05:32 am by soFPG »
 

Offline Yansi

  • Super Contributor
  • ***
  • Posts: 3893
  • Country: 00
  • STM32, STM8, AVR, 8051
All GPIO are high when the bootloader is active. I didn't try to determine if this is due to pullup resistors being enabled (most likely) or being driven high.

Note that reset is active HIGH on these chips. This is different than almost every other MCU or CPU. Active LOW is the norm. There is an internal pulldown resistor on the reset pin.

8051 based MCUs (including the original 8051 and all derivates) had a positive polarity reset. So you are in fact wrong.

And there is no norm on reset polarity as far as I know. That you are used to something does not make it a rule.
 

Offline oPossum

  • Super Contributor
  • ***
  • Posts: 1447
  • Country: us
  • Very dangerous - may attack at any time
I was referring to it be the norm on *other* MCUs, not the 8051. Can you name any MCU or CPU from the 90s or later with active high reset? I haven't seen one.
 

Offline oPossum

  • Super Contributor
  • ***
  • Posts: 1447
  • Country: us
  • Very dangerous - may attack at any time
So how do you program the CH551 then? Your first post was about the CH551 and you said it has a USB bootloader?

The CH551 is USB only. All the others are USB and UART.

The manuals briefly mention a serial (possibly SPI) programming capability that does not use the bootloader. This is not publicly documented as far as I know.
 
The following users thanked this post: soFPG

Offline Bassman59

  • Super Contributor
  • ***
  • Posts: 2501
  • Country: us
  • Yes, I do this for a living
I was referring to it be the norm on *other* MCUs, not the 8051. Can you name any MCU or CPU from the 90s or later with active high reset? I haven't seen one.

The real mistake is assuming that because the MCUs or CPUs that you have seen have an active-low reset, therefore all of them do. RTFDS.
 

Offline ice595

  • Regular Contributor
  • *
  • Posts: 98
  • Country: ca
First project is a USB CDC ACM to LCD interface

https://youtu.be/4pnEp9554o0

This really reminds me of my capstone project I did 3 years ago.
I used the CoreTemp SDK to gather CPU clock, temperature and I think I used a native Windows API or performance counter for CPU and RAM usage.

 
The following users thanked this post: ebclr

Offline serisman

  • Regular Contributor
  • *
  • Posts: 100
  • Country: us
All GPIO are high when the bootloader is active. I didn't try to determine if this is due to pullup resistors being enabled (most likely) or being driven high.

Note that reset is active HIGH on these chips. This is different than almost every other MCU or CPU. Active LOW is the norm. There is an internal pulldown resistor on the reset pin.

8051 based MCUs (including the original 8051 and all derivates) had a positive polarity reset. So you are in fact wrong.

Well now, that is also in fact wrong.  There are certainly 8051 derivatives that have a negative polarity reset.  For instance, the Nuvoton N76 and MS51 series both use a negative external reset (and there are probably others).  So don't assume anything, and always double check the datasheet.
 

Offline hidden

  • Contributor
  • Posts: 11
  • Country: cn
Attached is CH55X ISP Introduction(Chinese )
« Last Edit: August 10, 2020, 11:36:37 am by hidden »
 

Offline olin

  • Newbie
  • Posts: 4
  • Country: 00
Frustrated by the variety of different bootloader versions for CH55x and their spotty support in open source FW uploader tools I have created a new project that combines them into one. It supports several bootloader versions: v1.0, v2.3.1 and v2.4.0. The project is hosted on github here:

https://github.com/ole00/chprog

 
The following users thanked this post: oPossum, laneboysrc


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf