Examples catalog

This is the list of the STM32Cube Software Examples available in the STM32Cube Software Package. They are available on all the STM32 series, on each board supporting the required features.

Get them

They can be obtained from:

  • The STMicroelectronics GitHub.

Example Name

Category

Topic

Summary

Project Extractor Command

hal_gpio_exti

hal

gpio

How to configure an interrupt on EXTI line with the HAL API.

C:/st/STM32Cube_SW_Package_U5_2.0.0-beta.1.0/project_extractor/project_extractor.exe -p exti -b NUCLEO-U575ZI-Q -f EWARM -o C:/tmp/my_project -r C:/st/STM32Cube_SW_Package_U5_2.0.0-beta.1.0

hal_gpio_toggle

hal

gpio

How to configure and drive a GPIO through the HAL API. \ The best illustration is to use a GPIO connected to a led.

C:/st/STM32Cube_SW_Package_U5_2.0.0-beta.1.0/project_extractor/project_extractor.exe -p toggle -b NUCLEO-U575ZI-Q -f EWARM -o C:/tmp/my_project -r C:/st/STM32Cube_SW_Package_U5_2.0.0-beta.1.0

hal_i2c_two_boards_com_it_controller

hal

i2c

How to handle an infinite number of transmit-receive transactions between two boards based on the I2C-bus protocol with the HAL API, using interrupts. The example implements the controller’s code. Note that the terminology Controller/Responder characterizes the role taken by each device in the I2C communication, also known as I2C master and slave in legacy terminology.

C:/st/STM32Cube_SW_Package_U5_2.0.0-beta.1.0/project_extractor/project_extractor.exe -p two_boards_com_it_controller -b NUCLEO-U575ZI-Q -f EWARM -o C:/tmp/my_project -r C:/st/STM32Cube_SW_Package_U5_2.0.0-beta.1.0

hal_i2c_two_boards_com_it_responder

hal

i2c

How to respond in an interrupt mode I2C communication, driven by the controller, using the HAL API. The scenario consists of an infinite number of receive-transmit transactions of changing messages. Note that the terminology Controller/Responder characterizes the role taken by each device in the I2C communication, also known as I2C master and slave in legacy terminology.

C:/st/STM32Cube_SW_Package_U5_2.0.0-beta.1.0/project_extractor/project_extractor.exe -p two_boards_com_it_responder -b NUCLEO-U575ZI-Q -f EWARM -o C:/tmp/my_project -r C:/st/STM32Cube_SW_Package_U5_2.0.0-beta.1.0

hal_rcc_lsi_config

hal

rcc

How to configure the LSI (Low Speed Internal) clock and enable/disable it using the RCC HAL APIs.

C:/st/STM32Cube_SW_Package_U5_2.0.0-beta.1.0/project_extractor/project_extractor.exe -p lsi_config -b NUCLEO-U575ZI-Q -f EWARM -o C:/tmp/my_project -r C:/st/STM32Cube_SW_Package_U5_2.0.0-beta.1.0

hal_spi_full_duplex_two_boards_com_dma_controller

hal

spi

How to manage a full-duplex synchronous SPI communication as controller, in DMA mode, using the HAL API.

C:/st/STM32Cube_SW_Package_U5_2.0.0-beta.1.0/project_extractor/project_extractor.exe -p full_duplex_two_boards_com_dma_controller -b NUCLEO-U575ZI-Q -f EWARM -o C:/tmp/my_project -r C:/st/STM32Cube_SW_Package_U5_2.0.0-beta.1.0

hal_spi_full_duplex_two_boards_com_dma_responder

hal

spi

How to manage a full-duplex synchronous SPI communication as responder, in DMA mode, using the HAL API.

C:/st/STM32Cube_SW_Package_U5_2.0.0-beta.1.0/project_extractor/project_extractor.exe -p full_duplex_two_boards_com_dma_responder -b NUCLEO-U575ZI-Q -f EWARM -o C:/tmp/my_project -r C:/st/STM32Cube_SW_Package_U5_2.0.0-beta.1.0

