PCB Layout Design

[中文]

This chapter introduces the key points of how to design an ESP32-S2 PCB layout using an ESP32-S2 module (see Figure ESP32-S2 Reference PCB Layout) as an example.

ESP32-S2 Reference PCB Layout

ESP32-S2 Reference PCB Layout

General Principles of PCB Layout

It is recommended to use a four-layer PCB design:

  • Layer 1 (TOP): Signal traces and components.

  • Layer 2 (GND): No signal traces here to ensure a complete GND plane.

  • Layer 3 (POWER): GND plane should be applied to better isolate the RF and crystal. Route power traces and a few signal traces on this layer, provided that there is a complete GND plane under the RF and crystal.

  • Layer 4 (BOTTOM): Route a few signal traces here. It is not recommended to place any components on this layer.

A two-layer PCB design can also be used:

  • Layer 1 (TOP): Signal traces and components.

  • Layer 2 (BOTTOM): Do not place any components on this layer and keep traces to a minimum. Please make sure there is a complete GND plane for the chip, RF, and crystal.

Positioning a Module on a Base Board

If module-on-board design is adopted, attention should be paid while positioning the module on the base board. The interference of the baseboard on the module’s antenna performance should be minimized.

It is suggested to place the module’s on-board PCB antenna outside the base board, and the feed point of the antenna closest to the board. In the following example figures, positions with mark ✓ are strongly recommended, while positions without a mark are not recommended.

Placement of ESP32-S2 Modules on Base Board (antenna feed point on the right)

Placement of ESP32-S2 Modules on Base Board (antenna feed point on the right)

If the PCB antenna cannot be placed outside the board, please ensure a clearance of at least 15 mm around the antenna area (no copper, routing, or components on it), and place the feed point of the antenna closest to the board. If there is a base board under the antenna area, it is recommended to cut it off to minimize its impact on the antenna. Figure Keepout Zone for ESP32-S2 Module’s Antenna on the Base Board shows the suggested clearance for modules whose antenna feed point is on the right.

Keepout Zone for ESP32-S2 Module’s Antenna on the Base Board

Keepout Zone for ESP32-S2 Module’s Antenna on the Base Board

When designing an end product, attention should be paid to the interference caused by the housing of the antenna and it is recommended to carry out RF verification. It is necessary to test the throughput and communication signal range of the whole product to ensure the product’s actual RF performance.

Power Supply

Figure ESP32-S2 Power Traces in a Four-layer PCB Design shows the overview of the power traces in a four-layer PCB design.

ESP32-S2 Power Traces in a Four-layer PCB Design

ESP32-S2 Power Traces in a Four-layer PCB Design

General Guidelines

  • Four-layer PCB design is preferred.

  • The power traces should be routed on the inner third layer whenever possible.

  • Vias are required for the power traces to go through the layers and get connected to the pins on the top layer. There should be at least two vias if the main power traces need to cross layers. The drill diameter on other power traces should be no smaller than the width of the power traces.

  • The ground pad at the bottom of the chip should be connected to the ground plane through at least nine ground vias.

  • If you need to add a thermal pad EPAD under the chip on the bottom of the module, it is recommended to employ a square grid on the EPAD, cover the gaps with solder paste, and place ground vias in the gaps, as shown in Figure ESP32-S2 Power Traces in a Four-layer PCB Design. This can avoid chip displacement caused by tin leakage and bubbles when soldering the module EPAD to the substrate.

3.3 V Power Layout

The 3.3 V power traces, highlighted in yellow, are routed as shown in Figure ESP32-S2 Power Traces in a Four-layer PCB Design.

The 3.3 V power layout should meet the following guidelines:

  • The ESD protection diode is placed next to the power port (circled in red in Figure ESP32-S2 Power Traces in a Four-layer PCB Design). The power trace should have a 10 µF capacitor on its way before entering into the chip, and a 0.1 µF capacitor could also be used in conjunction. After that, the power traces are divided into several branches using a star-shaped topology, which reduces the coupling between different power pins. Note that all decoupling capacitors should be placed close to the corresponding power pin, and ground vias should be added close to the capacitor’s ground pad to ensure a short return path.

  • The width of the main power traces should be no less than 25 mil. The width of VDD3P3 at pin3 and pin4 power traces should be no less than 20 mil. The recommended width of other power traces is 10 mil.

Analog Power Layout

