STM32CubeL5 Firmware Examples for STM32L5xx Series

The STM32CubeL5 Firmware package comes with a rich set of examples running on STMicroelectronics boards, organized by board and provided with preconfigured projects for the main supported toolchains.

The examples are classified depending on the STM32Cube level they apply to, and are named as follows:

The examples are located under STM32Cube_FW_L5_VX.Y.Z\Projects\

The examples in the default product configuration with the TrustZone disabled have the same structure:

The examples with the TrustZone enabled are suffixed with "_TrustZone" have the same structure:

To run the example, you have to do the following:

The provided examples can be tailored to run on any compatible hardware; user simply need to update the BSP drivers for his board, if it has the same hardware functions (LED, LCD display, pushbuttons...etc.). The BSP is based on a modular architecture that allows it to be ported easily to any hardware by just implementing the low level routines.

The table below contains the list of examples provided within STM32Cube_FW_L5 Firmware package.
In this table, the label CubeMX means the projects have been created using STM32CubeMX, the STM32Cube initialization code generator. Those projects can be opened with this tools to modify the projects itself. The others projects are manually created to demonstrate the product features.
In this table, the label TrustZone means the projects have been created for devices with Arm® TrustZone® enabled. Please read the projects readme.txt file for user option bytes configuration.

Reference materials available on www.st.com/stm32cubefw

Level Module Name Project Name Description STM32L562E-DK STM32L552E-EV NUCLEO-L552ZE-Q

Templates

-

TrustZoneDisabled

This project provides a reference template based on the STM32Cube HAL API that can be used to build any firmware application when security is not enabled (TZEN=0). X X X

TrustZoneEnabled

This project provides a reference template based on the STM32Cube HAL API that can be used to build any firmware application when TrustZone security is activated (Option bit TZEN=1). X TrustZone X TrustZone X TrustZone
Total number of templates: 6 2 2 2

Templates_LL

-

TrustZoneDisabled

Reference template based on the STM32Cube LL API that can be used to build any firmware application. X X X
Total number of templates_ll: 3 1 1 1

Examples

-

BSP

How to use the different BSP drivers of the board. X X -

ADC

ADC_AnalogWatchdog

How to use the ADC peripheral to perform conversions with an analog watchdog and out-of-window interrupts enabled. - - CubeMx

ADC_MultiChannelSingleConversion

Use ADC to convert a several channels using sequencer in discontinuous mode, conversion data are transferred by DMA into an array, indefinitely (circular mode). - CubeMx CubeMx

ADC_Oversampling

Use ADC to convert a single channel but using oversampling feature to increase resolution. - CubeMx CubeMx

ADC_SingleConversion_TriggerSW_IT

Use ADC to convert a single channel at each SW start, conversion performed using programming model: interrupt Example configuration: ADC is configured to convert a single channel, in single conversion mode, from SW trigger. - - CubeMx

ADC_SingleConversion_TriggerTimer_DMA

Use ADC to convert a single channel at each trig from timer, conversion data are transferred by DMA into an array, indefinitely (circular mode). - - CubeMx

COMP

COMP_CompareGpioVsVrefInt_IT

How to configure the COMP peripheral to compare the external voltage applied on a specific pin with the Internal Voltage Reference. CubeMx CubeMx CubeMx

COMP_CompareGpioVsVrefInt_Window_IT

This example shows how to make an analog watchdog using the COMP peripherals in window mode. CubeMx CubeMx CubeMx

CORTEX

CORTEXM_InterruptSwitch_TrustZone

How to first use an interrupt in secure application and later assign it to the non-secure application when TrustZone security is activated (Option bit TZEN=1). - - CubeMx TrustZone

CORTEXM_ModePrivilege

How to modify the Thread mode privilege access and stack. Thread mode is entered on reset or when returning from an exception. CubeMx - CubeMx

CORTEXM_ProcessStack

How to modify the Thread mode stack. Thread mode is entered on reset, and can be entered as a result of an exception return. CubeMx - CubeMx

CORTEXM_SysTick

How to use the default SysTick configuration with a 1 ms timebase to toggle LEDs. CubeMx - CubeMx

CRC

CRC_Bytes_Stream_7bit_CRC

How to configure the CRC using the HAL API. The CRC (cyclic redundancy check) calculation unit computes 7-bit CRC codes derived from buffers of 8-bit data (bytes). The user-defined generating polynomial is manually set to 0x65, that is, X^7 + X^6 + X^5 + X^2 + 1, as used in the Train Communication Network, IEC 60870-5[17]. CubeMx - CubeMx

CRC_Data_Reversing_16bit_CRC

How to configure the CRC using the HAL API. The CRC (cyclic redundancy check) calculation unit computes a 16-bit CRC code derived from a buffer of 32-bit data (words). Input and output data reversal features are enabled. The user-defined generating polynomial is manually set to 0x1021, that is, X^16 + X^12 + X^5 + 1 which is the CRC-CCITT generating polynomial. CubeMx - CubeMx

CRC_Example

How to configure the CRC using the HAL API. The CRC (cyclic redundancy check) calculation unit computes the CRC code of a given buffer of 32-bit data words, using a fixed generator polynomial (0x4C11DB7). CubeMx - CubeMx

CRC_UserDefinedPolynomial

How to configure the CRC using the HAL API. The CRC (cyclic redundancy check) calculation unit computes the 8-bit CRC code for a given buffer of 32-bit data words, based on a user-defined generating polynomial. CubeMx - CubeMx

CRYP

CRYP_AESModes

How to use the CRYP peripheral to encrypt and decrypt data using AES in chaining modes (ECB, CBC, CTR). CubeMx - -

CRYP_AESModes_Suspension

How to use the CRYP peripheral to suspend then resume a ciphering processing. CubeMx - -

CRYP_DMA

How to use the CRYP peripheral to encrypt and decrypt data using the AES-128 algorithm with ECB chaining mode in DMA mode. CubeMx - -

CRYP_GCM_GMAC_CCM_Modes

How to use the CRYP peripheral to encrypt data and generate authentication tags using GCM/GMAC/CCM modes. CubeMx - -

CRYP_GCM_Suspension

How to use the CRYP peripheral to suspend then resume an authentication ciphering processing. CubeMx - -

DAC

DAC_SimpleConversion

How to use the DAC peripheral to do a simple conversion. - CubeMx CubeMx

DFSDM