hal_spi_full_duplex_two_boards_com_polling_controller

hal

spi

How to manage a full duplex synchronous SPI communication as controller, in polling mode, using the HAL API.

C:/st/STM32Cube_SW_Package_U5_2.0.0-beta.1.0/project_extractor/project_extractor.exe -p full_duplex_two_boards_com_polling_controller -b NUCLEO-U575ZI-Q -f EWARM -o C:/tmp/my_project -r C:/st/STM32Cube_SW_Package_U5_2.0.0-beta.1.0

hal_spi_full_duplex_two_boards_com_polling_responder

hal

spi

How to manage a full duplex synchronous SPI communication as responder, in polling mode, using the HAL APIs.

C:/st/STM32Cube_SW_Package_U5_2.0.0-beta.1.0/project_extractor/project_extractor.exe -p full_duplex_two_boards_com_polling_responder -b NUCLEO-U575ZI-Q -f EWARM -o C:/tmp/my_project -r C:/st/STM32Cube_SW_Package_U5_2.0.0-beta.1.0

hal_spi_full_duplex_two_boards_crc_com_it_controller

hal

spi

How to manage a full-duplex synchronous SPI communication with CRC as controller, in interrupt mode, using the HAL API.

C:/st/STM32Cube_SW_Package_U5_2.0.0-beta.1.0/project_extractor/project_extractor.exe -p full_duplex_two_boards_crc_com_it_controller -b NUCLEO-U575ZI-Q -f EWARM -o C:/tmp/my_project -r C:/st/STM32Cube_SW_Package_U5_2.0.0-beta.1.0

hal_spi_full_duplex_two_boards_crc_com_it_responder

hal

spi

How to manage a full-duplex synchronous SPI communication with CRC as responder, in interrupt mode, using the HAL API.

C:/st/STM32Cube_SW_Package_U5_2.0.0-beta.1.0/project_extractor/project_extractor.exe -p full_duplex_two_boards_crc_com_it_responder -b NUCLEO-U575ZI-Q -f EWARM -o C:/tmp/my_project -r C:/st/STM32Cube_SW_Package_U5_2.0.0-beta.1.0

hal_tim_oc_toggle

hal

tim

C:/st/STM32Cube_SW_Package_U5_2.0.0-beta.1.0/project_extractor/project_extractor.exe -p oc_toggle -b NUCLEO-U575ZI-Q -f EWARM -o C:/tmp/my_project -r C:/st/STM32Cube_SW_Package_U5_2.0.0-beta.1.0

hal_tim_pwm_dma

hal

tim

How to configure the TIM peripheral in PWM (Pulse Width Modulation) mode with variable duty cycle using DMA. The PWM waveforms generated by the timer channels can be displayed using an oscilloscope.

C:/st/STM32Cube_SW_Package_U5_2.0.0-beta.1.0/project_extractor/project_extractor.exe -p pwm_dma -b NUCLEO-U575ZI-Q -f EWARM -o C:/tmp/my_project -r C:/st/STM32Cube_SW_Package_U5_2.0.0-beta.1.0

hal_tim_pwm_output

hal

tim

How to configure the TIM peripheral in PWM (Pulse Width Modulation) mode. The PWM waveforms generated by the timer channels can be displayed using an oscilloscope.

C:/st/STM32Cube_SW_Package_U5_2.0.0-beta.1.0/project_extractor/project_extractor.exe -p pwm_output -b NUCLEO-U575ZI-Q -f EWARM -o C:/tmp/my_project -r C:/st/STM32Cube_SW_Package_U5_2.0.0-beta.1.0

hal_tim_timebase

hal

tim

How to configure the TIM peripheral to generate a timebase in interrupt mode.

