This article is part of the Arm Innovator Program, a series created to highlight the work of key technical leaders who are pushing the boundaries of how Arm architecture can enable next-generation solutions
Next in the Arm Innovator series is John Teel. John is an electronics design engineer and founder of Predictable Designs website, which helps develop and launch new electronic hardware products.
There are many user-friendly development boards and kits available to enable new makers and hardware start-ups to learn about microcontrollers, and to bring your ideas to life as a prototype.
To move beyond the prototype stage and develop your idea for production, you need to migrate your design from the development board to a custom PCB. This allows you to optimize your design for power, space and industrial design.
I would recommend starting with the 32-bit Arm Cortex-M series based microcontroller because it provides higher performance for the price. It is backed by one of the largest technology ecosystem of services, tools and software, so you can benefit from choice, flexibility and reusability of software as the product line scales.
Arm does not manufacture microcontroller chips directly. Instead, they design processor architectures and CPUs that are then licensed and manufactured by chipmakers such as STMicroelectronics, Texas Instruments, Microchip, Silicon Labs, NXP, Cypress and more. Nordic Semiconductor also offers many popular Cortex-M processors with built-in Bluetooth Low-Energy (BLE) radios, including the first Cortex-M33 based chip with Arm TrustZone technology.
Additional benefits of Cortex-M processors include:
As already stated, there are numerous chipmakers that offer Cortex-M based microcontrollers. One of the many great options is the STM32 series from ST Microelectronics.
The STM32 series is large and offers just about any microcontroller you can imagine. The STM32 line can be split into various sub-groups.
The STM32F subseries is their standard line of microcontrollers. The STM32 F0 has the lowest price but also the lowest speed. Then it progresses up to the F1 subseries, then eventually to the F7, and finally the H7. One exception to note is that the F2 series is faster than the F3 (see details in table 1).
The STM32 series also includes the ultra-low power STM32L line optimized for mobile applications with minimum battery capacity.
Table 1: Comparison of various STM32 microcontroller variants
Cortex-M microcontrollers offer all of the standard peripherals such as I2C for connecting to other chips and sensors, SPI for high-speed serial communication, USB for connecting to external devices, I2S for connecting digital audio chips and microphones, and PWM for motor control.
Some of the more advanced features available include a Floating Point Unit (FPU), graphics acceleration, and Digital Signal Processing (DSP).
ST’s ultra-performance STM32 H7 microcontrollers blur the line between a microcontroller and a microprocessor. By implementing an L1 cache, the STM32 H7 microcontrollers deliver the theoretical maximum performance for the Cortex-M7 overview core.
I highly recommend finalizing your microcontroller selection via electronic components distributors. Using a distributor’s website helps limit your choices to only those microcontrollers that are currently available. You will also quickly see the pricing, which is typically an important criteria in component selection.
Now that we’ve reviewed the various microcontrollers available in the STM32 Cortex-M series, let’s focus on building a custom board based on one of these cores.
Figure 1: Schematic diagram example for STM32F4 microcontroller (image courtesy of Predictable Designs)
The STM32F4 can be run from an internal or external system clock. The system clock used on powerup is the internal clock (16 MHz). After system initialization another external clock source can be selected in the software. An independent clock source up to 50 MHz can also be used.
You should adhere to the layout guidelines in the datasheet when laying out the crystal. In general, the traces should be short and the crystal load capacitors should match the crystal manufacturer’s recommendations.
The General Purpose Input/Output (GPIO) pins on the microcontroller are programmable. They can be configured by software as an input or an output. Various on-chip peripherals access the external world through these multi-function pins. This includes serial interfaces such as UART, SPI, and I2C, as well as inputs to the embedded analog-to-digital converter.
Not all internal functions are available to every GPIO pin. Only specific mapping is allowed, so consult the microcontroller datasheet when choosing what specific pins to use.
The GPIO pins can be used to drive various loads and most pins can sink or source up to 25mA. However, it is generally a good idea to provide some type of external drive circuit to off load the drive requirements.
The STM32 specifies a maximum allowable current for each individual pin, as well as the total current limit for all GPIO pins summed together.
The STM32F4 offers two In-System Programming (ISP) interfaces: Serial-Wire-Debug (SWD) and JTAG.
Lower cost versions of the STM32 only offer the SWD interface. SWD and JTAG are the two most common programming interfaces used for microcontrollers.
Powering your circuit is one of the most important aspects of the hardware design and you should not wait too late in the design process to determine the power and grounding scheme.
The current used by the microcontroller is determined by several factors such as the operating voltage, the clock frequency and the I/O pin loads.
Each power supply VDD pin on the MCU should have 1uF and 100nF ceramic capacitors (for example, see C7 and C8 in Figure 1) placed as close as possible to provide power supply decoupling.
An additional 4.7uF ceramic capacitor (C1 in Figure 1) should be placed near the IC on the main circuit trace supplying VDD.
Microcontrollers with an Analog-to-Digital Converter (ADC) also usually have separate power (VDDA) and ground pins (VSSA) just for analog. These pins must be especially clean of any noise.
In most cases, it’s a good idea to also include an inductor (L2 in Figure 1) on the VDDA pin to form a LC low-pass filter. This gives an even cleaner analog supply voltage.
The VDDA pin should have 1uF and 10nF ceramic capacitors (C10 and C11 in Figure 1) placed as close to the VDDA pin as possible. In most cases, it’s a good idea to also include an inductor (L2 in Figure 1) on the VDDA pin to form a LC low-pass filter. This gives an even cleaner analog supply voltage.
If your supply voltage is above the maximum input voltage for the microcontroller, then a low-dropout linear voltage regulator is usually required.
If your supply voltage is significantly higher than the required microcontroller voltage then a buck switching regulator is a better choice. Linear regulators waste too much power when their input voltage is significantly higher than their regulated output voltage.
However, it’s usually best to still sub-regulate the switching regulator’s output voltage with a linear regulator. This is because a linear regulator produces a much cleaner, lower noise supply voltage.
Figure 2: A conceptual schematic diagram must be turned into a real-world PCB layout (image provided courtesy of Predictable Designs)
Now it’s time to turn the conceptual schematic diagram into a real-world PCB. For this step we’ll be using the same software we used to create the schematic.
This software will then later be used to automatically confirm that the PCB layout correctly matches the schematic. It will also check that the layout properly follows all of the design rules for the specific PCB process you’ll be using.
A microcontroller circuit with a clock speed of only 16 MHz, without wireless functionality, is a fairly simple PCB layout to design (assuming you know how to do PCB layout). Things become much more complicated once speeds approach hundreds of MHz, or especially GHz.
Be very cautious about two things when laying out a microcontroller circuit. First, the crystal and it’s two load capacitors need to be laid out correctly and placed as close as possible to the microcontroller pins.
Secondly, carefully lay out any decoupling capacitors so they are as close as possible to the pin that is being decoupled. Be sure to always review the microcontroller datasheet for PCB layout guidelines.
Some general PCB layout tips include:
Once the PCB layout is completed it’s now time to order the boards. However, before ordering any PCB prototypes you should really get an independent design review of the schematic and PCB layout.
Regardless of the designer’s experience level, an independent design review reduces the likelihood that mistakes will make their way into your prototype.
Once you are finally ready to order boards, you will need to generate Gerber files for the PCB layout. There are countless PCB design software packages and each has its own proprietary file format. Gerber files, on the other hand, are an industry standard supported by all PCB design tools. Gerber files will be used to prototype your boards as well as for production.
In some cases, you may have two different vendors make your boards. One vendor will produce the blank PCBs, and then another supplier will solder the components onto the board.
In other cases, a single vendor will perform both steps. For example, Seeed Studio’s Fusion service can supply you with completely assembled boards at an incredibly affordable cost.
For your first prototype version I suggest ordering only 3-10 boards. This is because the first version will likely have various bugs that will need to be fixed. In most cases it’s a waste of money to order a large quantity on the first version.
Once you’ve tested and debugged the first version, then increase the quantity for the second order depending on your confidence level.
In this article we’ve discussed how to transition your design from a prototype development board to a custom-designed PCB that is based on a high-performance 32-bit Cortex-M microcontroller. In this example, we’ve looked at the STM32 line of microcontrollers from ST Microelectronics as a great option, but there are also many other Arm-based options available.
For more information about Cortex-M processors, sign up to receive the Arm in Embedded monthly news or join our Embedded Community for free access the discussion forum and many more resources.
Learn more about John Teel and the Arm Innovator Program by clicking on the link below.
Learn about the Arm Innovator Program