DFSDM_AudioRecord

How to use the DFSDM HAL API to perform mono audio recording. This example uses the SPH0641LM4H-1 digital microphone mounted on the board. CubeMx CubeMx -

DFSDM_Thermometer

How to use the DFSDM HAL API to perform temperature measurements. This example uses the PTS100R (thermistor) and STPMS2 (sigma-delta modulator) mounted on the board. The STPMS2 allows voltage and current values to be obtained from the PTS100R. The temperature value is thus deduced. - CubeMx -

DMA

DMA_FLASHToRAM

How to use a DMA to transfer a word data buffer from Flash memory to embedded SRAM through the HAL API. CubeMx CubeMx CubeMx

DMA_MUXSYNC

How to use the DMA with the DMAMUX to synchronize a transfer with the LPTIM1 output signal. USART3 is used in DMA synchronized mode to send a countdown from 10 to 00, with a period of 2 seconds. - - CubeMx

DMA_MUX_RequestGen

How to use the DMA with the DMAMUX request generator to generate DMA transfer requests upon an External line 13 rising edge signal. - - CubeMx

DMA_MemToMem_TrustZone

How to use HAL DMA to perform memory to memory data transfers over secure and non-secure DMA channels when TrustZone security is activated (Option bit TZEN=1). - - CubeMx TrustZone

FDCAN

FDCAN_Classic_Frame_Networking

How to configure the FDCAN peripheral to send and receive Classic CAN frames. - CubeMx -

FDCAN_Loopback

How to configure the FDCAN to operate in loopback mode. - CubeMx -

FLASH

FLASH_BlockBased_TrustZone

How to configure and use the FLASH HAL API to managed block-based security of internal Flash memory between secure and non-secure applications when TrustZone security is activated (Option bit TZEN=1). - CubeMx TrustZone -

FLASH_DualBoot

Guide through the configuration steps to program internal Flash memory bank 1 and bank 2, and to swap between both of them by mean of the FLASH HAL API. CubeMx CubeMx -

FLASH_EraseProgram

How to configure and use the FLASH HAL API to erase and program the internal Flash memory. CubeMx CubeMx CubeMx

FLASH_EraseProgram_TrustZone

How to configure and use the FLASH HAL API to erase and program the internal Flash memory when TrustZone security is activated (Option bit TZEN=1). - CubeMx TrustZone -

FLASH_WriteProtection

How to configure and use the FLASH HAL API to enable and disable the write protection of the internal Flash memory. CubeMx CubeMx CubeMx

FMC

FMC_SRAM

How to configure the FMC controller to access the IS61WV51216BLL SRAM memory. - CubeMx -

FMC_SRAM_DataMemory

How to configure the FMC controller to access the IS61WV51216BLL SRAM memory including heap and stack. - CubeMx -

FMC_SRAM_TrustZone

How to configure the FMC controller to access the IS61WV51216BLL SRAM memory split between secure and non-secure applications when TrustZone security is activated (Option bit TZEN=1). . - CubeMx TrustZone -

GPIO

GPIO_EXTI

How to configure external interrupt lines. CubeMx - CubeMx

GPIO_IOToggle

How to configure and use GPIOs through the HAL API. CubeMx CubeMx CubeMx

GPIO_IOToggle_TrustZone

How to use HAL GPIO to toggle secure and unsecure IOs when TrustZone security is activated (Option bit TZEN=1). CubeMx TrustZone - CubeMx TrustZone

GTZC

GTZC_MPCWM_IllegalAccess_TrustZone

How to use GTZC MPCWM-TZIC to build any example when TrustZone security is activated (Option bit TZEN=1). - CubeMx TrustZone -

GTZC_TZSC_MPCBB_TrustZone

How to use HAL GTZC MPCBB to build any example with SecureFault detection when TrustZone security is activated (Option bit TZEN=1). CubeMx TrustZone - CubeMx TrustZone

HAL

HAL_RegisterCallbacks_TIM

Register a callback function called every second based on TIM peripheral configuration to generate a timebase of one second with the corresponding interrupt request. - - X

HAL_TimeBase_RTC_WKUP

How to customize HAL using RTC wakeup as main source of time base, instead of Systick. - - CubeMx

HAL_TimeBase_TIM

How to customize HAL using a general-purpose timer as main source of time base instead of Systick. CubeMx CubeMx CubeMx

HASH

HASH_HMAC_SHA1MD5

How to use the HASH peripheral to hash data with HMAC SHA-1 and HMAC MD5 algorithms. - - CubeMx

HASH_HMAC_SHA224SHA1_DMA_Suspension

How to suspend the HMAC digest computation when data are fed to the HASH unit with DMA. - - CubeMx

HASH_HMAC_SHA224SHA256_MultiBuffer_DMA

How to handle text messages larger than the maximum DMA transfer length. The input data are split into several buffers with sizes within the DMA limit, then fed successively to the HASH peripheral. - - CubeMx

HASH_HMAC_SHA256MD5_IT_Suspension

How to suspend the HMAC digest computation when data are fed in interrupt mode. - - CubeMx

HASH_SHA1MD5

This example shows how to use the HASH peripheral to hash data with SHA-1 and MD5 algorithms. - - CubeMx

HASH_SHA1MD5_DMA

How to use the HASH peripheral to hash data using SHA-1 and MD5 algorithms when data are fed to the HASH unit with DMA. - - CubeMx

HASH_SHA1SHA224_IT_Suspension

How to suspend the HASH peripheral when data are fed in interrupt mode. - - CubeMx

HASH_SHA1_DMA_TrustZone

How to use a secure HASH SHA-1 computation service based on secure DMA channel when TrustZone security is activated (Option bit TZEN=1). - - X TrustZone

HASH_SHA224SHA256_DMA

How to use the HASH peripheral to hash data with SHA224 and SHA256 algorithms. - - CubeMx

HASH_SHA256MD5_DMA_Suspension

How to suspend the HASH peripheral when data are fed to the HASH unit with DMA. - - CubeMx

I2C

I2C_TwoBoards_AdvComIT

How to handle I2C data buffer transmission/reception between two boards, using an interrupt. - - CubeMx

I2C_TwoBoards_ComDMA

How to handle I2C data buffer transmission/reception between two boards, via DMA. - - CubeMx

I2C_TwoBoards_ComIT

How to handle I2C data buffer transmission/reception between two boards, using an interrupt. - - CubeMx

