I want some feedbacks on the design, like what things I can improve in my layout.
A few things I noticed:
- if I’m guessing correctly, the 2-pin header on the right is the power input, and the headers on the left and bottom have 5V pins to power peripherals or whatever. But the input and outputs connect only through a quite thin trace running under the MCU. I’d try to come up with a route that gives them a fatter trace.
- C2, 3, 5, and 6 seem to be a smaller package than all the resistors and a few other caps. There don’t appear to be any particular space constraints on those capacitors, so why use smaller ones? Remember that multilayer ceramic caps suffer from DC bias effects (reduction in effective capacitance as DC voltage increases), and that the smaller the capacitor’s physical size, the stronger the effect (so physically smaller cap = lower effective capacitance). So it’s better to use physically larger multilayer ceramic caps whenever you can. For example,
on this page, they compare three 6.3V-rated 22uF caps from the same series, just in three different sizes. At 5V DC, the 1206 cap loses over 50% of its capacitance, the 0805 loses nearly 70%, and the 0603 loses over 80%! The effect is very, very significant, as you can see.
- to the extent that is practical for whatever assembly method you’ll be using, move the crystal as close to the MCU as possible. Make sure you don’t route any other traces underneath it.
- by moving PA2 and PA3’s top-layer traces to just above the RESET pad of the button, you could route RESET all the way to the MCU on the top layer, giving your bottom ground pour and traces more room. This in turn would let you route ADC3/4/5/6 more directly, and with a bit of luck and/or tweaking, that in turn would let you move PA4’s via to the right, no longer under the chip, and route its trace away from the crystal. This also frees up ground pour under the chip, where you could stitch the layers together better.
- as zapta said, your ground is quite weak (classic beginner “gotcha” that everyone messes up at first :p ) Their routing suggestion is exactly right. A trick I sometimes use to make sure I have nice fat ground connections between key areas of a board is to first draw fat ground traces connecting them (in addition to the pour) so that I can’t break up the pour with signal traces. Use lots of vias to stitch your ground pours — they don’t cost extra.
- a power LED is always welcome, as a reminder to be careful when working on a powered-on circuit.
- since there’s plenty of room for one, add a proper test point for your oscilloscope ground clip. It can also be a larger (plated) hole or slot close to the edge of the board