The analog power layout should meet the following guidelines:

  • VDD3P3 at pin3 and pin4 analog power supply should be surrounded by ground copper. It is required to add GND isolation between VDD3P3 at pin3 and pin4, power trace and the surrounding GPIO and RF traces, and place vias whenever possible.

Crystal

Figure ESP32-S2 Crystal Layout (without Keep-out Area on Top Layer) shows the layout for the crystal that is connected to the ground through vias but there is no keep-out area on the top layer for ground isolation.

ESP32-S2 Crystal Layout (without Keep-out Area on Top Layer)

ESP32-S2 Crystal Layout (without Keep-out Area on Top Layer)

The layout of the crystal should follow the guidelines below:

  • Ensure a complete GND plane for the RF, crystal, and chip.

  • The crystal should be placed far from the clock pin to avoid interference on the chip. The gap should be at least 2.0 mm. It is good practice to add high-density ground vias stitching around the clock trace for better isolation.

  • There should be no vias for the clock input and output traces, which means the traces cannot cross layers. The clock traces should not intersect with each other.

  • Components in series to the crystal trace should be placed close to the chip side.

  • The external matching capacitors should be placed on the two sides of the crystal, preferably at the end of the clock trace, but not connected directly to the series components. This is to make sure the ground pad of the capacitor is close to that of the crystal.

  • Do not route high-frequency digital signal traces under the crystal. It is best not to route any signal trace under the crystal. The vias on the power traces on both sides of the crystal clock trace should be placed as far away from the clock trace as possible, and the two sides of the clock trace should be surrounded by grounding copper.

  • As the crystal is a sensitive component, do not place any magnetic components nearby that may cause interference, for example large inductance component, and ensure that there is a clean large-area ground plane around the crystal.

RF

The RF trace is routed as shown highlighted in pink in Figure ESP32-S2 RF Layout in a Four-layer PCB Design.

ESP32-S2 RF Layout in a Four-layer PCB Design

ESP32-S2 RF Layout in a Four-layer PCB Design

The RF layout should meet the following guidelines:

  • A π-type matching circuit should be added to the RF trace and placed close to the chip, in a zigzag.

  • The RF trace should have a 50 Ω characteristic impedance. The reference plane is the second layer. For designing the RF trace at 50 Ω impedance, you could refer to the PCB stack-up design shown below.

ESP32-S2 PCB Stack up Design

ESP32-S2 PCB Stack-up Design

  • The RF trace should have a consistent width and not branch out. It should be as short as possible with dense ground vias around for interference shielding.

  • The RF trace should be routed on the outer layer without vias, i.e., should not cross layers. The RF trace should be routed at a 135° angle, or with circular arcs if trace bends are required.

  • The ground plane on the adjacent layer needs to be complete. Do not route any traces under the RF trace whenever possible.

  • There should be no high-frequency signal traces routed close to the RF trace. The RF antenna should be placed away from high-frequency components, such as crystals, DDR SDRAM, high-frequency clocks, etc. In addition, the USB port, USB-to-serial chip, UART signal lines (including traces, vias, test points, header pins, etc.) must be as far away from the antenna as possible. The UART signal line should be surrounded by ground copper and ground vias.

Flash and PSRAM

The layout for flash and PSRAM should follow the guidelines below:

  • Place the zero-ohm series resistors on the SPI lines close to the chip.

  • Route the SPI traces on the inner layer (e.g., the third layer) whenever possible, and add ground copper and ground vias around the clock and data traces of SPI separately.

  • Place the 0.1 μF capacitor to ground at the VDD_SPI close to corresponding flash and PSRAM power pins.

Figure ESP32-S2 Flash and PSRAM Layout shows an example of flash and PSRAM layout.

ESP32-S2 Flash and PSRAM Layout

ESP32-S2 Flash and PSRAM Layout

UART

The UART layout should meet the following guidelines:

  • The series resistor on the U0TXD trace needs to be placed close to the chip side and away from the crystal.

  • The U0TXD and U0RXD traces on the top layer should be as short as possible.

  • The UART trace should be surrounded by ground copper and ground vias stitching.

USB

The USB layout should meet the following guidelines:

  • Place the RC circuit on the USB traces close to the chip side.

  • Use differential pairs and route them in parallel at equal lengths.

  • Make sure there is a complete reference ground plane and surround the USB traces with ground copper.

Touch Sensor

