A quick guide to first-time STM32 dev boards, from someone who learned the hard way

Nov 18, 2026 Last reply: 2 days ago 4 Replies
Jump to replies (4)

Nice work getting a board this far along as a first design. The crystal routing question is a classic worry. Honestly, for the HSE, keep the traces short and symmetric-ish, keep the caps tight to the pins, and you're 90% there. The other 10% is avoiding routing anything else under or near the crystal. If you can, put a guard via to ground around it or just pour copper on the ground layer right beneath. At 8MHz, stray capacitance is not going to ruin your day the way it would at higher frequencies. On the SD card DET_A pin, that's the card detect switch. The usual approach is exactly what you saw: pull up to 3.3V through a resistor, say 10k, and run it to a spare GPIO so your firmware can poll wheather a card is inserted. Some people just tie it off if they don't care, but having it readable is handy for detecting hot insertion. Since you're powering from USB and a 1S LiPo, double check your diode setup. A schottky in series with the battery is the simple fix, but you'll drop a few hundred millivolts which matters if you're running the MCU near the low end of its range. A power path management IC or a simple ideal diode arrangement is cleaner if you can fit it. Also, don't forget a way to measure battery voltage, even just a resistor divider to an ADC pin.



For learning the why behind decoupling and ferrite beads, Henry Ott's book on EMC design is the classic read, and there are app notes from the big silicon vendors that explain the reasoning properly.


I went through this exact project last year with an F103 on a little board powered from a single LiPo cell. On the power side I just used a Schottky from the battery into a cheap TP4056 module and accepted the drop. Mine ran fine even when the cell sagged to about 3.5V under load, so the few hundred millivolts did not bite me, but your mileage will depend on what else is on the board. If you have a sensor or radio that is fussy about its supply, test with a nearly flat battery before you commit to the layout.

For reading the battery level I used a divider with fairly large resistors so it does not drain the cell when sitting on a shelf, and I had the firmware sample it every few minutes rather than constantly. Woke up one morning three months later to a board that had flattened its own battery, so now I keep that habit. On the crystal I was paranoid like everyone else and kept the traces short, kept the caps close, and left the area under it empty on the layer below. It started on the first try and has run through dozens of power cycles since. Honestly at 8MHz I think people worry more than they need to, but the empty copper underneath costs you nothing.

The card detect pin is nice to have readable. I wired mine the same way and it makes the firmware so much nicer when you can show a proper error instead of failing a write silently.

Gotta push back on the Schottky being no big deal. The reason it worked out for you is the F103 is happy down at 2.0V, so a few hundred mV of drop barely registers. Stick an SD card on there though, they get cranky below about 2.7V at the connector once you account for regulator losses, and a sagging cell plus diode drop can put you right at the edge. I had intermittent card failures that took weeks to trace back to exactly this. Cheap fix either way, but it's not something to wave off without checking what your lowest voltage rail actually feeds.

Reminds me of when I was doing this stuff with wire wrap and hand-etched boards in the 90s. Never had a crystal fail to start even then, and we didn't have nice ground pours half the time. One trick from back then that still works: keep the crystal on the same side as the chip if you can. Vias in the crystal path are where I've actually seen trouble, not the trace length itself.

Update: that point about the F103 shrugging off voltage sag made sense untill I got to the SD card bit, since mine hangs off the same regulator. So I dropped the series diode plan and went with a proper power path setup instead, plus a divider into a spare analog pin to watch the battery. Also moved the crystal to the chip side of the board like the older poster suggested. Rev 2 ordered.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required