stm32 implementation feedback - Page 1
Forum section: electronics / projects

author: kars
author_rank: Contributor
timestamp: April 10, 2019, 10:34:57 am
content: hi all!if been working on a project for the last couple of weeks. its a board based on the stm32f103rbt6 and a NCV7351D10R2G can tranciever.as im not that experienced with pcb design and microcontroller implementation id like to know what you guys/girls/things thougt of designs.i know there are still some faults i need to fix (unconnected traces and ground pads).thanks in advancekars

author: capt bullshot
author_rank: Super Contributor
timestamp: April 10, 2019, 10:40:11 am
content: Looks like you didn't fan out the SWD (serial wire debug) / JTAG pins. It's highly recommended to have them on a conveniently accessibly connector, the ST-Link style debuggers are cheap and easy to use, way more comfortable than dealing with a bootloader.Add a GND pin to the CAN connector. CAN without GND won't work.

author: kars
author_rank: Contributor
timestamp: April 10, 2019, 11:05:05 am
content: i've added the can ground now. the SWD is a good call but the bootloader is a requirement as it needs to be programmed via the arduino ide (not my requirement, im making this for someone else).this is also flashable by serial. the SWD pins are still broken out on the main headers in case the new owners still want to use it.thanks for you quick reply!

author: tsman
author_rank: Frequent Contributor
timestamp: April 10, 2019, 11:21:11 am
content: You've got VC and VIN on the XL2012 swapped on your schematic. The capacitor should be on the VC pin.No bypass caps for that SC662K voltage regulator.Why does your schematic have flipped labels??

author: kars
author_rank: Contributor
timestamp: April 10, 2019, 11:24:20 am
content: you are right, thanks!

author: Dave
author_rank: Super Contributor
timestamp: April 10, 2019, 11:29:34 am
content: I'd spin the chip 90° clockwise. Your traces seem like they are reaching around the chip on every single side for no reason whatsoever.

author: emece67
author_rank: Frequent Contributor
timestamp: April 10, 2019, 11:52:08 am
content: .

author: AndyC_772
author_rank: Super Contributor
timestamp: April 10, 2019, 11:54:52 am
content: I agree. Whilst you're at it, I'd also make it into a 4 layer board, because there's really no reason not to, and time spent debugging problems that are down to poor power and grounding is simply wasted.1 - components2 - GND3 - power4 - tracking, and more components if need be

author: Siwastaja
author_rank: Super Contributor
timestamp: April 10, 2019, 12:06:40 pm
content: Or, possibly just 45 degrees clockwise, hard to say which is better (45 deg or 90 deg). Try and see.I wouldn't make it 4-layer on such a super simple board unless I have unlimited budget. It may be only a few dollars in mid-sized batches, but for small quantity prototypes, the two extra layers would become the biggest expense of the project. Of course, if this doesn't matter, 4-layer will be easier to lay out and perform better EMI wise. It's very hard to see that you'd need to debug power and grounding on such a small and simple board on 2 layers.Instead, add a few GND stitching vias, they are free. You have enough empty space (read: wide copper pours) and enough pin headers with ground connections (natural ground stitching) there so you could do without, probably, but adding a few would be a good habit. You could try adding a few and then we'll give you feedback about how you did.QuoteAnd, most of the tracks would naturally go to 1 to minimize vias on signals.

author: tsman
author_rank: Frequent Contributor
timestamp: April 10, 2019, 12:16:19 pm
content: Pinout of J3 makes no sense. You need to put BOOT0 and BOOT1 in the middle, 3.3V on the top two pins and ground on the bottom two pins. Your current layout makes it hard to use a 2 pin shunt jumper.

author: mariush
author_rank: Super Contributor
timestamp: April 10, 2019, 04:40:01 pm
content: Rotate the chip by 90 degrees.Make thicker traces to the IO pins... seem unnecessarily thin.Any particular reason the DC In connector (or whatever) has to be all the way on the opposite side of the board?Consider using a better switching regulator (synchronous rectifier so you lose the diode, higher switching frequency so you get smaller inductors)Plenty of cheap 500kHz or higher switching regulators.Seems like there's enough room on the board that you could have all the components on one side... and maybe make it cheaper to do reflow soldering on the boards instead of messing around with soldering each side or using glue on the parts...

author: ajb
author_rank: Super Contributor
timestamp: April 10, 2019, 04:58:35 pm
content: You've left NRST unconnected, that should get a pullup resistor and should be made accessible so that you can hook up an SWD debugger. Ideally you would also have an SWD header (either the standard 10-pin 50mil header or just extra pins).

author: SiliconWizard
author_rank: Super Contributor
timestamp: April 10, 2019, 07:06:15 pm
content: There is an internal pull-up in most STM32 devices on the NRST pin and I personally never added an external one. Look at section 5.3.14 of the datasheet. What's recommended though is to add a capacitor to ground (like 100nF) to avoid spurious resets in case of parasitics. If your intent is to add a lower resistance external pull-up for the same reason (the typ. internal pull-up is ~40k), I think the capacitor should be enough to do the trick. Just know there *is* an internal pull-up.As to making it accessible for SWD, I'd recommend it but it's not 100% mandatory. You can absolutely connect via SWD without it, but not in all cases. One case you can't is if the MCU is in stop mode. So yes, if you ever intend to use low-power modes, you have to make NRST accessible to your SWD probe. If it's a development board, just do that, or your users may get angry.

author: AndyC_772
author_rank: Super Contributor
timestamp: April 10, 2019, 08:15:04 pm
content: Quote from: Siwastaja on April 10, 2019, 12:06:40 pmI find the danger with trying to fit everything on 2 layers is that, even if one layer can be a reasonably solid ground plane, the other is inevitably chopped up into bits, which negates the benefit of having it. Sometimes different parts end up completely disconnected, which is OK because the PCB software should at least warn you. Often, though, different areas end up connected through a long, thin, convoluted path which won't flag an error, but it isn't obvious just how bad the plane is unless you trace it out by hand.Unless there's a strongly compelling reason, I never use 2 layer boards these days. A 4 layer board from somewhere like AllPCB is inexpensive, and it's a good habit to get into from day one. Don't waste any part of your life debugging avoidable signal integrity problems, there's really nothing good about them, not even the learning experience.

author: langwadt
author_rank: Super Contributor
timestamp: April 10, 2019, 09:04:25 pm
content: Quote from: capt bullshot on April 10, 2019, 10:40:11 amand might want to add the option of a termination resistor too

author: Siwastaja
author_rank: Super Contributor
timestamp: April 11, 2019, 10:58:14 am
content: Quote from: AndyC_772 on April 10, 2019, 08:15:04 pmGenerally I agree 100%, and recommend what you do as well. But this is such a physically small board, with such small number of nets and power rails, that it's fairly easy to have a full, proper ground plane in a 2-layer design (or nearly so - if you need a cut or two, you still have plenty of space to stitch it to the corresponding top layer, and the number of plane jumps will be limited).Secondly: even if a beginner fails this process somewhere, by forgetting some important stitching vias, the resulting return path is still only a centimeter or two, maybe max three cm, which should be far from causing any risk of serious SI issues in a board with such medium edge rate devices, hence no frustration in debugging.

author: kars
author_rank: Contributor
timestamp: April 16, 2019, 10:53:49 am
content: based on your feedback i made some modifications like add more bypass capacitors, fix pinouts, rotate the chip and shorten the ground tracks as much as possible