I2C_TwoBoards_ComPolling

How to handle I2C data buffer transmission/reception between two boards, in polling mode. - - CubeMx

I2C_TwoBoards_RestartAdvComIT

How to perform multiple I2C data buffer transmission/reception between two boards, in interrupt mode and with restart condition. - - CubeMx

I2C_TwoBoards_RestartComIT

How to handle single I2C data buffer transmission/reception between two boards, in interrupt mode and with restart condition. - - CubeMx

I2C_WakeUpFromStop2

How to handle I2C data buffer transmission/reception between two boards, using an interrupt when the device is in Stop 2 mode. - - CubeMx

ICACHE

ICACHE_SRAM_Memory_Remap

How to execute code from an external SRAM remapped region configured through the ICACHE HAL driver. - CubeMx -

IWDG

IWDG_Reset

How to handle the IWDG reload counter and simulate a software fault that generates an MCU IWDG reset after a preset laps of time. - CubeMx CubeMx

IWDG_WindowMode

How to periodically update the IWDG reload counter and simulate a software fault that generates an MCU IWDG reset after a preset laps of time. - - CubeMx

LPTIM

LPTIM_PWMExternalClock

How to configure and use, through the HAL LPTIM API, the LPTIM peripheral using an external counter clock, to generate a PWM signal at the lowest power consumption. - CubeMx -

LPTIM_PWM_LSE

How to configure and use, through the HAL LPTIM API, the LPTIM peripheral using LSE as counter clock, to generate a PWM signal, in a low-power mode. - CubeMx -

LPTIM_PulseCounter

How to configure and use, through the LPTIM HAL API, the LPTIM peripheral to count pulses. CubeMx CubeMx CubeMx

LPTIM_Timeout

How to implement, through the HAL LPTIM API, a timeout with the LPTIMER peripheral, to wake up the system from a low-power mode. - CubeMx CubeMx

OCTOSPI

OSPI_NOR_ExecuteInPlace

How to execute code from OSPI memory after code loading. CubeMx CubeMx -

OSPI_NOR_ExecuteInPlace_DTR

How to execute code from OSPI memory after code loading. CubeMx CubeMx -

OSPI_NOR_MemoryMapped

How to use a OSPI NOR memory in memory-mapped mode. CubeMx CubeMx -

OSPI_NOR_MemoryMapped_DTR

How to use a OSPI NOR memory in memory-mapped mode. CubeMx CubeMx -

OSPI_NOR_ReadWrite_DMA

How to use a OSPI NOR memory in DMA mode. CubeMx CubeMx -

OSPI_NOR_ReadWrite_DMA_DTR

How to use a OSPI NOR memory in DMA mode. CubeMx CubeMx -

OSPI_RAM_ExecuteInPlace

How to execute code from OSPI memory after code loading. - CubeMx -

OSPI_RAM_MemoryMapped

How to use a OSPI HyperRAM memory in memory-mapped mode. - CubeMx -

OSPI_RAM_ReadWrite_DMA

How to use a OSPI HyperRAM memory in DMA mode. - CubeMx -

OPAMP

OPAMP_PGA

How to configure the OPAMP peripheral in PGA mode (OPAMP programmable gain). - - CubeMx

OPAMP_STANDALONE

How to configure the OPAMP peripheral in standalone mode. The gain in this mode can be set externally (external gain setting mode). - - CubeMx

OTFDEC

OTFDEC_Ciphering_TrustZone

How to use a secure OTFDEC (On-The-Fly Decoder EnCoder) when TrustZone security is activated (Option bit TZEN=1) to cipher data from secure side and to allow to decipher from non-secure without any key exchange. CubeMx TrustZone - -

OTFDEC_DataDecrypt

How to decrypt data located on the OCTOSPI external flash using the OTFDEC peripheral. CubeMx - -

OTFDEC_ExecutingCryptedInstruction

How to execute ciphered instructions stored in external NOR flash using the OTFDEC peripheral. CubeMx - -

PKA

PKA_ECCscalarMultiplication

How to use the PKA peripheral to execute ECC scalar multiplication. This allows generating a public key from a private key. CubeMx - -

PKA_ECCscalarMultiplication_IT

How to use the PKA peripheral to execute ECC scalar multiplication. This allows generating a public key from a private key in interrupt mode. CubeMx - -

PKA_ECDSA_Sign

How to compute a signed message regarding the Elliptic curve digital signature algorithm (ECDSA). CubeMx - -

PKA_ECDSA_Sign_IT

How to compute a signed message regarding the Elliptic curve digital signature algorithm (ECDSA) in interrupt mode. CubeMx - -

PKA_ECDSA_Verify

How to determine if a given signature is valid regarding the Elliptic curve digital signature algorithm (ECDSA). CubeMx - -

PKA_ECDSA_Verify_IT

How to determine if a given signature is valid regarding the Elliptic curve digital signature algorithm (ECDSA) in interrupt mode. CubeMx - -

PKA_ModularExponentiation

How to use the PKA peripheral to execute modular exponentiation. This allows ciphering/deciphering a text. CubeMx - -

PKA_ModularExponentiationCRT

How to compute the Chinese Remainder Theorem (CRT) optimization. CubeMx - -

PKA_ModularExponentiationCRT_IT

How to compute the Chinese Remainder Theorem (CRT) optimization in interrupt mode. CubeMx - -

PKA_ModularExponentiation_IT

How to use the PKA peripheral to execute modular exponentiation. This allows ciphering/deciphering a text in interrupt mode. CubeMx - -

PKA_PointCheck

How to use the PKA peripheral to determine if a point is on a curve. This allows validating an external public key. CubeMx - -

PKA_PointCheck_IT

How to use the PKA peripheral to determine if a point is on a curve. This allows validating an external public key. CubeMx - -

PWR

PWR_LPRUN

How to enter and exit the Low-power run mode. CubeMx - CubeMx

PWR_LPRUN_SRAM1

How to enter and exit the Low-power run mode. - - CubeMx

PWR_LPSLEEP

How to enter the Low-power sleep mode and wake up from this mode by using an interrupt. CubeMx - CubeMx

PWR_PVD

How to configure the programmable voltage detector by using an external interrupt line. External DC supply must be used to supply Vdd. - CubeMx -

PWR_RUN_SMPS

How to use the SMPS step down converter in RUN mode. - - CubeMx

