STM32 pins VCC, VDD, VEE, VSS, VBAT
This is a fundamental and important concept when starting with STM32 (or any microcontroller).
Here’s a clear breakdown of what these pins mean and how to handle them on an STM32.
The Quick Answer (TL;DR)
VDD: Positive supply voltage for the digital internal logic. (e.g., 3.3V)
VCC: Positive supply voltage for the analog peripherals (ADCs, DACs, etc.) and I/O pins. Often connected to the same 3.3V rail as VDD.
VSS: Ground reference for the digital circuitry (0V).
VSSA: Ground reference for the analog circuitry. (Must be connected to VSS but with a careful layout).
VREF+ / VREF-: Reference voltage for the Analog-to-Digital Converter (ADC). Provides a cleaner reference than VCC/VSSA for accurate measurements.
VBAT: Backup power input for the Real-Time Clock (RTC), backup registers, and sometimes the low-power oscillator when main power is off.
VEE: Negative supply voltage. Rarely used on MCUs; common on LCDs. On an STM32, it's not a pin you supply; it's a generated negative voltage for the internal LCD controller (if the model has one).
Detailed Explanation
1. VDD / VCC (Positive Supply Voltage)
VDD: This is the main positive power supply pin for the digital core of the microcontroller. The CPU, memory, and digital peripherals all run from this voltage. On most STM32 families, this is 3.3V. A microcontroller can have multiple VDD pins. You must connect ALL of them to your 3.3V power supply. Decoupling capacitors (typically 100nF) must be placed as close as possible to each VDD/VSS pair.
VCC: This is the positive supply pin for the analog blocks (like PHY of USB OTG) and the I/O ports. On many STM32 chips, VDD and VCC are essentially the same net internally and must both be connected to the same 3.3V power rail. The datasheet will specify if there is any difference.
Rule of Thumb: Connect all VDD and VCC pins to your clean, regulated 3.3V supply.
2. VSS / VSSA (Ground)
VSS: This is the ground (0V reference) for the digital circuitry. Like VDD, there are multiple VSS pins. You must connect ALL of them to your common ground plane.
VSSA: This is the analog ground reference. It is crucial for achieving good accuracy with the ADC and DAC. While it must eventually be connected to VSS (digital ground), the connection should be made at a single, quiet point (often a "star point") to prevent digital switching noise from corrupting the sensitive analog measurements.
Rule of Thumb: Connect all VSS pins to your main ground. Connect VSSA to the same ground, but ensure the path is direct and away from noisy digital traces.
3. VREF+ / VREF- (ADC Reference Voltage)
What it is: To get the most accurate analog readings, the ADC needs a clean, stable voltage to use as its reference. While you can use VCC as the reference, it's often noisy.
VREF+: The positive reference voltage input. You can connect this to a dedicated, clean voltage regulator (e.g., 2.5V) for high precision, or simply connect it to VCC if precision is not critical.
VREF-: The negative reference voltage input. This should be connected to VSSA.
Rule of Thumb: If your board has a dedicated, low-noise regulator for VREF+, use it. For most applications, connecting VREF+ to VCC and VREF- to VSSA is acceptable. Always check your specific STM32 model's datasheet, as some lower-pin-count devices have VREF+ and VREF- internally connected to VCC and VSSA and don't bring them out to pins.
4. VBAT (Backup Battery)
What it is: This pin provides power to the Backup Domain (RTC, backup SRAM) when the main VDD power is removed. This allows the real-time clock to keep time and a small amount of memory to retain data (like configuration settings) using a coin cell battery or a supercapacitor.
How to use:
If you are using the RTC or backup registers, connect a 3V coin cell battery (like a CR2032) to this pin through a Schottky diode (e.g., BAT54S).
If you don't need backup power, this pin MUST be connected to VDD. Do not leave it floating.
5. VEE (Negative Supply - for LCD)
What it is: This pin is only present on STM32 models that have a built-in LCD controller (e.g., some STM32L0, STM32L4 series for segment LCDs).
It is an OUTPUT, not an input. The internal charge pump generates a negative voltage on this pin to drive the LCD segments.
You do not supply power to this pin. You simply connect it to the VEE pin of your LCD glass or filter it with a capacitor according to the datasheet.
Wiring Summary Table
Pin Name | Type | Description | How to Connect |
---|---|---|---|
VDD | Input | Digital core power supply. | Connect ALL to 3.3V. Add decoupling caps to VSS. |
VCC | Input | Analog & I/O power supply. | Connect to the same 3.3V rail as VDD. |
VSS | Input | Digital ground. | Connect ALL to Ground (0V). |
VSSA | Input | Analog ground. | Connect to a quiet ground, linked to main VSS. |
VREF+ | Input | ADC positive reference voltage. | For precision: dedicated regulator (e.g., 2.5V). For general use: connect to VCC. |
VREF- | Input | ADC negative reference voltage. | Connect to VSSA. |
VBAT | Input | Backup battery input. | Use a 3V battery (if needed) or tie to VDD. |
VEE | Output | Generated negative voltage for LCD. | Connect to your LCD's VEE pin. Do not power it. |
Practical Schematic Tips
Never Leave Pins Floating: Every single VDD, VCC, VSS, VSSA, VREF, and VBAT pin must be connected according to the datasheet. Leaving them disconnected is a common cause of erratic behavior or a non-functional MCU.
Decoupling is Non-Negotiable: Place a 100nF ceramic capacitor between every VDD/VCC pin and its nearest VSS pin. Place these capacitors as physically close to the MCU pins as possible. This is the most important rule for stable operation.
Always Consult the Datasheet: The definitive guide for your specific STM32 model (e.g., STM32F103C8T6) is its Datasheet (for pinout and electrical characteristics) and Reference Manual (for in-depth functional details).
评论
发表评论