0
\$\begingroup\$

I'm in the process of designing and ordering my first PCB with MCU. In the past I did make PCBs that were driven by a Arduino Pro Micro chip, but I wanted some more professional.

Below I added the pictures of my schematic from which I already made a PCB and Gerber file. But before I order this PCB I wanted a double check to see if I missed something or made a mistake.

In the schematic I used the multiplexing technology for the push buttons and rotary encoders. I used this before on the Arduino driven PCBs. Would this work correctly on this as well? I did not use a pull-down resistor, is this a big issue?

I want to program the PCB by USB. The USB connection will come through the JST-XH-4 connection on the right of the MCU picture. I used the following main components:

  • STM32G103CBT6
  • AMS1117-3.3V
  • Oscillator

enter image description here

The MCU, with on the right JST-XH-4 for USB connection and a switch to pull boot0 low.

enter image description here

The power supply, voltage regulator, and crystal oscillator.

enter image description here

The multiplexing with 12 push buttons, 4 rotary encoders and 2 JST-XH-2 for my shifter input.

EDIT 1:

I have added diodes to my schematic. Did I do this correctly?

enter image description here

EDIT 2:

After the helpful input from @Justme I did some more research and came across the USBLC6 solution. This chip prevents the need of the USB pull-up line. I have changed the capacitors on the regulator schematic from 22 μF to 10 μF, but the datasheet stated it should be 22 μF; is this correct? I also added the SWD 10-pin header so I can program my PCB with an ST-LINK device.

enter image description here

enter image description here

\$\endgroup\$
9
  • \$\begingroup\$ You will need diodes in your switch matrix. Please have a look on common pcb keyboard schematics. \$\endgroup\$ Commented Jan 23, 2023 at 18:54
  • \$\begingroup\$ Is the following diode good for this? link \$\endgroup\$
    – Djowwie
    Commented Jan 23, 2023 at 19:49
  • \$\begingroup\$ Looks good to me! \$\endgroup\$ Commented Jan 23, 2023 at 20:17
  • \$\begingroup\$ I have edited my post with the diodes added to my schematic \$\endgroup\$
    – Djowwie
    Commented Jan 23, 2023 at 20:25
  • 1
    \$\begingroup\$ Having a 3-pin switch for the boot pin is not ideal, in the process of switching from 0 to V it will be momentarily disconnected from anything and catch any interference. Better use a pullup and a simple pushbutton to GND. \$\endgroup\$
    – floppydisk
    Commented Jan 23, 2023 at 20:39

2 Answers 2

0
\$\begingroup\$

In addition to the missing VDDA connection that makes it not work, there are more subtle problems too. This is basically yet another clone of Bluepill board.

For software developement, you are expecting to upload working code and then you have no means of debugging what's wrong when it when it does not work. There is no SWD, JTAG, SWO, and not even a debug UART port for debugging.

Which also means that without any debug or bootloader interface, the MCU is an unprogrammable brick. The STM32F103 factory bootloader does not support USB, so it can't be programmed via USB, unless it has been programmed from a supported interface with a custom bootloader that supports programming over USB.

This board also replicates some of the problems of the Bluepill board. The USB data line pull-up is permanently connected. If it takes a long time before the MCU is ready for USB communications, the PC might give up trying to communicate with a device that says it's ready while it isn't.

For software developement purposes, you will appreciate if you have a reset button.

If this is supposed to be a standard USB powered device, then this violates USB specs. You can't have 22 uF capacitors, as USB standard requires that the device has maximum of 10 uF capacitance or equivalent of it when plugging in the connector.

The 16 MHz crystal is also the highest frequency supportes by the chip. It might be OK, but is a weird selection without further info why it is 16 MHz. A more typical value would be 8 MHz, as they are easier to get working, and that's the nominal input for the PLL. Your schematics are also missing crystal specifications, so it cannot be verified if that crystal will work well with the MCU and if the 10 pF loading caps you have selected are correct - but they might be as the higher the crystal frequency is, it works better if it is specified for low capacitance loads.

\$\endgroup\$
3
  • \$\begingroup\$ thank you for you answer and reviewing my work. It is my first time making a custom pcb, so it is far from flawless. I followed this tutorial. That is the reason i went with the 22uf capacitor and the 16mhz crystal. He said those were good to use. But i'm still learning and being naive. So i need at least a swd and a st-link programmer to make this board work? And what would you advice me to do with the usb data line pull up? Or can you link me to a correct way to learn online? \$\endgroup\$
    – Djowwie
    Commented Jan 24, 2023 at 8:43
  • \$\begingroup\$ The data line should be pulled up when ready. There are many ways to achieve it, look for examples. And a crystal has many other parameters than frequency, so not all 16 MHz crystals are good even if some are. Unfortunately, anyone can make electronics tutorial videos or web pages. Some source criticism should be used, you should not expect that a tutorial is correct without double-checking the facts. Sometimes there are just different opinons how to do things so there is no one correct way as it depends on many factors including personal preference and experience (or lack of). \$\endgroup\$
    – Justme
    Commented Jan 24, 2023 at 9:00
  • \$\begingroup\$ I have done some more research and added some stuff like the swd header, a extra chip between the usb input and the mcu and changed the capacitors. Am i going in the right direction with those changes? \$\endgroup\$
    – Djowwie
    Commented Jan 24, 2023 at 19:50
1
\$\begingroup\$
  1. Connect the other side of the ferrite bead to 3.3 V.

VDDA circuit

  1. The schematic symbol should make the schematic readable and does not have to represent how the part footprint looks like:

Schematic symbol

Rather put both outputs on the right hand side.

  1. IMO ground symbols should not be rotated. I'd use a supply symbol for 3.3 V for clarity.
\$\endgroup\$
2
  • \$\begingroup\$ Thank you for your answer. I totally missed the ferrite bead connection, thanks! I have changed my total layout to be more clear and better to read. I will edit my post later of my total design. \$\endgroup\$
    – Djowwie
    Commented Jan 23, 2023 at 21:05
  • \$\begingroup\$ No problem. I'd usually also keep decoupling caps and the oscillator next to the MCU symbol and actually wire them. Having too many references makes the schematic difficult to follow. \$\endgroup\$
    – Ralph
    Commented Jan 23, 2023 at 21:17

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.