When you get a new development board, you usually start by turning on the lights. So the first time you use this development board, you also start by turning on the LED lights.
1. Preparatory conditions
hardware:
- An STM32U5A5ZJ development board;
- A USB Micro-Type-cable;
- A computer with STM32CubeMX and STM32CubeIDE installed;
document:
STM32CubeMX, STM32CubeIDE User Guide
2. Project establishment
I won’t introduce the installation of STM32CubeMX and STM32CubeIDE, there are many on the Internet.
1. Open STM32CubeMX, search for the MCU model, and start the project
Select the project without TrustZone
2. Configure the clock
1) Configure the crystal oscillator
2) Configure the clock
3. Configure LED
Check the schematic diagram. The LED light control pin is PC7, and it lights up when it is at a low level.
Search PC7 in STM32CubeMX and you can see that it is timer 3 channel 2, so you need to configure timer 3 channel 2 to PWM mode;
3. Configure the timer
Enable timer 3, channel 2
Set the timing 3 channel 2 parameters
4. Enable iCache and SMPS
1) Enable ICACHE
2) Configure SMPS
If these two items are not configured, a warning will be prompted when the project is generated.
5. Configuration and production engineering
6. Compile
7. Download verification
The project is as follows: