USB-C is more and more becoming a standard in the maker community for power supply and coms with peoples creations. But there is a catch to this although the USB A plug to USB C plug cable is freely available almost everywhere, the sockets can be a little more daunting. There are not only many to choose for including some with and without through-hole pin the pitch and spacing often means you have to spin a PCB to make them work. then there are concerns with soldering them effectively.
Who wants some PCB USB-Micro breakouts? I have like a billion, they're so much fun pic.twitter.com/xbk6nVj9JW
I started to wonder if this would be possible with a USB-C socket with one edge of the PCB inserting into the USB-C plug connector directly. I did a quick Google search and was very surprised that this seemed as though it hadn't been done before. 😏
And there it was the "tongue" of the USB-C receptacle is 0.6mm wide wit the contacts proud of the Plastic or in my case PCB.
Wondered if 0.6mm PCB would break the bank in production costs so it was time to have a search around. My usual stop now for PCBs is JLCPCB. Is I went and had a quick look to see that it wouldn't cost the earth to at least experiment and see if this is viable.
Surprising enough that even with a lead-free finish it would only cost £6 including shipping, at least to do some experimenting.
Even if I ordered V-cut panels which would give me 90+ pieces they would cost less than £0.13 each.
It was slightly shocked at how the price jumped when I selected my usual black solder mask finish, with a large "Special Process Fee". That would certainly blow the budget feels like I'm ordering boards in 2013 again 😅. Looks as though I want to be able to sell these at a reasonable price then they will have to be green.
With my mind made up it was back to the USB-C spec sheet.
Time to fire up KiCAD and get on with creating the part.
It took a bit of drawing but here is. there is something that I found frustrating within KiCAD. this is I couldn't find a way to draw on the edge cut layer in the footprint editor. Not entirely sure if it is something I missed but decided to draw the board edge into the user drawing layer that I can copy over later.
At the end of the day, I just want to see if this is a workable design so decided that making a breakout is the best plan.
So far I have done two designs the one on the left has all 24 pins broken out for USB-SS and the right one is just for up to USB-HS. All the highspeed lined have their differential traces matched in length but the SS traced don't have the required supporting hardware, caps and filtering etc.
It was around this time i started to tell people what I was up to at which point I found there have been a few previous attempts at this type of connector.
Been there, done that, it is not worth it. The connection is super flaky, it wears off quickly and with a 3D printed case it's not even cheaper. pic.twitter.com/Qs3lwCRHlV
I'm not put off exploring this path however I still think this could be a viable option could do with some tweaks in the long run. The other reason for continuing this is I don't think this option has been completely explored of documented yet.
At this point, I'm making some final tweaks to this design and hopefully sending off for production next month.
If you are interested in exploring this concept yourself all my Kicad files are available on Github so feel free to use them as you desire.
For a few years I have been looking at different MCUs with USB capabilities in most cases there are not many sub $1 parts that fit the bill.
If you want something small and discreet that does a few USB functions there isn't much around, normally the barrier to entry on these types of MCUs 8 bit and 32 bit included is over the $2 mark. The issue start to become when costing the bill of materials $2 on the BOM becomes $8 by the time you get to retail price.
There are a few low cost MCUs out there like the range from STC or Nuvoton once you add a USB transceiver the cost seems to double.
I know it sees to be very focused cost but with companies form overseas being able to produce USB devices with the low retail price there must be some solution out there.
My over all goal is to demystify USB and develop a platform that gives developers confidence to develop USB devices without large overheads or in some cases complicated stacks that are beyond comprehension.
I have spoken about my admiration of the CH55x range from WCH that are a series of ultra low cost micro controllers with USB in some of the range is down in the $0.25 category in volume. Which is unbelievable a full capable MCU for the same as a discreet logic IC.
As well as the USB2.0 transceiver and the E8051 processing core itself they come with a resonable array of peripherals as well 2 x UART port, SPI , 4 channel 8 bit ADC and 10k to 64k flash space in the case of the CH559.
There are a few dev boards out there for the CH55x range mainly from electrodragon with their CH55x range of boards. They are a nice range but I feel they have a couple of points that I would love to see improved on.
This is why I decided to start the CHUSBIE range starting with the CHUSBIE552 based on the CH552T or CH552G a lower cost less IO version.
With the CHUSBIE552 I have added onboard functions that I think will be the most useful to a developer like:
onboard reset and bootloader buttons
RX and TX indicator LEDs
sensible pin-outs with pins and ports in order
optional landing for external XTAL crystal for precision timing applications
Power indicator LED
I would like to see a general adoption of the CH55x range chips in a similar way to the ESP8266 and ESP32 (notably neither of which have native USB which in my humble option would be a killer addition).
I want to work on the software stacks to make them more friendly for a start making sure the Chinese comments are translated to English for the examples especially the USB ones. My point is that USB doesn't need to be this mystical black box that can't be easily accessed by most hobbyists and makers.
So far in my research I found firmware for USB CDC device, USB HID device and USB JTAG device all of which i am trying out to incorporate into a master repository.
I have not been hiding the fact that I have love for the CH55x range of microcontrollers. So much so that I decided to stock several versions on the store. If you want to get hold of a few to experiment with check it out at Rabid's Electronics Emporium
I thought it's about time to write up a little tutorial on how to get up and running with this little unsung hero.
For this getting started tutorial I will be specifically looking at the CH552G but this tutorial will also apply for the CH551x, CH552x and CH554.
Installing the Toolchain
This is not the only way to set up this toolchain there are other compilers and toolchains available, this, however, was the most straightforward way I found to get up and running.
First off the best thing to do is to install the compiler for this tutorial. We are going to use SDCC (Small Device C Compiler) this compiler runs natively in most linux flavours but if you're developing on a windows machine like I am then it will be worth setting up WLS (Windows Linux Subsystem) and installing Ubuntu.
As I mentioned I didn't use this method but if you feel a little more comfortable using it instead of installing WSL and Ubuntu it's worth a shot.
Preparing the hardware
The MCU itself requires very little hardware to run in USB programming mode. Though a reasonable soldering skill is needed to solder the chip into a proto-board. There are many tutorials online on the best method to do this.
The above video is a very similar method to what I use. I am also considering stocking some already soldered on the store, as I will soon have the prototyping boards available.
Once you have your board soldered and pins attached the rest of the circuit can be made up, on a breadboard. For me, I found the easiest way to attach the USB signal was to Butcher an old USB cable and solder Dupont jumper wire onto the exposed ends.
This has been really handy while I have experimented with this MCU.
The rest of the supporting circuitry can be made up, on a breadboard all it requires is 2 x 100nF ceramic capacitors between 3v3 and GND and between VCC and GND as down below.
If the chip is new and fresh from the factory then from my experience it drops straight into bootloader mode no a widows PC it makes the always familiar USB device sound :).
Of course, if this doesn't happen then the MCU will need to be set into bootloader mode.
Putting the MCU into USB Bootloader mode
There are two possible bootloader pins ton the CH552 the default from the factory is on P3.6. To active the bootloader the pin must be pulled to 3V3 briefly after reset. This can, however, be very problematic as the same pin is shared with USB DP. So for my purposes, I like to set up the bootloader pin as the available alternative which is P1.5 there is a catch though this pin ins needed to be pulled to GND.
Writing Firmware to the MCU
First of all, you will need to download and install WCHISPTool this is the official and poorly translated to English tools from WCH themselves.
Oddly enough the English WCH site doesn't give you any of the download links to the tools of datasheets so you will have to go through the Chinese site.
once the software is installed and running it will look much like the above. You will need to select the '8-Bit CH55x series' tab and select the CH552 as you devise then all being well your device should appear in the device list below.
This tool gives you a few configuration options like:
Disabling the reset pin
Enabling slow reset
Erasing the data flash
Swapping the bootloader pin to P1.5
From my own experience swapping the bootloader pin is worth doing for me it helps getting it into bootloaders mode as P3.6 (the default pin) is shared with USB Data + which cam make things awkward. Where you have P1.5 tied to GND was very helpful for me as the MCU then automatically goes into USB bootloader mode every time it is reset or powered.
To test the function everything is well if you select the user firmware you would like to use I used blink which but this point should be in the toolchain examples.
\ch554_sdcc\examples\blink\blink.bin
This will need to be selected as your 'User file' the click on Download(D) all being well you will have some lovely green text in the download record below saying the process was successful.
All being well if you hook and LED and resistor between pin P1.7 and GND then you will have a lovely blinky LED.
Starting your own application
This is very simple from mine I copied one of the examples and I started to edit form and just use the make command to compile it.
After a bit of trail and error managed to make it run LPD8806 strips of LEDs.
Messy but works :D
What I would like to do now is to add a USB CDC driver so I am able to adjust the colours over USB.
I have a both the CH552G and CH552T which has more IO are listed on my Tindie store.
Boldport is an electronics design firm headed up by Saar focused on designing boards that are both beautiful and functional some of his designs including The Seahorse, The Life Game and The Cordwood Puzzle. Saar's PCB designs are both beautiful and unique, using every layer of the PCB to give the greatest impact including designs by exposing the copper layer and using back lighting to highlight otherwise invisible design features.
The Boldport Club is a subscription service setup by Saar for people to own their own piece of these beautifully designed circuits. These subscription costs £49 for a three months that's inclusive of taxes and shipping. The circuits are combinations of solder at home kits and single beautiful boards.
My first kit arrived a week ago and I have been itching to put it together.
The first kit is the Pease board this is a tribute to Bob Pease a renowned designer at National Semiconductors and quoted on the front of the packaging 'My favorite programming language is solder' which makes me smile every time I hear it. The circuit provided is a light intensity to frequency converter based on the LM331 which was one of the famous ICs designed by Bob Pease.
The kit is stunningly well packed in a laser cut corrugated cardboard sandwich the amount of thought that has gone into to overall out of the box experience is breathtaking. I felt guilty opening it as it would destroy the packaging.
The story continues on opening the packaging every part feels well thought through.
The surprise in this kit is you are supplied with two PCBs I'm assuming one to make and other one is to keep as a key ring.
On close inspection of the PCB there are visible SMT pads for soldering surface mount components. Well me being me decides that I'm going to make my Pease board surface mounted. Time to find that tube of solder paste.
Surface mounted components describe components that have been soldered on top of the surface of a PCB instead of 'Through hole' or PTH the component leads pass through the board and are soldered from the opposite side of the PCB. It is very possible to hand solder SMT parts to a board in fact I do it regularly with my work, but if a reflow oven is available then applying the solder paste to the pads placing the components on the paste and melting the solder in the reflow oven is far simpler.
I unfortunately didn't have exact values for some of the components so I had to swap some values around.
330pF -> 220 pF Capacitor
6.81kOhm -> 5.1kOhm Resistor
also used a Fairchild BSS138 for the drive circuit and a blue 0805 ultra bright LED.
I'm not sure what sort of effect this will have on the operation of th LM331 for pouring over the datasheet these components appear to control the frequency range.
So Here I am with the component soldered down nicely. The BSS138 seemed to be the wrong package type for this landing but the connections look secure.
Woot! it works. I found with mine that there was not much difference in the LED output but the oscilloscope told a much different story.
We if I can't get it to vary the LED brightness then just maybe I can get it to sing. So using the 3 watt amp from a Pimoroni Picade PCB, I Made a singing Pease Board/Theremin.
So final thoughts on the Boldport club, I am really enjoying the kits that are coming through my door each month, the give me some new outlooks into circuit design and I can't wait to see what comes next.