PWR_SLEEP

How to enter the Sleep mode and wake up from this mode by using an interrupt. CubeMx - CubeMx

PWR_STANDBY

How to enter the Standby mode and wake up from this mode by using an external reset or the WKUP pin. CubeMx - CubeMx

PWR_STOP1

How to enter the Stop 1 mode and wake up from this mode by using an interrupt. - - CubeMx

PWR_STOP1_RTC

How to enter the Stop 1 mode and wake up from this mode by using an interrupt from RTC wakeup timer. - - CubeMx

PWR_STOP2

How to enter the Stop 2 mode and wake up from this mode by using external reset or wakeup interrupt. - - CubeMx

PWR_STOP2_RTC

How to enter the Stop 2 mode and wake up from this mode by using an interrupt from RTC wakeup timer. - - CubeMx

RCC

RCC_CRS_Synchronization_IT

Configuration of the clock recovery service (CRS) in Interrupt mode, using the RCC HAL API. - - CubeMx

RCC_CRS_Synchronization_Polling

Configuration of the clock recovery service (CRS) in Polling mode, using the RCC HAL API. - - CubeMx

RCC_ClockConfig

Configuration of the system clock (SYSCLK) and modification of the clock settings in Run mode, using the RCC HAL API. CubeMx CubeMx CubeMx

RCC_ClockConfig_TrustZone

Configuration of the system clock (SYSCLK) in Run mode from the secure application upon request from the non-secure application, using the RCC HAL API when TrustZone security is activated (Option bit TZEN=1). CubeMx TrustZone - CubeMx TrustZone

RCC_LSEConfig

Enabling/disabling of the low-speed external(LSE) RC oscillator (about 32 KHz) at run time, using the RCC HAL API. - - CubeMx

RCC_LSIConfig

Enabling/disabling of the low-speed internal (LSI) RC oscillator (about 32 KHz) at run time, using the RCC HAL API. - - CubeMx

RNG

RNG_MultiRNG

Configuration of the RNG using the HAL API. This example uses the RNG to generate 32-bit long random numbers. CubeMx CubeMx CubeMx

RNG_MultiRNG_IT

Configuration of the RNG using the HAL API. This example uses RNG interrupts to generate 32-bit long random numbers. - - CubeMx

RTC

RTC_ActiveTamper

Configuration of the active tamper detection with backup registers erase. CubeMx CubeMx -

RTC_Alarm

Configuration and generation of an RTC alarm using the RTC HAL API. CubeMx CubeMx CubeMx

RTC_Calendar

Configuration of the calendar using the RTC HAL API. - CubeMx -

RTC_LSI

Use of the LSI clock source autocalibration to get a precise RTC clock. - - CubeMx

RTC_LowPower_STANDBY_WUT

How to periodically enter and wake up from STANDBY mode thanks to the RTC Wake-Up Timer (WUT). CubeMx CubeMx CubeMx

RTC_Tamper

Configuration of the tamper detection with backup registers erase. - - CubeMx

RTC_TimeStamp

Configuration of the RTC HAL API to demonstrate the timestamp feature. CubeMx - CubeMx

RTC_TrustZone

How to configure the TrustZone-aware RTC peripheral when TrustZone security is activated (Option bit TZEN=1): some features of the RTC can be secure while the others are non-secure. - - CubeMx TrustZone

SAI

SAI_AudioPlay

Use of the SAI HAL API to play an audio file in DMA circular mode and handle the buffer update. CubeMx CubeMx -

SPI

SPI_FullDuplex_ComDMA_Master

Data buffer transmission/reception between two boards via SPI using DMA. - - CubeMx

SPI_FullDuplex_ComDMA_Slave

Data buffer transmission/reception between two boards via SPI using DMA. - - CubeMx

SPI_FullDuplex_ComIT_Master

Data buffer transmission/reception between two boards via SPI using Interrupt mode. - - CubeMx

SPI_FullDuplex_ComIT_Slave

Data buffer transmission/reception between two boards via SPI using Interrupt mode. - - CubeMx

SPI_FullDuplex_ComPolling_Master

Data buffer transmission/reception between two boards via SPI using Polling mode. - - CubeMx

SPI_FullDuplex_ComPolling_Slave

Data buffer transmission/reception between two boards via SPI using Polling mode. - - CubeMx

TIM

TIM_ExtTriggerSynchro

This example shows how to synchronize TIM peripherals in cascade mode with an external trigger. - - CubeMx

TIM_InputCapture

How to use the TIM peripheral to measure an external signal frequency. - - CubeMx

TIM_OCActive

Configuration of the TIM peripheral in Output Compare Active mode (when the counter matches the capture/compare register, the corresponding output pin is set to its active state). - - CubeMx

TIM_OCInactive

Configuration of the TIM peripheral in Output Compare Inactive mode with the corresponding Interrupt requests for each channel. - - CubeMx

TIM_OCToggle

Configuration of the TIM peripheral to generate four different signals at four different frequencies. - - CubeMx

TIM_PWMInput

How to use the TIM peripheral to measure the frequency and duty cycle of an external signal. - - CubeMx

TIM_PWMOutput

This example shows how to configure the TIM peripheral in PWM (Pulse Width Modulation) mode. CubeMx CubeMx CubeMx

UART

LPUART_WakeUpFromStop

Configuration of an LPUART to wake up the MCU from Stop mode when a given stimulus is received. CubeMx CubeMx CubeMx

UART_HyperTerminal_DMA

UART transmission (transmit/receive) in DMA mode between a board and an HyperTerminal PC application. - CubeMx -

UART_HyperTerminal_IT

UART transmission (transmit/receive) in Interrupt mode between a board and an HyperTerminal PC application. - CubeMx -

UART_Printf

Re-routing of the C library printf function to the UART. - CubeMx -

UART_ReceptionToIdle_CircularDMA

How to use the HAL UART API for reception to IDLE event in circular DMA mode. - - CubeMx

UART_Trace_TrustZone

How to use UART to define a secure trace communication path when TrustZone security is activated (Option bit TZEN=1). CubeMx TrustZone - -

UART_TwoBoards_ComDMA

UART transmission (transmit/receive) in DMA mode between two boards. - - CubeMx

UART_TwoBoards_ComIT

UART transmission (transmit/receive) in Interrupt mode between two boards. - - CubeMx

UART_TwoBoards_ComPolling