C:/st/STM32Cube_SW_Package_U5_2.0.0-beta.1.0/project_extractor/project_extractor.exe -p timebase -b NUCLEO-U575ZI-Q -f EWARM -o C:/tmp/my_project -r C:/st/STM32Cube_SW_Package_U5_2.0.0-beta.1.0

hal_uart_echo_it

hal

uart

How to implement UART communication in it mode, driven by HyperTerminal, using the HAL API.

C:/st/STM32Cube_SW_Package_U5_2.0.0-beta.1.0/project_extractor/project_extractor.exe -p echo_it -b NUCLEO-U575ZI-Q -f EWARM -o C:/tmp/my_project -r C:/st/STM32Cube_SW_Package_U5_2.0.0-beta.1.0

hal_uart_two_boards_com_it_controller

hal

uart

How to handle an infinite number of transmit-receive transactions between two boards based on the UART-bus protocol with the HAL API, in interrupt mode. The example implements the controller’s code.

C:/st/STM32Cube_SW_Package_U5_2.0.0-beta.1.0/project_extractor/project_extractor.exe -p two_boards_com_it_controller -b NUCLEO-U575ZI-Q -f EWARM -o C:/tmp/my_project -r C:/st/STM32Cube_SW_Package_U5_2.0.0-beta.1.0

hal_uart_two_boards_com_it_responder

hal

uart

How to respond in an interrupt mode UART communication, driven by the controller, using the HAL API. The scenario consists of an infinite number of receive-transmit transactions of changing messages.

C:/st/STM32Cube_SW_Package_U5_2.0.0-beta.1.0/project_extractor/project_extractor.exe -p two_boards_com_it_responder -b NUCLEO-U575ZI-Q -f EWARM -o C:/tmp/my_project -r C:/st/STM32Cube_SW_Package_U5_2.0.0-beta.1.0

hal_usart_two_boards_com_it_controller

hal

usart

How to handle an infinite number of transmit-receive transactions between two boards based on the USART-bus protocol with the HAL API, in interrupt mode. The example implements the controller’s code.

C:/st/STM32Cube_SW_Package_U5_2.0.0-beta.1.0/project_extractor/project_extractor.exe -p two_boards_com_it_controller -b NUCLEO-U575ZI-Q -f EWARM -o C:/tmp/my_project -r C:/st/STM32Cube_SW_Package_U5_2.0.0-beta.1.0

hal_usart_two_boards_com_it_responder

hal

usart

How to respond in an interrupt mode USART communication, driven by the controller, using the HAL API. The scenario consists of an infinite number of receive-transmit transactions of changing messages.

C:/st/STM32Cube_SW_Package_U5_2.0.0-beta.1.0/project_extractor/project_extractor.exe -p two_boards_com_it_responder -b NUCLEO-U575ZI-Q -f EWARM -o C:/tmp/my_project -r C:/st/STM32Cube_SW_Package_U5_2.0.0-beta.1.0

led_blinking_gpio

parts

led

How to use the LED part GPIO API. It illustrates it by blinking the status LED through a GPIO.

C:/st/STM32Cube_SW_Package_U5_2.0.0-beta.1.0/project_extractor/project_extractor.exe -p blinking_gpio -b NUCLEO-U575ZI-Q -f EWARM -o C:/tmp/my_project -r C:/st/STM32Cube_SW_Package_U5_2.0.0-beta.1.0

sequencer_gpio_toggle

utilities

sequencer

This example demonstrates a application to handle a GPIO toggle on an STM32 microcontroller using the sequencer utility. The main loop acts as an infinite loop for the sequencer execution, and SysTick is used to trigger a task responsible for toggling the GPIO every 1 second.

C:/st/STM32Cube_SW_Package_U5_2.0.0-beta.1.0/project_extractor/project_extractor.exe -p gpio_toggle -b NUCLEO-U575ZI-Q -f EWARM -o C:/tmp/my_project -r C:/st/STM32Cube_SW_Package_U5_2.0.0-beta.1.0