Mixed-Signuino: My STM32G4 Mixed-Signal Microcontroller Board
A reusable mixed-signal microcontroller module built as an exercise in using STM32 chips in custom designs.

For a while now, I've wanted to move some of my analog projects, like the electronic load I built a few years back, over to digital control. A great fit for that kind of work is the STM32G4 series, a very handy mixed-signal line of microcontrollers by ST, which means they combine all the usual power of STM32 microcontrollers with extended analog capabilities. They come with high-speed 12-bit ADCs, 12-bit DACs with low-noise outputs, opamps right on the chip that can be used as buffers or amplifiers (including PGA), analog comparators, and specialized timing and control features for, e.g., motor control. I haven't worked with STM32 chips in a while and I have never actually laid out a board with one, so I'm setting this module up as an experiment board for my projects. Plus, of course, it's nice to have this as a reusable mixed-signal module for when I need one. In my case, I plan to use this in my digital control loop experiments and some audio synthesis applications.
I call this bad boi the Mixed-Signuino.
Design Choices
If you want to follow along, here's the full schematic as a PDF.
Form Factor & Layout
For the form factor, I wanted something more compact than an STM32 Nucleo. Something you can easily plug into a breadboard when you are trying things. So I was aiming for something like the Arduino Nano or Raspberry Pi Pico. I ended up choosing the outline of the Raspberry Pi Pico (51.05mm x 20.57mm, minus the castellated holes of the Pico on the header flanks) with the same 2x20 pin headers aligned to a 100mil grid for breadboard compatibility. I also made the pinout mostly compatible with that of the Pico, because the Pico actually does a really good job there: power pins near the input and numerous GND pins interleaved with the GPIO pins for shorter return current paths.