UART transmission (transmit/receive) in Polling mode between two boards. - - CubeMx

UART_WakeUpFromStopUsingFIFO

Configuration of an UART to wake up the MCU from Stop mode with a FIFO level when a given stimulus is received. CubeMx - CubeMx

USART

USART_SlaveMode

This example describes an USART-SPI communication (transmit/receive) between two boards where the USART is configured as a slave. CubeMx - CubeMx

WWDG

WWDG_Example

Configuration of the HAL API to periodically update the WWDG counter and simulate a software fault that generates an MCU WWDG reset when a predefined time period has elapsed. CubeMx CubeMx CubeMx
Total number of examples: 213 65 51 97

Examples_LL

ADC

ADC_AnalogWatchdog_Init

How to use an ADC peripheral with an ADC analog watchdog to monitor a channel and detect when the corresponding conversion data is outside the window thresholds. - - CubeMx

ADC_ContinuousConversion_TriggerSW

How to use an ADC peripheral to perform continuous ADC conversions on a channel, from a software start. - - X

ADC_ContinuousConversion_TriggerSW_Init

How to use an ADC peripheral to perform continuous ADC conversions on a channel, from a software start. - - CubeMx

ADC_ContinuousConversion_TriggerSW_LowPower_Init

How to use an ADC peripheral with ADC low-power features. - - CubeMx

ADC_SingleConversion_TriggerSW_DMA_Init

How to use an ADC peripheral to perform a single ADC conversion on a channel, at each software start. This example uses the DMA programming model (for polling or interrupt programming models, refer to other examples). - - CubeMx

ADC_SingleConversion_TriggerSW_IT_Init

How to use an ADC peripheral to perform a single ADC conversion on a channel, at each software start. This example uses the interrupt programming model (for polling or DMA programming models, please refer to other examples). - - CubeMx

ADC_SingleConversion_TriggerSW_Init

How to use an ADC peripheral to perform a single ADC conversion on a channel at each software start. This example uses the polling programming model (for interrupt or DMA programming models, please refer to other examples). - - CubeMx

ADC_SingleConversion_TriggerTimer_DMA_Init

How to use an ADC peripheral to perform a single ADC conversion on a channel at each trigger event from a timer. Converted data is indefinitely transferred by DMA into a table (circular mode). - - CubeMx

COMP

COMP_CompareGpioVsVrefInt_IT

How to use a comparator peripheral to compare a voltage level applied on a GPIO pin to the internal voltage reference (VREFINT), in interrupt mode. This example is based on the STM32L5xx COMP LL API. The peripheral initialization uses LL unitary service functions for optimization purposes (performance and size). - - CubeMx

COMP_CompareGpioVsVrefInt_IT_Init

How to use a comparator peripheral to compare a voltage level applied on a GPIO pin to the the internal voltage reference (VREFINT), in interrupt mode. This example is based on the STM32L5xx COMP LL API. The peripheral initialization uses the LL initialization function to demonstrate LL init usage. - - CubeMx

COMP_CompareGpioVsVrefInt_OutputGpio_Init

How to use a comparator peripheral to compare a voltage level applied on a GPIO pin to the internal voltage reference (VREFINT). The comparator output is connected to a GPIO. This example is based on the STM32L5xx COMP LL API. - - CubeMx

COMP_CompareGpioVsVrefInt_Window_IT_Init

How to use a pair of comparator peripherals to compare a voltage level applied on a GPIO pin to two thresholds: the internal voltage reference (VREFINT) and a fraction of the internal voltage reference (VREFINT/2), in interrupt mode. This example is based on the STM32L5xx COMP LL API. The peripheral initialization uses LL unitary service functions for optimization purposes (performance and size). - - CubeMx

CRC

CRC_CalculateAndCheck

How to configure the CRC calculation unit to compute a CRC code for a given data buffer, based on a fixed generator polynomial (default value 0x4C11DB7). The peripheral initialization is done using LL unitary service functions for optimization purposes (performance and size). - - CubeMx

CRC_UserDefinedPolynomial

How to configure and use the CRC calculation unit to compute an 8-bit CRC code for a given data buffer, based on a user-defined generating polynomial. The peripheral initialization is done using LL unitary service functions for optimization purposes (performance and size). - - CubeMx

DAC

DAC_GenerateConstantSignal_TriggerSW_Init

How to use the DAC peripheral to generate a constant voltage signal. This example is based on the STM32L5xx DAC LL API. The peripheral initialization uses LL unitary service functions for optimization purposes (performance and size). - - CubeMx

DAC_GenerateConstantSignal_TriggerSW_LP_Init

How to use the DAC peripheral to generate a constant voltage signal with the DAC low-power feature sample-and-hold. To be effective, a capacitor must be connected to the DAC channel output and the sample-and-hold timings must be tuned depending on the capacitor value. This example is based on the STM32L5xx DAC LL API. The peripheral initialization uses LL unitary service functions for optimization purposes (performance and size). - - CubeMx

DMA

DMA_CopyFromFlashToMemory

How to use a DMA channel to transfer a word data buffer from Flash memory to embedded SRAM. The peripheral initialization uses LL unitary service functions for optimization purposes (performance and size). - - X

DMA_CopyFromFlashToMemory_Init

How to use a DMA channel to transfer a word data buffer from Flash memory to embedded SRAM. The peripheral initialization uses LL initialization functions to demonstrate LL init usage. - - CubeMx

EXTI

EXTI_ToggleLedOnIT_Init

How to configure the EXTI and use GPIOs to toggle the user LEDs available on the board when a user button is pressed. This example is based on the STM32L5xx LL API. The peripheral initialization uses LL initialization functions to demonstrate LL init usage. - - CubeMx

GPIO

GPIO_InfiniteLedToggling

How to configure and use GPIOs to toggle the on-board user LEDs every 250 ms. This example is based on the STM32L5xx LL API. The peripheral is initialized with LL unitary service functions to optimize for performance and size. - - X

GPIO_InfiniteLedToggling_Init

How to configure and use GPIOs to toggle the on-board user LEDs every 250 ms. This example is based on the STM32L5xx LL API. The peripheral is initialized with LL initialization function to demonstrate LL init usage. - - CubeMx

I2C

I2C_OneBoard_Communication_PollingAndIT_Init

