1
\$\begingroup\$

I am going to use STM32F407VG in my PCB design. I have never done it so that I don't know how to do it.

It's my first time using STM32 so I don't know how to design external capacitor and crystal. I went through STM32's datasheet but I could not find exact values of capacitors and where to put them.

How can I do it? enter image description here

This is design which I have done. Is it correct?

Can you tell me what is missing now?enter image description here

\$\endgroup\$
6
  • \$\begingroup\$ This question is too long to be answered here, but there are a lot of guides and tutorials, especially for the new people like yourself. Try it in google. Youtube also has a lot of...eh..."letsdesigns", videos where someone does just that, and some of them even expain why. Check out greatscott or eevblog, but there are many-many more \$\endgroup\$
    – Ilya
    Commented Sep 6, 2021 at 8:39
  • \$\begingroup\$ Also, don't try to make things PERFECT. It will get you nowhere. It has to be GOOD ENOUGH. \$\endgroup\$
    – Ilya
    Commented Sep 6, 2021 at 8:40
  • \$\begingroup\$ Which capacitor values to use depends on what values the crystal needs and what kind of capacitor values are acceptable for the MCU so this determines which crystals are suitable for the MCU. For STM32 MCUs there is an application note how to choose a crystal and capacitors that work with the MCU. And actually that is not even much about PCB design, although the PCB layout slightly affects stray wiring capacitance in capacitor calculations. \$\endgroup\$
    – Justme
    Commented Sep 6, 2021 at 8:53
  • \$\begingroup\$ Indeed, capacitor values come from crystal datasheet. I only wanted to point out that they shouldn't be picked on a whim, and since those values are not common, they're worth re-cheking (well, worth re-check in any case, really) \$\endgroup\$
    – Ilya
    Commented Sep 6, 2021 at 9:06
  • 1
    \$\begingroup\$ Checkout the Getting started with STM32F4xxxx MCU hardware development. \$\endgroup\$
    – Codo
    Commented Sep 6, 2021 at 9:19

3 Answers 3

3
\$\begingroup\$

No, your design will not work at all, it won't even start. You can't power anything through voltage divider (unless specifically stated in the datasheet, but it's close to never; I remember only one chip that powered its part through voltage divider, that's it; otherwise, NEVER). Voltage divider only works if the consumed current is orders of magnitude smaller than what's going through the divider. Voltage dividers are used to set voltage for measurement or reference level, NOT to power things.

You need 5 -> 3.3 V converter. Go for linear regulator, extremely easy to implement. Some have fixed 3.3 V output voltage so you need only one IC and a capacitor on the input and a capacitor on the output. One such regulator is LM1117. 5 V in, 3.3 V out.

Crystal circuit looks OK, but I usually saw 18-22 pF capacitors there. Probably will work OK tho. Decoupling capacitors look OK.

Another thing: Vdd is power (and have a decoupling capacitor next to each of them). Vss is GROUND.

I suggest you download the datasheet for your MCU. Yes, you won't understand very much. I've been there literally a few months ago. Glance through it, it has info about powering it and stuff. As the time goes, you will understand more and more of it. If you don't understand something, you can google it, but more often it probably won't even matter at all. If you don't do complex stuff superweirdly, things should work fine. It looks scary, but it only seems that way.

\$\endgroup\$
1
  • \$\begingroup\$ Personal recommendation: yt channels Simply put, All about electronis, greatscott, eevblog, there are many more. They were my starting point in figuring the stuff out. Once you understand how basic pcb components and common circuits work, you will feel much better \$\endgroup\$
    – Ilya
    Commented Sep 6, 2021 at 9:01
3
\$\begingroup\$

I am going to use STM32F407VG in my PCB design. I have never done it so that i don't know how to do it.

ST provides all the design files for the STM32-Nucleo demo boards on their website, so you can do what everyone else does, which is download them and use that as a starting point. This is a good way to make sure everything works, especially about how to correctly connect the programming interface pins and serial port. They use Altium which is of course not free, but Altium offers a free viewer, so you can look at all the PCB files too.

If you use a 5V power supply, you need a 3V3 regulator. A resistive voltage divider will not work because its output impedance is way too high.

If you put a resistive divider and you think it will work, then I assume you have no experience, so I'm kinda worried you will be able to solder a 100 pin package.

BTW, check if the micro is in stock and make sure you have it before starting the design. There are shortages.

For personal projects, I always find selecting the caps on these crystals to be a headache. Since a canned 8MHz crystal oscillator costs $1, there is a time/convenience tradeoff here. The crystal uses less power though.

You will need a 3V3 regulator that works, with appropriate output caps. I recommend LDL1117 3V3 from ST and 10µF X7R MLCC 16V 0805 output cap, 1µF MLCC input cap. Put a copper pour on the tab to dissipate the heat, like 2 cm2.

Many other chips will work, but again, no reason to waste 30 minutes selecting a 50 cents part for a personal project where you only need a quantity of one. Only reason to do so would be if layout is tight and you need a LDO with the tab connected to GND so you can use the ground plane as heat sink instead. In this case make sure the datasheet says "stable with ceramic output capacitors" on the front page, and make sure it doesn't need some special snowflake tantalum caps.

Do not use AMS1117 or you will be back asking why your micro crashes when it comes out of sleep.

I see a 4.7µF cap on your schematic, if it is electrolytic it will be useless because at this value ESR is huge ; if it is tantalum it will be expensive, just put a 10µF MLCC instead, that's 10 cents well spent.

Schematic advice: use the "ground" symbol for ground. Use a power symbol for power. There will be enough wires everywhere when you connect all the pins, no need to add more for power. Also you forgot to connect AVDD and AVSS. Note AVDD may need a RLC filter for lower noise, check datasheet.

If this is a personal project, then I'm gonna give maybe a bit controversial advice: use the $25 special offer from JLCPCB and make it 4 layer. You will save many hours of annoying routing tons of signals, so it's well spent. Put a solid ground plane on layer 2, a small 3V3 copper pour on layer 4 below the chip, and put the decoupling caps on the other side just below the power pins, with one power and ground via each. Then pour some GND copper on layer 4 around the caps. If you hand solder you won't pay extra for putting components on the back side. This frees up some space on top so you can route all the signal pins without headaches. And using a solid ground plane and power pour means it has lots more chances of working if you know absolutely nothing about EMI and signal integrity.

\$\endgroup\$
0
\$\begingroup\$

32 pF load using 2 caps effectively in series means 64pF each -||--gnd--||- including input capacitance and ground plane capacitance (not needed).

But if you wanted to trim the 50 ppm error frequency to < 5ppm , more attention to best C values and a method to calibrate and trim is needed and choice of temperature curves must be made or temp tolerance values and range.

Other others include cheap but rugged MEMS oscillators 2%

New Crystals, more common are lower capacitance like 14 pF , which with no ground plane except a guard ring around caps next to both pins might be 28pF on Xout and 22 pf on Xin which also has some pF (lookup)

https://www.digikey.ca/en/products/detail/abracon-llc/ABLS-8-000MHZ-B4-T/2184155

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.