A module like the Maple Mini has almost no use on its own. It’s really barebones. It needs to be connected to peripheral hardware so it can interact with the world. It’s something I do so often that I’ve developed efficient ways to go from a simple module to a board. This is an example of how to get started. It’s by no means the only way or even the best way, it’s just a way that works really well and saves me time. Your mileage may vary.
The starting point of any prototyping board is a board with a Maple Mini on it, as well as an SWD connector to program it.
And just because my idea of “basic” is usually a few notches above the dictionary definition, I’m going to add an OLED display. Not just because I can, but because it’s always useful to be able to display information straight on a prototype. Prototyping usually involves a lot of trial and error, so it’s good to have more than an LED and a debugger to display what’s going on. Don’t worry, the display is optional.
1.1. Choosing a Substrate
If you’re going to build a prototype board, you’ll be needing a prototyping PCB (printed circuit board). They come in a myriad shapes and sizes but in the end the idea is always the same : a board covered in holes and pads so you can solder components everywhere and in any position. Here’s a very popular example of proto PCB :
This is yet again a Chinese product, available from many sources. There are also many different sizes other than those shown in this photo, in fact they go up to a ridiculously large 200 x 300 mm.
Those boards are mass-produced and very inexpensive though of course the larger they get, the more they cost. That’s the way of the world. Their most interesting feature is that they are double sided, and each hole is plated. They solder really well but you need to be extra careful to avoid short circuits between both sides. As a general rule, do not use uninsulated wires to make connections on those boards. Think about it for a moment, you’ll figure out why. If this scares you, there are single-sided boards in similar dimensions.
Now, I don’t think I need to write this but you should obviously choose a substrate that is :
- Larger than the Maple Mini, since you’ll be mounting it on.
- Large enough to fit everything else you want to connect to the Maple Mini.
If no board is large enough, and it’s not because you’re overcompensating, don’t worry : ain’t no law that prohibits you from using multiple boards. If they are the same size you can even stack them using threaded risers.
If you want to reproduce my exact board, choose a 7 x 9 cm double-sided prototyping board.
Now that we have a substrate, let’s figure out where the components go.
1.2. From Inside Out
There is an order to everything. With the construction of MCU prototype boards, the best order tends to be from inside out. Meaning : start by placing your microcontroller (or module, in this case) towards the center of your board and then build up all the additional hardware around it. The board’s I/O connectors should come last, since they tend to be the farthest from the MCU.
Naturally, if you intend to use the USB connector on the Maple Mini, then you’ll need to place the Maple Mini so that its USB connector is near the edge of your board.
Here’s an example of placement :
This will leave plenty of room around the Maple Mini to connect stuff, and the USB socket is at the edge of the board so that a USB connector can’t interfere with anything.
Now, before soldering this module to the board, let’s worry about the SWD header.
1.3. The SWD Header
If you remember the page on programming the Maple Mini, the SWD interface requires four wires : clock, data, I/O voltage reference, ground. Therefore, the board needs a four-pin header to bring those signals out.
The SWD header may only be useful while programming the microcontroller : it might never be used again once the board has been deployed. So it would be great if it took as little room as possible on the board, or even none at all. At the same time, it’s best to place it as close as possible to the SWD pins on the Maple Mini. Your proto board is likely to have very poor signal integrity. While SWD isn’t a very fragile interface, it’s best not to tempt fate.
The optimal solution is to place a right-angle header under the Maple Mini, like this, for example :
This isn’t obvious on this photo but the header is placed underneath the “USB end” of the Maple Mini. I like keeping all my connectors close to the edges of my boards. You should too.
The particular board I’m making is designed to fit a large OLED display that will go over the Maple Mini module. And I also want to keep it cheap. As a result, I will be soldering the Maple Mini directly to my board to give it a low profile and save the cost of female headers.
You can use female headers on your board : this will let you replace a dead Maple Mini without desoldering anything and it will also add up to a centimeter of clearance between the Maple Mini and your board. In that case, you can solder the SWD header on the same side as the Maple Mini. Here, this is simply not an option.
1.4. Nefastor-Style SWD Header
As I’m writing this web page, the board I’m working on has a severe height constraint that forces me to solder the Maple Mini directly to the board, with the SWD header on the bottom side. This is tricky but that’s the sort of madness that makes me look like a total badass at the coffee breaks.
A couple important words of caution If you plan on doing this my way : first, test that you can flash your Maple Mini before soldering it. It takes a lot of effort to feel stupider than when you realize you’ve just soldered a dead chip onto a board. Second, there are components under the Maple Mini where this header is mounted. Make triple-sure the header pins will not be touching any of those components.
If you use my exact component placement then you’d think you’re in the clear, but the reality is that your headers (both on the Maple Mini and your angled SWD header) may have pins of different length and insulators of different height. All I can do is show you, in this section, how to mitigate those variations but let me make this abundantly clear :
I absolutely don’t care if you blow up anything because you didn’t check your boards for short circuits. Not my responsibility. This is a slightly dangerous procedure, proceed at your own peril. Again, this is just my personal website, I’m talking to myself here. You’re listening to the voice in my head. Any and all complaint will be ignored as figments of my imagination. You have been warned.
Now, here’s my trick in a nutshell : the SWD header needs to be soldered first because its pins will end-up below the Maple Mini. Since I’m using a double-sided prototyping board, however, I can solder the header from the bottom side of the board. This will reduce or eliminate the “solder bulge” on the top side of the board, allowing you to cut the header’s pins short. If you do it right, end the result will look like this :
As you can see, the SWD header pins won’t touch the small components at the bottom of the Maple Mini.
1.5. Wiring the SWD Header
Let me bring back the pin map from the page on programming :
The SWD header needs to be wired to the pins marked 21, 22, VCC and GND. Also, let me remind you that the Chinese Maple Mini doesn’t have a dedicated analog 3.3 V source : the 3.3 V and GND pins on both edges of the module are connected to the same nets.
The cleanest approach to wiring the connector is to lay down some uninsulated copper wire on the top layer. Bend it before soldering to ensure the wire lays as low as possible and won’t touch the bottom of the Maple Mini. It will look like this :
Cut the excess wire length, insert the Maple Mini and solder only those four wires : the idea is to test that the module can be programmed before going ahead. Did I mention I like to double-check everything ?
1.6. Build an SWD Probe Cable
This step is dependent on the probe you’re using, so I’m going to give detailed instructions and pinouts.
To save time, I make my probe cables by disassembling individual “Dupont wires” and reassembling them into multi-point shells. Here’s what it looks like :
If you’re making the exact same board, the signals are :
- 3.3 V on the red wire
- SWCLK on the green wire
- SWDIO on the blue wire
- Ground on the black wire
I recommend you don’t solder the remaining pins of the Maple Mini until you’re actually wiring something to those pins. It’ll be easier this way, and you’ll also have an easier time desoldering this board if you really need to. Considering we’re talking about less than 5 Euros worth of components, that’s probably not going to be worth your time but you never know.
At this stage, the board is operational. It can be powered through USB and you can flash and debug code. Which is what we’re doing next.