Chris Gammell Build Log

Wow, 6 years since i updated my build log. That’s a gap, eh? I have a new project not related to any work, so I thought I’d post about it!

I have been intrigued by the ch32v003 chip, the “$0.10 RISC V microcontroller” since CNLohr was on The Amp Hour

https://theamphour.com/637-ch32v003-fun-with-cnlohr/

I bought the breakout from Tindie and tried out some of the examples in the ch32v003fun library that CNLohr wrote alongside a community on Discord. Really great work! I had previously seen Dave (my cohost on The Amp Hour) try out the MounRiver IDE based off of Eclipse, but I was less interested in that (Windows only, HAL, etc). I think something like the ch32v003fun library is a great target for some low level development. Maybe others on CE would feel the same!

Most of the boards I have seen are targeting the 20 pin TSSOP, but I wanted to try out the 20 pin QFN, so that’s what i targeted. It’s not $0.10, but still very reasonable, think I had 150 of them shipped to me off LCSC for $30 total, incl shipping? I’ll take it, especially for an experiment like this. Here’s the board:

It’s a 2 layer board that I wanted to get over to JLC before they all leave for CNY, which I managed to do. I ended up ordering parts off of Digikey instead of LCSC because of concerns about things getting out in time, but future versions would probably target JLC assembly. I think I’d also target the 4 layer board because it’s better practice to have controlled impedance from the USB to the chip (more on that below). Let’s talk about what’s on here:

  1. An nRF24 breakout header
  2. An i2c OLED screen
  3. An i2c QWIIC / STEMMA header
  4. A programming header
  5. LEDs on 3 pins
  6. A user and a reset button
  7. Breakouts for all pins
  8. A USB connector

Numbers 1 and two are because there are code examples and I’d like to have two boards communicating over 2.4G and then displaying messages on the OLED. That should involve gluing code together, which is always its own challenge. Number 3 is to make things a bit easier to tap into the ecosystem of sensors without bundles of wires going to the breakout pins in number 7. Similarly 5 and 6 are there so I can test inputs and outputs and troubleshoot.

The programming header was copied from the breakout board that I got off of Tindie. Looking at the other available programmers, I’m not sure that the pinout is the same, but with 0.1" headers, I can always just jumper. Honestly the only thing that is required is the SWIO pin that’s on board:

OK, onto number 8. I added a USB connector for power (which can also come from the programming header) just like on the breakout shown above. However, the board above doesn’t have D+/D- connected. That’s because there isn’t a USB transceiver on board. Instead, CNLohr has been working on the rv003usb library (beta! beware!) which aims to connect to the pins onboard and then toggle the inputs/outputs as necessary. He was able to get the code to fit into the bootloader, which means you still have all the other space available for your programs. The library for USB also includes examples where the device will show up as a keyboard HID and other low speed items. That’s important because it’s low speed only. Which also means that my very poorly unmatched layout above will probably work. I will try things out and see how it goes. Future boards would target a 4 layer process so that it’d be much easier to get to a controlled impedance without any crazy dimensions required.

I have pretty low expecations on the timeline of this project, but thought it’d be good to post here for future-Chris to look back at.

2 Likes