From top to bottom: Arduino Nano, Mixed-Signuino, and Raspberry Pi Pico 2
Unlike the Pico, I chose to go with a nice and modern USB-C jack, because I find them more robust than micro USB and I just don't want to deal with that. Behind that there is the protection for power input and data lines followed by the power regulation section. Nice and centered, we have the actual MCU to make it as easy as possible to fan out all the pins. At the bottom of the board, opposite the USB connector, we have a TC-2030 debug port and buttons and LEDs, so they stay out of the way of routing and wiring.
The MCU: G474CBT6, LQFP-48
So, we want a G4-series microcontroller for the mixed-signal capabilities, but how do you go about picking a specific one out of the large selection? Based on the outline and header pin count we've chosen for the board and keeping it decently easy for hand soldering, we can settle on the LQFP-48 footprint for the microcontroller. This footprint has enough pins to support all our functions and the 2x20 headers, and it's easy enough to solder by hand with a hot air station or even just an iron. That already limits the selection quite a bit.
Next we can look at the required capabilities. On ST's website1, we see that the G4 series comes in three lines:
- The STM32G4x1 access line, which is described as entry-level and comes with up to 3 ADCs, 4 DACs, 4 comparators, and 4 opamps
- The STM32G4x3 performance line, which is described as high-performance and comes with 5 ADCs, 7 DACs, 7 comparators, and 6 opamps
- The STM32G4x4 hi-resolution line, which is described as providing high resolution and comes with the same 5 ADCs, 7 DACs, 7 comparators, and 6 opamps as the performance line, but also features a high-resolution 184ps timer
Within these lines we then have variants based on how much flash memory and RAM they have and certain connectivity options they may have. For our purposes, we're just looking for a simple experiment platform, so we could just pick the weakest LQFP-48 chip in the access line and call it a day. However, when we check the supplier options we have as hobbyists, in my case LCSC2, we see that the cheapest STM32G4 LQFP-48 option is actually the STM32G474CBT6 from the 4x4 high-resolution line (albeit at the lower end of the 4x4 memory range with 128K flash and RAM, but that's plenty for our purposes). At the time of writing it costs about $4.60 a piece in low quantities. This can happen when the part in question just happens to be very popular. Then the supplier can get them from the manufacturer in large quantities and pass the discount on to the end customer. So that's always worth a check when picking a part! Naturally, we're going with the STM32G474CBT6 now!
When it comes to integrating this MCU into our circuit, it needs separate power supply rails for analog and digital, like all G4-series mixed-signal MCUs. It also has a VREF pin, which lets us either use the chip's internal voltage reference or supply an external one. To allow for the latter, I broke the VREF pin out to the pin header (which doesn't actually work on this board, see below).
After connecting all the common MCU module necessities like the crystal, the buttons for NRST and BOOT0, the controllable LED, and the debug header, I broke the remaining pins out to the pin headers and was left with only two unused pins: PC14 and PC15. I fanned those out to untented vias, so you can solder to them if you absolutely need to.
Power Tree
The board is designed to be powered from a 5V system voltage, VSYS. In most cases, that will come from the USB jack's bus voltage, VBUS, but both VBUS and VSYS are also broken out to the pin header, just like on the Pico, so an external power supply can feed VSYS directly. A Schottky diode from VBUS to VSYS allows us to connect both USB and an external supply at the same time without back-feeding voltage into the USB port. So we're essentially ORing the two power supply options. That's the same approach that the Raspberry Pi Pico takes3. To protect our circuit during plugging and unplugging events or from other disturbances, I placed a 6V transient-voltage suppressor (TVS) Zener diode between VBUS and GND to limit potential voltage spikes on VSYS to 6V. And while I was at it, I also added a TI TPD2EUSB304 protection IC for the USB data lines.
The power we get from USB is potentially very noisy, so we have some low-inductance 0402 caps right at the connector and then go into the low-dropout regulators (LDOs) that convert the 5V from USB to the 3.3V required by the MCU.
Originally, my instinct was to go with a classic AMS11175, but that's a relatively old part and for a mixed-signal application we want a nice and quiet power supply rail, at least for the analog side. So I looked into more modern LDOs with a higher power-supply rejection ratio (PSRR) and settled on the TI TLV7756. This newer regulator comes with a bunch of advantages over the AMS1117! First, and most importantly for our application, the PSRR. The AMS1117 datasheet5 specifies a PSRR of 60-75dB. That's good but it only specifies that at 120Hz, the second harmonic of the 60Hz (US) power grid. Beyond that, the ripple rejection drops off significantly, although we don't even get any figures for that in the datasheet. Ripple at 120Hz is a typical mains hum, but for our application it's not the kind of ripple we're worried about. With a USB-powered device, we're expecting the ripple to come from a switch-mode power supply and be in the 100kHz to 1MHz range, significantly above what the AMS1117 is designed to handle. The TLV775's datasheet6 specifies its PSRR at 60dB for 1kHz and still 45dB at 1MHz. Together with our passive filtering, that gets us in a very workable range!
Then there's the input and output capacitors. Old regulators need electrolytic capacitors in the range from 10µF to 100µF and those are quite bulky for a small board like this; and we can't replace them with smaller ceramic capacitors either, because old linear regulators can actually start to oscillate when driving low-ESR capacitive loads like ceramic capacitors. The TLV775, on the other hand, is perfectly fine with ceramic capacitors and only requires 1µF on input and output, which we can easily cover with 0402 MLCCs.
Now that we're set on the regulator, we need to think about how to get two separate power rails for digital and analog, so the digital operation of the MCU doesn't pollute analog signals. There's a common technique of using ferrite beads as filters for this kind of application, but if you want to do that right, ferrite beads are quite the headache because they have dynamic characteristics which limit the frequency range for which they work and can even cause resonances that amplify noise in the worst case7. I'm not doing that. I'm just using two LDOs. One for digital, one for analog. That leaves us with a power tree looking like this:
graph LR
p_bus[USB 5V<br>VBUS] -->|Schottky Diode| p_int[On-Board 5V<br>VSYS]
p_bus -->|6V TVS Zener Diode| p_gnd[GND]
p_ext[External 5V] --> p_int
p_int --> p_reg_d[Digital 3.3V]
p_int --> p_reg_a[Analog 3.3V]
Power tree of the board. The system can be supplied from USB or external 5V and analog and digital supply rails for the MCU are generated by separate LDOs for isolation.
Stackup & Routing
| Layer | Material | Thickness |
|---|---|---|
| Top, Signals + Power | Copper | 0.035mm |
| Dielectric | Prepreg | 0.099mm |
| Inner 1, GND | Copper | 0.015mm |
| Dielectric | Core | 0.500mm |
| Inner 2, GND | Copper | 0.015mm |
| Dielectric | Prepreg | 0.099mm |
| Bottom, Signals + Power | Copper | 0.035mm |
Stackup and layer allocation for the board
Now to the design of the actual PCB itself. Many cheap microcontroller modules are 2-layer boards. That's cheap to manufacture and fine for many applications, but it causes problems for return current. If you pour GND fills on both sides of the PCB but also route traces there, these traces will interrupt return currents under traces in many places. The circuit still works because the current finds a detour, but when the return current is no longer under the trace but wanders around the board, the overall current loop of the trace encloses a much larger area. This loop area is what makes a signal trace act as an antenna that picks up all kinds of noise and also radiates it to other traces and circuits.
But even if you route a two-layer board with great care and always provide short paths for return currents, you're fundamentally limited in the performance you can achieve because the signal traces and their return current on the other layer are quite far apart, the whole thickness of the board. The spreading of the electric field depends on the distance between the conductors of the current loop. That's why you often see rules of thumb to keep traces 5H, or some other multiple of H, apart, with H being the distance between the adjacent copper layers. For the analog signals on our board, far-spreading fields that couple signals together are the last thing we want. We're not carefully designing a low-noise power supply for them only to have them ruined by crosstalk and external interference.
That's why I went with a 4-layer stackup for this board. In stackups with 4 or more layers, the layers usually appear in close-together pairs for exactly this reason, to keep the signals close to their return currents. For our board, I chose the stackup in the table on the right (JLC04081H-3313, from JLCPCB). I allocated the top and bottom layers of the PCB to all signal and power traces, while both inner layers are solid GND planes. This way every signal has an uninterrupted GND plane only 0.1mm away.
For routing, I'm working with the basic manufacturing process JLCPCB offers, and that lists a minimum trace width of 0.1mm in their capabilities8. That's perfectly fine, since I like to route most of my signals with 0.2mm traces for a lower impedance. The thinnest traces in this design are the two that form the differential pair for USB data. They're 0.15mm wide to meet the 90Ω differential impedance required by the USB specification9. My power traces I like to keep wider at 0.3mm for lower impedance.