How to transmit data bytes from an I2C master device using polling mode to an I2C slave device using interrupt mode. The peripheral is initialized with LL unitary service functions to optimize for performance and size. - - CubeMx

I2C_TwoBoards_WakeUpFromStop_IT_Init

How to handle the reception of a data byte from an I2C slave device in Stop 1 mode by an I2C master device, both using interrupt mode. The peripheral is initialized with LL unitary service functions to optimize for performance and size. - - CubeMx

IWDG

IWDG_RefreshUntilUserEvent

How to configure the IWDG peripheral to ensure periodical counter update and generate an MCU IWDG reset when a User push-button is pressed. The peripheral is initialized with LL unitary service functions to optimize for performance and size. - - X

IWDG_RefreshUntilUserEvent_Init

How to configure the IWDG peripheral to ensure periodical counter update and generate an MCU IWDG reset when a User push-button is pressed. The peripheral is initialized with LL unitary service functions to optimize for performance and size. - - CubeMx

LPTIM

LPTIM_PulseCounter

How to use the LPTIM peripheral in counter mode to generate a PWM output signal and update its duty cycle. This example is based on the STM32L5xx LPTIM LL API. The peripheral is initialized with LL unitary service functions to optimize for performance and size. - - X

LPTIM_PulseCounter_Init

How to use the LPTIM peripheral in counter mode to generate a PWM output signal and update its duty cycle. This example is based on the STM32L5xx LPTIM LL API. The peripheral is initialized with LL initialization function to demonstrate LL init usage. - - CubeMx

LPUART

LPUART_WakeUpFromStop2_Init

Configuration of GPIO and LPUART peripherals to allow characters received on LPUART_RX pin to wake up the MCU from low-power mode. This example is based on the LPUART LL API. The peripheral initialization uses LL initialization function to demonstrate LL init usage. - - CubeMx

PKA

PKA_ECDSA_Sign

How to use the low-layer PKA API to generate an ECDSA signature. CubeMx - -

PKA_ModularExponentiation

How to use the low-layer PKA API to execute RSA modular exponentiation. CubeMx - -

PWR

PWR_EnterStandbyMode

How to enter the Standby mode and wake up from this mode by using an external reset or a wakeup interrupt. - - CubeMx

PWR_EnterStopMode

How to enter the Stop 1 mode. - - CubeMx

RCC

RCC_OutputSystemClockOnMCO

Configuration of MCO pin (PA8) to output the system clock. - - CubeMx

RCC_UseHSI_PLLasSystemClock

Modification of the PLL parameters in run time. - - CubeMx

RTC

RTC_Alarm

Configuration of the RTC LL API to configure and generate an alarm using the RTC peripheral. The peripheral initialization uses LL unitary service functions for optimization purposes (performance and size). - - X

RTC_ExitStandbyWithWakeUpTimer_Init

How to periodically enter and wake up from STANDBY mode thanks to the RTC Wake-Up Timer (WUT). - - CubeMx

RTC_TimeStamp_Init

Configuration of the Timestamp using the RTC LL API. The peripheral initialization uses LL unitary service functions for optimization purposes (performance and size). - - CubeMx

SPI

SPI_TwoBoards_FullDuplex_IT_Master_Init

Data buffer transmission and receptionvia SPI using Interrupt mode. This example is based on the STM32L5xx SPI LL API. The peripheral initialization uses LL unitary service functions for optimization purposes (performance and size). - - CubeMx

SPI_TwoBoards_FullDuplex_IT_Slave_Init

Data buffer transmission and receptionvia SPI using Interrupt mode. This example is based on the STM32L5xx SPI LL API. The peripheral initialization uses LL unitary service functions for optimization purposes (performance and size). - - CubeMx

TIM

TIM_BreakAndDeadtime

Configuration of the TIM peripheral to generate three center-aligned PWM and complementary PWM signals, insert a defined deadtime value, use the break feature, and lock the break and dead-time configuration. - - X

TIM_BreakAndDeadtime_Init

Configuration of the TIM peripheral to generate three center-aligned PWM and complementary PWM signals, insert a defined deadtime value, use the break feature, and lock the break and dead-time configuration. - - CubeMx

TIM_DMA

Use of the DMA with a timer update request to transfer data from memory to Timer Capture Compare Register 3 (TIMx_CCR3). This example is based on the STM32L5xx TIM LL API. The peripheral initialization uses LL unitary service functions for optimization purposes (performance and size). - - X

TIM_DMA_Init

Use of the DMA with a timer update request to transfer data from memory to Timer Capture Compare Register 3 (TIMx_CCR3). This example is based on the STM32L5xx TIM LL API. The peripheral initialization uses LL unitary service functions for optimization purposes (performance and size). - - CubeMx

TIM_InputCapture

Use of the TIM peripheral to measure a periodic signal frequency provided either by an external signal generator or by another timer instance. This example is based on the STM32L5xx TIM LL API. The peripheral initialization uses LL unitary service functions for optimization purposes (performance and size). - - X

TIM_InputCapture_Init

Use of the TIM peripheral to measure a periodic signal frequency provided either by an external signal generator or by another timer instance. This example is based on the STM32L5xx TIM LL API. The peripheral initialization uses LL unitary service functions for optimization purposes (performance and size). - - CubeMx

TIM_OnePulse_Init

Configuration of a timer to generate a positive pulse in Output Compare mode with a length of tPULSE and after a delay of tDELAY. This example is based on the STM32L5xx TIM LL API. The peripheral initialization uses LL initialization function to demonstrate LL Init. - - CubeMx

TIM_OutputCompare

Configuration of the TIM peripheral to generate an output waveform in different output compare modes. This example is based on the STM32L5xx TIM LL API. The peripheral initialization uses LL unitary service functions for optimization purposes (performance and size). - - X

TIM_OutputCompare_Init

Configuration of the TIM peripheral to generate an output waveform in different output compare modes. This example is based on the STM32L5xx TIM LL API. The peripheral initialization uses LL unitary service functions for optimization purposes (performance and size). - - CubeMx

TIM_PWMOutput

Use of a timer peripheral to generate a PWM output signal and update the PWM duty cycle. This example is based on the STM32L5xx TIM LL API. The peripheral initialization uses LL unitary service functions for optimization purposes (performance and size). - - X

TIM_PWMOutput_Init

Use of a timer peripheral to generate a PWM output signal and update the PWM duty cycle. This example is based on the STM32L5xx TIM LL API. The peripheral initialization uses LL initialization function to demonstrate LL Init. - - CubeMx

