AN6274 · Application noteGetting started with STM32C5 MCU hardware development
Download .pdfOpen in the full document

Serial wire debug (SWD) pin assignment

SWD pin assignment

After reset, the pins used for the SWD are assigned as dedicated pins that can be immediately used by the debugger host. However, the MCU offers the possibility to disable the SWD, therefore releasing the associated pins for GPIO use.

For more details on how to disable SWD port, refer to the section 'I/O pin alternate function multiplexer and mapping section of the reference manual.

Internal pull-up and pull-down on SWD pins

Once the SWD I/O is released by the user software, the GPIO controller takes control of it. The reset states of the GPIO control registers put the I/Os in the equivalent states:
  • SWDIO: alternate function pull-up
  • SWCLK: alternate function pull-down

The embedded pull-up and pull-down resistors remove the need to add external resistors.

SWD port connection with standard SWD connector

The figure below shows the connection between the device and a standard SWD connector.
Figure 7. SWD connector implementation


PCB (printed circuit board)

For technical reasons, it is best to use a multilayer printed circuit board PCB, with a separate layer dedicated to the ground (VSS) and another dedicated to the VDD supply.

This provides both good decoupling and good shielding effect. For many applications, cost reasons prohibit the use of this type of board. In this case, the major requirement is to ensure a good structure for the ground and the power supply.

Component position

A preliminary layout of the PCB must separate circuits into different blocks:
  • High-current circuits
  • Low-voltage circuits
  • Digital component circuits
  • Circuits separated according to their EMI contribution, in order to reduce noise due to cross-coupling on the PCB.

Ground and power supply

The following rules related to grounding must be respected:
  • Ground every block (noisy, low-level sensitive, digital, or others) individually.
  • Return all grounds to a single point.
  • Avoid loops or ensure they have a minimum area.

In order to improve analog performance, the user must use separate supply sources for VDD and VDDA, and place the decoupling capacitors as close as possible to the device.

The power supplies must be implemented close to the ground line to minimize the area of the supplies loop. This is because the supply loop acts as an antenna, and acts as the main transmitter and receiver of EMI. All component-free PCB areas must be filled with additional grounding to create a kind of shielding (especially when using single‑layer PCBs).

Decoupling

All power-supply and ground pins must be properly connected to the power supplies. These connections (including pads, tracks, and vias) must have the lowest possible impedance. This is typically achieved with thick track widths and, preferably, the use of dedicated power-supply planes in multilayer PCBs.

In addition, each power supply pair should be decoupled with filtering ceramic capacitors (100 nF) and one single ceramic capacitor (minimum 4.7 μF) connected in parallel.

Some packages use a common VSS for several VDD instead of a pair of power pins (one VSS for each VDD), in that case the capacitors must be between each VDD and the common VSS. These capacitors need to be placed as close as possible to, or below, the appropriate pins on the underside of the PCB. Typical values are 10 nF to 100 nF, but exact values depend on the application requirements.

The figure below shows the typical layout of such a VDD/VSS pair.
Figure 8. Typical layout for VDD/VSS pin pair


Other signals

When designing an application, the EMC performance can be improved by closely studying the following:
  • Signals for which a temporary disturbance affects the running process permanently (which is the case for interrupts and handshaking strobe signals but, not the case for LED commands).

    For these signals, a surrounding ground trace, shorter lengths, and the absence of noisy and sensitive traces nearby (crosstalk effect) improve EMC performance. For digital signals, the best possible electrical margin must be reached for the two logical states and slow Schmitt triggers are recommended to eliminate parasitic states.

  • Noisy signals (example, clock)
  • Sensitive signals (example: high impedance)

Unused I/Os and features

All microcontrollers are designed for a variety of applications and often a particular application does not use 100% of the MCU resources.

To increase the EMC performance and avoid extra power consumption, the unused features of the device must be disabled and disconnected from the clock tree, as follows:
  • The unused clock source must be disabled.
  • The unused I/Os must not be left floating.
  • The unused I/O pins must be configured as analog input by software, and must be connected to a fixed logic level 0 or 1 by an external or internal pull-up or pull-down, or configured as output mode using software.

Description

The reference design shown in the following figures is based on the NUCLEO C562 in the LQFP64 package.

This reference design can be tailored to any STM32C5 device with a different package, using the pin correspondence given in Component references.

Clock

Two clock sources are used for the MCU:
  • LSE: X1– 32.768 kHz crystal for the embedded RTC
  • HSE: X2– crystal for the MCU

See RCC clocks functional description for more details.

Reset

The reset signal is active low in the reference design figures shown in Component references.

The reset sources include:
  • The reset button (B1)
  • Debugging tools via the connector CN1

See Reset and power-supply supervisor for more details.

Boot mode

The user can add a switch on the board to change the boot option but this is optional. On virgin samples the boot address is defined by option bytes (and empty check) and the pads PH2-BOOT0/PB8-BOOT0 are used as GPIO by default.

See Boot configuration for more details.
Note:

When waking up from Standby mode, the BOOT pin is sampled, and the user must pay attention to its value.

SWD interface

The reference design shows the connection between the devices and a standard SWD connector.

See Debug management for more details.

Note:

It is recommended to connect the RESET pins, so as to be able to reset the application from the tools and also to run RDP regression for debug opening.

Power supply

See Power supply management for more details.