The STM32G474CBT6 is a high-performance microcontroller from STMicroelectronics, part of the STM32G4 series. It is built around a 32-bit ARM Cortex-M4 core with a floating-point unit (FPU) and operates at a maximum frequency of 170 MHz. This microcontroller is designed for applications requiring high computational power, precision analog capabilities, and advanced peripherals.
Common applications of the STM32G474CBT6 include:
Motor control systems
Industrial automation
Power conversion and management
Consumer electronics
IoT devices and smart sensors
With its rich set of peripherals, including high-resolution timers, multiple ADCs, and communication interfaces, the STM32G474CBT6 is a versatile choice for embedded system developers.
Explore Projects Built with STM32G474CBT6
Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
This circuit features an STM32F103C8T6 microcontroller interfaced with a membrane matrix keypad for input, an RTC DS3231 for real-time clock functionality, and a 16x2 I2C LCD for display. It controls four 12V geared motors through two MD20 CYTRON motor drivers, with the motor power supplied by a 12V battery regulated by a buck converter. The battery is charged via a solar panel connected through a solar charge controller, ensuring a renewable energy source for the system.
This circuit features an STM32F103C8T6 microcontroller interfaced with a China ST7735S 160x128 display and two spectral sensors (Adafruit AS7262 and AS7261). It also includes two pushbuttons for user input, with the microcontroller managing the display and sensor data processing.
This circuit features a microcontroller (STM32F103C8T6) interfaced with a SIM900A GSM module, an HC-SR04 ultrasonic sensor, a water level sensor, and a LoRa Ra-02 SX1278 module for long-range communication. The STM32F103C8T6 is configured to communicate with the GSM module and LoRa module via serial connections, and it reads data from the ultrasonic and water level sensors. An FTDI Programmer is connected for programming and serial communication with the microcontroller.
This circuit features an STM32F103C8T6 microcontroller interfaced with a Bluetooth HC-06 module for wireless communication and an Adafruit Arcade Joystick for user input. The microcontroller's pins B0 and B10 are connected to the TXD and RXD pins of the Bluetooth module, enabling serial communication, while pins B14 and B15 interface with the joystick's directional controls. The circuit is powered by a battery, with power distribution managed through the microcontroller's 3.3V pin and common ground connections.
The STM32G474CBT6 comes in a 48-pin LQFP package. Below is a summary of key pins and their functions:
Pin Number
Pin Name
Function(s)
Notes
1
VDD
Power Supply
3.3V typical
2
VSS
Ground
Connect to ground
3
PA0
GPIO/ADC_IN1/USART2_CTS
Multipurpose pin
4
PA1
GPIO/ADC_IN2/USART2_RTS
Multipurpose pin
5
PA2
GPIO/ADC_IN3/USART2_TX
Multipurpose pin
...
...
...
...
48
NRST
Reset Input
Active low
For the full pinout, refer to the STM32G474CBT6 datasheet.
Usage Instructions
How to Use the STM32G474CBT6 in a Circuit
Power Supply: Provide a stable 3.3V power supply to the VDD pin and connect the VSS pin to ground.
Clock Configuration: Use an external crystal oscillator or the internal high-speed oscillator (HSI) for clock generation. Configure the clock settings in the firmware.
GPIO Configuration: Set up GPIO pins as input, output, or alternate function using the STM32 HAL (Hardware Abstraction Layer) or LL (Low Layer) libraries.
Peripheral Initialization: Enable and configure peripherals such as ADCs, timers, or communication interfaces as needed for your application.
Programming: Use an ST-Link programmer/debugger to upload firmware via the SWD interface.
Important Considerations and Best Practices
Decoupling Capacitors: Place decoupling capacitors (e.g., 0.1 µF) close to the VDD pins to ensure stable operation.
Reset Pin: Connect the NRST pin to a pull-up resistor (e.g., 10 kΩ) to avoid unintended resets.
Debugging: Reserve the SWD pins (SWCLK and SWDIO) for debugging and programming.
Clock Accuracy: For applications requiring precise timing, use an external crystal oscillator.
Example: Blinking an LED with STM32G474CBT6 and Arduino IDE
The STM32G474CBT6 can be programmed using the Arduino IDE with the STM32 core installed. Below is an example of blinking an LED connected to pin PA5:
// Include the STM32 HAL library
#include <Arduino.h>
// Define the LED pin
#define LED_PIN PA5
void setup() {
// Initialize the LED pin as an output
pinMode(LED_PIN, OUTPUT);
}
void loop() {
// Turn the LED on
digitalWrite(LED_PIN, HIGH);
delay(500); // Wait for 500 ms
// Turn the LED off
digitalWrite(LED_PIN, LOW);
delay(500); // Wait for 500 ms
}
Troubleshooting and FAQs
Common Issues and Solutions
Microcontroller Not Responding
Cause: Incorrect power supply or missing decoupling capacitors.
Solution: Verify the power supply voltage (3.3V) and ensure proper decoupling capacitors are in place.
Unable to Program the Microcontroller
Cause: SWD pins are not accessible or the microcontroller is in a low-power mode.
Solution: Ensure the SWD pins are connected to the programmer and the microcontroller is not in standby mode.
Peripheral Not Working
Cause: Incorrect clock configuration or peripheral initialization.
Solution: Double-check the clock settings and ensure the peripheral is properly initialized in the firmware.
FAQs
Q: Can I use the STM32G474CBT6 with 5V logic?
A: No, the STM32G474CBT6 operates at 3.3V logic levels. Use level shifters if interfacing with 5V devices.
Q: What development tools are compatible with the STM32G474CBT6?
A: You can use STM32CubeIDE, Keil uVision, IAR Embedded Workbench, or the Arduino IDE (with STM32 core).
Q: How do I enable the floating-point unit (FPU)?
A: The FPU is enabled by default in most development environments. Ensure your compiler settings support hardware floating-point operations.
This concludes the documentation for the STM32G474CBT6. For more details, refer to the official datasheet and reference manual from STMicroelectronics.