TIM_TimeBase

Configuration of the TIM peripheral to generate a timebase. This example is based on the STM32L5xx TIM LL API. The peripheral initialization uses LL unitary service functions for optimization purposes (performance and size). - - X

TIM_TimeBase_Init

Configuration of the TIM peripheral to generate a timebase. This example is based on the STM32L5xx TIM LL API. The peripheral initialization uses LL unitary service functions for optimization purposes (performance and size). - - CubeMx

USART

USART_Communication_Rx_IT

Configuration of GPIO and USART peripherals to receive characters from an HyperTerminal (PC) in Asynchronous mode using an interrupt. The peripheral initialization uses LL unitary service functions for optimization purposes (performance and size). - - X

USART_Communication_Rx_IT_Continuous_Init

This example shows how to configure GPIO and USART peripheral for continuously receiving characters from HyperTerminal (PC) in Asynchronous mode using Interrupt mode. Peripheral initialization is done using LL unitary services functions for optimization purpose (performance and size). - - CubeMx

USART_Communication_Rx_IT_Continuous_VCP_Init

This example shows how to configure GPIO and LPUART peripheral for continuously receiving characters from HyperTerminal (PC) in Asynchronous mode using Interrupt mode. Peripheral initialization is done using LL unitary services functions for optimization purpose (performance and size). - - CubeMx

USART_Communication_Rx_IT_Init

Configuration of GPIO and USART peripherals to receive characters from an HyperTerminal (PC) in Asynchronous mode using an interrupt. The peripheral initialization uses the LL initialization function to demonstrate LL init. - - X

USART_Communication_TxRx_DMA

Configuration of GPIO and USART peripherals to send characters asynchronously to/from an HyperTerminal (PC) in DMA mode. - - X

USART_Communication_TxRx_DMA_Init

This example shows how to configure GPIO and USART peripheral to send characters asynchronously to/from an HyperTerminal (PC) in DMA mode. This example is based on STM32L5xx USART LL API. Peripheral initialization is done using LL unitary services functions for optimization purpose (performance and size). - - CubeMx

USART_Communication_Tx_IT_Init

This example shows how to configure GPIO and USART peripheral to send characters asynchronously to HyperTerminal (PC) in Interrupt mode. This example is based on STM32L5xx USART LL API. Peripheral initialization is done using LL unitary services functions for optimization purpose (performance and size). - - CubeMx

USART_Communication_Tx_IT_VCP_Init

This example shows how to configure GPIO and LPUART peripheral to send characters asynchronously to HyperTerminal (PC) in Interrupt mode. This example is based on STM32L5xx LPUART LL API. Peripheral initialization is done using LL unitary services functions for optimization purpose (performance and size). - - CubeMx

USART_Communication_Tx_Init

This example shows how to configure GPIO and USART peripherals to send characters asynchronously to an HyperTerminal (PC) in Polling mode. If the transfer could not be completed within the allocated time, a timeout allows to exit from the sequence with a Timeout error code. This example is based on STM32L5xx USART LL API. Peripheral initialization is done using LL unitary services functions for optimization purpose (performance and size). - - CubeMx

USART_Communication_Tx_VCP_Init

This example shows how to configure GPIO and LPUART peripherals to send characters asynchronously to an HyperTerminal (PC) in Polling mode. If the transfer could not be completed within the allocated time, a timeout allows to exit from the sequence with a Timeout error code. This example is based on STM32L5xx LPUART LL API. Peripheral initialization is done using LL unitary services functions for optimization purpose (performance and size). - - CubeMx

USART_HardwareFlowControl_Init

Configuration of GPIO and peripheral to receive characters asynchronously from an HyperTerminal (PC) in Interrupt mode with the Hardware Flow Control feature enabled. This example is based on STM32L5xx USART LL API. The peripheral initialization uses LL unitary service functions for optimization purposes (performance and size). - - CubeMx

USART_SyncCommunication_FullDuplex_DMA_Init

Configuration of GPIO, USART, DMA and SPI peripherals to transmit bytes between a USART and an SPI (in slave mode) in DMA mode. This example is based on the STM32L5xx USART LL API. The peripheral initialization uses LL unitary service functions for optimization purposes (performance and size). - - CubeMx

USART_SyncCommunication_FullDuplex_IT_Init

Configuration of GPIO, USART, DMA and SPI peripherals to transmit bytes between a USART and an SPI (in slave mode) in Interrupt mode. This example is based on the STM32L5xx USART LL API (the SPI uses the DMA to receive/transmit characters sent from/received by the USART). The peripheral initialization uses LL unitary service functions for optimization purposes (performance and size). - - CubeMx

USART_WakeUpFromStop1_Init

Configuration of GPIO and USART3 peripherals to allow the characters received on USART_RX pin to wake up the MCU from low-power mode. - - CubeMx

UTILS

UTILS_ConfigureSystemClock

Use of UTILS LL API to configure the system clock using PLL with HSI as source clock. - - CubeMx

UTILS_ReadDeviceInfo

This example reads the UID, Device ID and Revision ID and saves them into a global information buffer. - - CubeMx

WWDG

WWDG_RefreshUntilUserEvent_Init

Configuration of the WWDG to periodically update the counter and generate an MCU WWDG reset when a user button is pressed. The peripheral initialization uses the LL unitary service functions for optimization purposes (performance and size). - - CubeMx
Total number of examples_ll: 69 2 0 67

Examples_MIX

ADC

ADC_SingleConversion_TriggerSW_IT

How to use the ADC to perform a single ADC channel conversion at each software start. This example uses the interrupt programming model (for polling and DMA programming models, please refer to other examples). It is based on the STM32L5xx ADC HAL and LL API. The LL API is used for performance improvement. - - CubeMx

CRC

CRC_PolynomialUpdate

How to use the CRC peripheral through the STM32L5xx CRC HAL and LL API. - - CubeMx

DMA

DMA_FLASHToRAM

How to use a DMA to transfer a word data buffer from Flash memory to embedded SRAM through the STM32L5xx DMA HAL and LL API. The LL API is used for performance improvement. - - CubeMx

PWR

PWR_STOP1

How to enter the STOP 1 mode and wake up from this mode by using external reset or wakeup interrupt (all the RCC function calls use RCC LL API for minimizing footprint and maximizing performance). - - CubeMx