Assembled board, bare top and bottom
My main routing constraints from the manufacturing process don't actually come from the minimum trace width, but rather the minimum via size. I use 0.5mm annular diameter vias with 0.3mm drill holes in this design to keep some safety distance to the minimum of the process, but that's still quite large for a tiny board like this. The way I've chosen to route the MCU signals to the pin headers, I need to move a lot of signals between the top and bottom layers, and all signals that go through vias also need GND vias close by to keep a continuous reference through the layer change. Routing all the signals where they need to go while still finding the space for all the vias was the main challenge of this design.

Closeup of the fan out of MCU pins. Signal vias are interleaved with GND vias taking up significant space.
This picture shows the fan out from the MCU. The main idea was to get the signals either directly to their header pins or other destination if possible, or to get them away from the MCU to a spot with enough space to allow us to have them cross to the bottom layer with the large vias we have available in the process, their GND vias, and as much spacing as we can to reduce crosstalk.
Because of the fan out, the crystal is further away than you would usually have it from the MCU, but the traces are still not long enough to throw off the capacitive loading of the crystal. There's a 2.75mm skew in the trace lengths of the crystal, but that only results in about 0.3pF capacitive skew vs the 10pF load capacitors, so that's negligible. And because we have a GND plane right under the traces, they couple to that and the loop area of the crystal path is not determined by the area enclosed by the two crystal traces, but by the length of the two traces times the distance between the first two layers.
Programming & Debug
For programming convenience, I broke out BOOT0 and NRST from the MCU to the pin headers and to two push buttons. That enables us to boot the MCU into DFU mode where we can flash new firmware via USB or other protocols. For debugging, we also have a dedicated TC-2030-NL footprint for a TagConnect debugging cable. This footprint exposes 3.3V, GND, NRST, and the Serial-Wire Debug pins SWDIO, SWCLK, and SWO. SWDIO and SWCLK are enough for on-chip debugging and that's all we get on the Raspberry Pi Pico, for example, but with the additional SWO pin we get access to nice bonus debug features like live variable update streaming or additional log and debug data channels without the need for a serial interface on the USB port.
Assembly and Live Tests
On a board with footprints this small you definitely want to use a stencil to apply solder paste, so I got that alongside the PCBs from the fab. The soldering was easy enough with a cheap hot plate and a hot air station. The 0402 passives sometimes sit a little off center, but all in all not too bad. The trickiest component was definitely the TPD2EUSB30 USB data line protection IC. It has some seriously small pads and even with a stencil the solder paste was fighting me a little there. The push buttons did get a little too hot during this process, so their plastic surface doesn't look too happy. But that's a cosmetic issue I can live with.
Programming and debugging the board works perfectly over the TagConnect port with a standard STLINK-V3MINIE programmer. An obligatory LED blinking firmware and some streaming of analog data show the chip is alive and well.
The Blunder: Missing Capacitors
There is one annoying blunder in this design I need to address. Somehow I forgot to add the capacitors on the MCU's VREF pin that it needs to buffer the chip's internal voltage reference (they're marked as missing in the schematic10). If I try to use the internal buffer without them, it oscillates.

ADC loopback of a 1kHz DAC sine without the VREF capacitors: the oscillating reference shows up as noise that grows with the signal level

There is an easy workaround for this revision: I just short the VREF pin to the adjacent VDDA pin, but that's not a perfect solution. With this short, we're using the analog supply voltage as a reference and we can't use an external reference from the pin header, since that would just short to the analog supply rail now. To prevent this, I cut the trace from VREF to the pin header to make a short like this impossible.

The same loopback with VREF bridged to VDDA
Also, there's the stability of the analog supply rail itself. The TLV775 is a very decent voltage regulator, but it's no voltage reference and that potentially limits the analog accuracy we can achieve with this revision. For my current purposes and with the separate regulator for analog supply voltage, this likely won't be an issue in practice, but it's definitely a blunder that needs to be fixed in the next revision.
Conclusion
With this design, I now have a handy platform for mixed-signal work in the convenient form factor of the Pico. Especially the constrained routing in the limited board space and with the large vias of the process was a nice challenge.
Apart from the missing VREF capacitors, the board does what I built it for: it programs and debugs reliably, the analog peripherals work, and it plugs right into a breadboard next to whatever circuit I'm poking at. So the next time I want to close a control loop digitally or play around with audio synthesis, I won't have to start from a bare chip.
What I Would Have Done Differently
There's of course also a couple of things I would do differently for a future revision or version of this board. I kept the bottom side of the PCB free from components to align it more with the Raspberry Pi Pico and keep the assembly process simpler, but frankly, due to the absence of the Pico's castellated edges on the Mixed-Signuino, we can't directly surface mount it to a board anyway. Not that I've ever actually done that with a Pico, either. So for the next iteration I would just move the power regulation chips and auxiliary components to the bottom of the board. That way I can keep the top of the board mostly free for routing and don't need to move the signals between layers, which was the biggest routing challenge for this design.
Then there's the TC-2030 connector... I went with the TC-2030-NL, the version without latching legs, which leaves two options: press the cable against the board by hand, which feels really flimsy, or use the little retaining clip on the back side, which takes way too much force to put on and pull off. It technically does its job, but for the price, I just can't recommend it. For the next revision, I'd go with a simple pin header instead.
What's Next
Well, the interesting aspect of this board is the mixed-signal capabilities, so there's a lot of characterization to be done there. In particular, I want to look at the noise on the die for an analog input / output while having digital communications going at the same time. That's more of a characterization of the chip, though, so I also want to look at the crosstalk and radiation of my signal traces to see if my routing care paid off. For that it will also be nice to compare the performance to that of the Raspberry Pi Pico, which has a 1mm thick two-layer design.