ESP32-S2 offers up to 14 capacitive IOs that detect changes in capacitance on touch sensors due to finger contact or proximity. The chip’s internal capacitance detection circuit features low noise and high sensitivity. It allows to use touch pads with smaller area to implement the touch detection function. You can also use the touch panel array to detect a larger area or more test points.

Figure ESP32-S2 Typical Touch Sensor Application depicts a typical touch sensor application.

ESP32-S2 Typical Touch Sensor Application

ESP32-S2 Typical Touch Sensor Application

To prevent capacitive coupling and other electrical interference to the sensitivity of the touch sensor system, the following factors should be taken into account.

Electrode Pattern

The proper size and shape of an electrode improves system sensitivity. Round, oval, or shapes similar to a human fingertip are commonly applied. Large size or irregular shape might lead to incorrect responses from nearby electrodes.

Figure ESP32-S2 Electrode Pattern Requirements shows the proper and improper size or shape of electrode. Please note that the examples illustrated in the figure are not of actual scale. It is suggested to use a human fingertip as reference.

ESP32-S2 Electrode Pattern Requirements

ESP32-S2 Electrode Pattern Requirements

PCB Layout

Figure ESP32-S2 Sensor Track Routing Requirements illustrates the general guidelines to routing traces. Specifically,

  • The trace should be as short as possible and no longer than 300 mm.

  • The trace width (W) can not be larger than 0.18 mm (7 mil).

  • The alignment angle (R) should not be less than 90°.

  • The trace-to-ground gap (S) should be in the range of 0.5 mm to 1 mm.

  • The electrode diameter (D) should be in the range of 8 mm to 15 mm.

  • Hatched ground should be added around the electrodes and traces.

  • The traces should be isolated well and routed away from that of the antenna.

ESP32-S2 Sensor Track Routing Requirements

ESP32-S2 Sensor Track Routing Requirements

Note

For more details on the hardware design of the touch sensor, please refer to Touch Sensor Application Note.

Typical Layout Problems and Solutions

1. The voltage ripple is not large, but the TX performance of RF is rather poor.

Analysis: The voltage ripple has a strong impact on the RF TX performance. It should be noted that the ripple must be tested when ESP32-S2 is in the normal working mode. The ripple increases when the power gets high in a different mode.

Generally, the peak-to-peak value of the ripple should be <80 mV when ESP32-S2 sends MCS7@11n packets, and <120 mV when ESP32-S2 sends 11 MHz@11b packets.

Solution: Add a 10 μF filter capacitor to the branch of the power trace (the branch powering the chip’s analog power pin). The 10 μF capacitor should be as close to the analog power pin as possible for small and stable voltage ripples.

2. When ESP32-S2 sends data packages, the voltage ripple is small, but RF TX performance is poor.

Analysis: The RF TX performance can be affected not only by voltage ripples, but also by the crystal itself. Poor quality and big frequency offsets of the crystal decrease the RF TX performance. The crystal clock may be corrupted by other interfering signals, such as high-speed output or input signals. In addition, high-frequency signal traces, such as the SDIO traces and UART traces under the crystal, could also result in the malfunction of the crystal. Besides, sensitive components or radiating components, such as inductors and antennas, may also decrease the RF performance.

Solution: This problem is caused by improper layout for the crystal and can be solved by re-layout. Please refer to Section Crystal for details.

3. When ESP32-S2 sends data packages, the power value is much higher or lower than the target power value, and the EVM is relatively poor.

Analysis: The disparity between the tested value and the target value may be due to signal reflection caused by the impedance mismatch on the transmission line connecting the RF pin and the antenna. Besides, the impedance mismatch will affect the working state of the internal PA, making the PA prematurely access the saturated region in an abnormal way. The EVM becomes poor as the signal distortion happens.

Solution: Match the antenna’s impedance with the π-type circuit on the RF trace, so that the impedance of the antenna as seen from the RF pin matches closely with that of the chip. This reduces reflections to the minimum.

4. TX performance is not bad, but the RX sensitivity is low.

Analysis: Good TX performance indicates proper RF impedance matching. Poor RX sensitivity may result from external coupling to the antenna. For instance, the crystal signal harmonics could couple to the antenna. If the TX and RX traces of UART cross over with RF trace, they will affect the RX performance, as well. If there are many high-frequency interference sources on the board, signal integrity should be considered.

Solution: Keep the antenna away from crystals. Do not route high-frequency signal traces close to the RF trace. Please refer to Section RF for details.