SPI

SPI_FullDuplex_ComPolling_Master

Data buffer transmission/reception between two boards via SPI using Polling mode. - - CubeMx

SPI_FullDuplex_ComPolling_Slave

Data buffer transmission/reception between two boards via SPI using Polling mode. - - CubeMx

SPI_HalfDuplex_ComPollingIT_Master

Data buffer transmission/reception between two boards via SPI using Polling (LL driver) and Interrupt modes (HAL driver). - - CubeMx

SPI_HalfDuplex_ComPollingIT_Slave

Data buffer transmission/reception between two boards via SPI using Polling (LL driver) and Interrupt modes (HAL driver). - - CubeMx

TIM

TIM_PWMInput

Use of the TIM peripheral to measure an external signal frequency and duty cycle. - - CubeMx

UART

UART_HyperTerminal_IT

Use of a UART to transmit data (transmit/receive) between a board and an HyperTerminal PC application in Interrupt mode. This example describes how to use the USART peripheral through the STM32L5xx UART HAL and LL API, the LL API being used for performance improvement. - - CubeMx

UART_HyperTerminal_TxPolling_RxIT

Use of a UART to transmit data (transmit/receive) between a board and an HyperTerminal PC application both in Polling and Interrupt modes. This example describes how to use the USART peripheral through the STM32L5xx UART HAL and LL API, the LL API being used for performance improvement. - - CubeMx
Total number of examples_mix: 11 0 0 11

Applications

-

SBSFU

The SBSFU provides a Root of Trust solution including Secure Boot and Secure Firmware Update functionalities that is used before executing the application and provides an example of secure service (GPIO toggle) that is isolated from the non-secure application but can be used by the non-secure application at run-time. - - X TrustZone

TFM

The TFM provides a Root of Trust solution including Secure Boot and Secure Firmware Update functionalities that is used before executing the application and provides TFM secure services that are isolated form the non-secure application but can be used by the non-secure application at run-time. X TrustZone - -

BLE

HeartRate

This application shows how to use BLE component for HeartRate profile application. X - -

FatFs

FatFs_MultiDrives

How to use STM32Cube firmware with FatFs middleware component as a generic FAT file system module. This example develops an application that exploits FatFs features, with multidrive (SRAM, uSD) configurations. - X -

FatFs_RAMDisk

This application provides a description on how to use STM32Cube firmware with FatFs middleware component as a generic FAT file system module, in order to develop an application exploiting FatFs offered features with RAM disk (SRAM) drive configuration. - X X

FatFs_RAMDisk_RTOS

This application provides a description on how to use STM32Cube firmware with FatFs middleware component as a generic FAT file system module. This example develops an application exploiting FatFs features with a RAM disk (SRAM) drive in RTOS mode configuration. - X -

FatFs_uSD_DMA

How to use STM32Cube firmware with FatFs middleware component as a generic FAT file system module. This example develops an application that exploits FatFs features to configure a microSD drive. - X -

FatFs_uSD_RTOS

This application provides a description on how to use STM32Cube firmware with FatFs middleware component as a generic FAT file system module, in order to develop an application exploiting FatFs offered features with uSD disk drive configuration. - X -

FatFs_uSD_Standalone

How to use STM32Cube firmware with FatFs middleware component as a generic FAT file system module. This example develops an application that exploits FatFs features to configure a microSD drive. X X -

FatFs_uSD_TrustZone

How to use FatFs stack with enabled TrustZone feature (TZEN=1). X TrustZone X TrustZone -

FreeRTOS

FreeRTOS_MPU

How to use the MPU feature of FreeRTOS. - X X

FreeRTOS_Mutexes

How to use mutexes with CMSIS RTOS API. CubeMx CubeMx CubeMx

FreeRTOS_Queues

How to use message queues with CMSIS RTOS API. - - CubeMx

FreeRTOS_SecureIOToggle_TrustZone

How to use FreeRTOS when the TrustZone feature is enabled (TZEN=1). CubeMx TrustZone CubeMx TrustZone CubeMx TrustZone

FreeRTOS_Semaphore

How to use semaphores with CMSIS RTOS API. - - CubeMx

FreeRTOS_SemaphoreFromISR

How to use semaphore from ISR with CMSIS RTOS API. - - CubeMx

FreeRTOS_ThreadCreation

How to implement thread creation using CMSIS RTOS API. CubeMx CubeMx CubeMx

FreeRTOS_Timers

How to use timers of CMSIS RTOS API. CubeMx CubeMx CubeMx

TouchSensing

TouchSensing_1touchkey

Use of the STMTouch driver with 1 touchkey sensor. - X -

USB-PD

USB-PD_Consumer_1port

How to create a simple type C Consumer. CubeMx CubeMx CubeMx

USB_Device

AUDIO_Standalone

This application shows how to use the implementation of the audio streaming (Out: Speaker/Headset) capability on the STM32L5xx devices. - CubeMx -

CDC_Standalone

This application describes how to use USB device application based on the Device Communication Class (CDC) following the PSTN sub-protocol on the STM32L5xx devices. CubeMx CubeMx CubeMx

CustomHID_Standalone

This application shows how to use the USB device application based on the Custom HID Class on the STM32L5xx devices. - CubeMx -

DFU_Standalone

Compliant implementation of the Device Firmware Upgrade (DFU) capability to program the embedded Flash memory through the USB peripheral. CubeMx CubeMx CubeMx

HID_Standalone

Use of the USB device application based on the Human Interface (HID). CubeMx CubeMx CubeMx

MSC_Standalone

This application shows how to use the USB device application based on the Mass Storage Class (MSC) on the STM32L5xx devices. CubeMx CubeMx -

mbedTLS

Crypto_Selftest

This application implements on STM32L562E-DK board a set of cryptographic features through mbed TLS selftest functions of individual mbed TLS components selectively chosen in a single configuration file "mbedtls_config.h". CubeMx - -
Total number of applications: 48 14 20 14

Demonstrations

-

Demo

The STM32Cube demonstration platform comes on top of the STM32Cube as a firmware package that offers a full set of software components based on a modular architecture. The STM32Cube demonstration platform is built around basic UI or TouchGFX graphical interface. It is based on the STM32Cube HAL, BSP and several middleware components. X X -
Total number of demonstrations: 2 1 1 0
Total number of projects: 352 85 75 192