STM32CubeC0 Firmware Examples for STM32C0xx Series

The STM32CubeC0 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_C0_VX.Y.Z\Projects\, and all of them 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_C0 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.

Level Module Name Project Name Description STM32C0316-DK STM32C0116-DK NUCLEO-C071RB NUCLEO-C031C6

Templates

-

Starter project

This projects provides a reference template that can be used to build any firmware application. CubeMx CubeMx CubeMx CubeMx
Total number of templates: 4 1 1 1 1

Templates_Board

-

Starter project

This project provides a reference template for the NUCLEO-C071RB board based on the STM32Cube HAL API and the BSP drivers that can be used to build any firmware application. - - CubeMx -
Total number of templates_board: 1 0 0 1 0

Templates_LL

-

Starter project

This projects provides a reference template through the LL API that can be used to build any firmware application. CubeMx CubeMx CubeMx CubeMx
Total number of templates_ll: 4 1 1 1 1

Examples

ADC

ADC_MultiChannelSingleConversion

How to use an ADC peripheral to convert several channels. ADC conversions are performed successively in a scan sequence. - - - CubeMx

CORTEX

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 -

CORTEXM_SysTick

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

CRC

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 -

FLASH

FLASH_EraseProgram

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

GPIO

GPIO_EXTI

How to configure external interrupt lines. CubeMx CubeMx CubeMx CubeMx

GPIO_IOToggle

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

HAL

HAL_TimeBase

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

HAL_TimeBase_TIM

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

I2C

I2C_TwoBoards_AdvComIT

How to handle several I2C data buffer transmission/reception between a master and a slave device using an interrupt. - - - CubeMx

I2C_TwoBoards_ComDMA

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

PWR

PWR_SLEEP

How to enter the Sleep mode and wake up from this mode by using an interrupt. CubeMx CubeMx 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 CubeMx CubeMx

PWR_STOP

This example shows how to enter Stop mode and wake up from this mode using an interrupt. - - CubeMx -

RCC

RCC_ClockConfig

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

RCC_LSEConfig

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

RTC

RTC_Calendar

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

RTC_TimeStamp

Configuration of the RTC HAL API to demonstrate the timestamp feature. - CubeMx 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

UART

UART_Printf

Re-routing of the C library printf function to the UART. - - CubeMx CubeMx
Total number of examples: 43 8 8 11 16

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 CubeMx

ADC_ContinuousConversion_TriggerSW_Init

How to use an ADC peripheral to convert a single channel continuously, from a software start. - - CubeMx CubeMx

ADC_MultiChannelSingleConversion_Init

How to use an ADC peripheral to convert several channels. ADC conversions are performed successively in a scan sequence. - - CubeMx -

ADC_Oversampling_Init

How to use an ADC peripheral with oversampling. - - CubeMx 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. Converted data is transferred by DMA into a table in RAM memory. - - CubeMx CubeMx

ADC_SingleConversion_TriggerSW_IT_Init

How to use ADC to convert a single channel at each SW start, conversion performed using programming model: interrupt. - - CubeMx CubeMx

ADC_SingleConversion_TriggerSW_Init

How to use ADC to convert a single channel at each SW start, conversion performed using programming model: polling. - - CubeMx 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 transferred by DMA into a table in RAM memory. - - CubeMx CubeMx

CORTEX

CORTEX_MPU

Presentation of the MPU feature. This example configures a memory area as privileged read-only, and attempts to perform read and write operations in different modes. - - - 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 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 CubeMx

DMA

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 CubeMx CubeMx CubeMx

EXTI

EXTI_ToggleLedOnIT_Init

This example describes how to configure the EXTI and use GPIOs to toggle the user LEDs available on the board when a Joystick Selection push-button is pressed. This example is based on the STM32C0xx LL API. Peripheral initialization is done using LL initialization function to demonstrate LL init usage. CubeMx CubeMx CubeMx CubeMx

GPIO

GPIO_InfiniteLedToggling_Init

How to configure and use GPIOs to toggle the on-board user LEDs every 250 ms. CubeMx CubeMx CubeMx CubeMx

I2C

I2C_OneBoard_AdvCommunication_DMAAndIT_Init

How to exchange data between an I2C master device in DMA mode and an I2C slave device in interrupt mode. The peripheral is initialized with LL unitary service functions to optimize for performance and size. - - CubeMx -

I2C_OneBoard_Communication_DMAAndIT_Init

How to transmit data bytes from an I2C master device using DMA 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_OneBoard_Communication_IT_Init

How to handle the reception of one data byte from an I2C slave device by an I2C master device. Both devices operate in interrupt mode. The peripheral is initialized with LL initialization function to demonstrate LL init usage. - - CubeMx -

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_MasterRx_SlaveTx_IT_Init

How to handle the reception of one data byte from an I2C slave device by an I2C master device. Both devices operate in interrupt mode. The peripheral is initialized with LL unitary service functions to optimize for performance and size. - - CubeMx CubeMx

I2C_TwoBoards_MasterTx_SlaveRx_DMA_Init

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

I2C_TwoBoards_MasterTx_SlaveRx_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 CubeMx

I2C_TwoBoards_WakeUpFromStop_IT_Init

How to handle the reception of a data byte from an I2C slave device in Stop0 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 CubeMx

IWDG

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 CubeMx

PWR

PWR_EnterStandbyMode

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

PWR_EnterStopMode

How to enter the Stop 0 mode. CubeMx CubeMx CubeMx CubeMx

RCC

RCC_OutputSystemClockOnMCO

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

RTC

RTC_Alarm_Init

Configuration of the RTC LL API to configure and generate an alarm using the RTC peripheral. The peripheral initialization uses the LL initialization function. CubeMx CubeMx - 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 - CubeMx

SPI

SPI_OneBoard_HalfDuplex_DMA_Init

Configuration of GPIO and SPI peripherals to transmit bytes from an SPI Master device to an SPI Slave device in DMA mode. This example is based on the STM32C0xx SPI LL API. The peripheral initialization uses the LL initialization function to demonstrate LL init usage. - - CubeMx -

SPI_OneBoard_HalfDuplex_IT_Init

Configuration of GPIO and SPI peripherals to transmit bytes from an SPI Master device to an SPI Slave device in Interrupt mode. This example is based on the STM32C0xx SPI LL API. The peripheral initialization uses LL unitary service functions for optimization purposes (performance and size). - - CubeMx -

SPI_TwoBoards_FullDuplex_IT_Master_Init

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

SPI_TwoBoards_FullDuplex_IT_Slave_Init

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

TIM

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 STM32C0xx TIM LL API. The peripheral initialization uses LL unitary service functions for optimization purposes (performance and size). - - CubeMx CubeMx

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 STM32C0xx TIM LL API. The peripheral initialization uses LL unitary service functions for optimization purposes (performance and size). - - CubeMx 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 STM32C0xx TIM LL API. The peripheral initialization uses LL initialization function to demonstrate LL Init. - - CubeMx -

TIM_OutputCompare_Init

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

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 STM32C0xx TIM LL API. The peripheral initialization uses LL initialization function to demonstrate LL Init. - - CubeMx CubeMx

TIM_TimeBase_Init

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

USART

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 CubeMx

USART_Communication_Rx_IT_Continuous_VCP_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_Init

This example shows how to configure GPIO and USART peripheral for receiving characters from HyperTerminal (PC) in Asynchronous mode using Interrupt mode. Peripheral initialization is done using LL initialization function to demonstrate LL init usage. - - CubeMx CubeMx

USART_Communication_Rx_IT_VCP_Init

This example shows how to configure GPIO and USART peripheral for receiving characters from HyperTerminal (PC) in Asynchronous mode using Interrupt mode. Peripheral initialization is done using LL initialization function to demonstrate LL init usage. - - - CubeMx

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 STM32C0xx USART LL API. Peripheral initialization is done using LL unitary services functions for optimization purpose (performance and size). - - CubeMx 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 STM32C0xx USART LL API. Peripheral initialization is done using LL unitary services functions for optimization purpose (performance and size). - - CubeMx CubeMx

USART_Communication_Tx_IT_VCP_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 STM32C0xx USART LL API. Peripheral initialization is done using LL unitary services functions for optimization purpose (performance and size). - - CubeMx 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 STM32C0xx USART LL API. Peripheral initialization is done using LL unitary services functions for optimization purpose (performance and size). - - CubeMx CubeMx

USART_Communication_Tx_VCP_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 STM32C0xx USART 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 STM32C0xx USART LL API. The peripheral initialization uses LL unitary service functions for optimization purposes (performance and size). - - CubeMx 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 STM32C0xx 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 STM32C0xx 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 CubeMx

USART_WakeUpFromStop_Init

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

UTILS

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 CubeMx
Total number of examples_ll: 104 7 8 46 43

Examples_MIX

ADC

ADC_SingleConversion_TriggerSW_IT

How to use ADC to convert a single channel at each SW start, conversion performed using programming model: interrupt. - - - CubeMx

CRC

CRC_PolynomialUpdate

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

DMA

DMA_FLASHToRAM

How to use a DMA to transfer a word data buffer from Flash memory to embedded SRAM through the STM32C0xx DMA HAL and LL API. The LL API is used for performance improvement. - - - 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

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 STM32C0xx 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 STM32C0xx UART HAL and LL API, the LL API being used for performance improvement. - - - CubeMx
Total number of examples_mix: 9 0 0 1 8

Applications

-

OpenBootloader

This application exploits OpenBootloader Middleware to demonstrate how to develop an IAP application and how use it. - - - X

FileX

Fx_File_Edit_Standalone

This application provides an example of FileX stack usage on NUCLEO-C071RB board, running in standalone mode (without ThreadX). It demonstrates how to create a Fat File system on the internal SRAM memory using FileX. - - CubeMx -

Fx_SRAM_File_Edit_Standalone

This application provides an example of FileX stack usage on NUCLEO-C031C6 board, running in standalone mode (without ThreadX). It demonstrates how to create a Fat File system on the internal SRAM memory using FileX. - - - CubeMx

ROT

OEMiSB_Appli

This project provides a OEMiSB boot path application example. Boot is performed through OEMiSB boot path after integrity checks of the project firmware image. - - X -

OEMiSB_Boot

This project provides an OEMiSB example. OEMiSB boot path performs authenticity checks of the project firmware image. - - X -

ThreadX

Tx_CMSIS_Wrapper

This application provides an example of CMSIS RTOS adaptation layer for Azure RTOS ThreadX, it shows how to develop an application using the CMSIS RTOS 2 APIs. X - - -

Tx_FreeRTOS_Wrapper

This application provides an example of Azure RTOS ThreadX stack usage, it shows how to develop an application using the FreeRTOS adaptation layer for ThreadX. - X - -

Tx_LowPower

This application provides an example of Azure RTOS ThreadX stack usage, it shows how to develop an application using ThreadX LowPower feature. - - CubeMx CubeMx

Tx_MPU

This application provides an example of Azure RTOS ThreadX stack usage, it shows how to develop an application using the ThreadX Module feature. - - X -

Tx_Thread_Creation

This application provides an example of Azure RTOS ThreadX stack usage, it shows how to develop an application using the ThreadX thread management APIs. CubeMx - CubeMx -

Tx_Thread_MsgQueue

This application provides an example of Azure RTOS ThreadX stack usage, it shows how to develop an application using the ThreadX message queue APIs. - - CubeMx CubeMx

Tx_Thread_Sync

This application provides an example of Azure RTOS ThreadX stack usage, it shows how to develop an application using the ThreadX synchronization APIs. CubeMx - CubeMx -

USBX

Ux_Device_CDC_ACM

This application provides an example of Azure RTOS USBX stack usage on NUCLEO-C071RB board, it shows how to develop USB Device communication Class "CDC_ACM" based application. - - CubeMx -

Ux_Device_HID

This application provides an example of Azure RTOS USBX stack usage on NUCLEO-C071RB board, it shows how to develop USB Device Human Interface "HID" mouse based application. - - CubeMx -

Ux_Device_HID_CDC_ACM

This application provides an example of Azure RTOS USBX stack usage on NUCLEO-C071RB board, it shows how to develop a composite USB device communication class "HID" and "CDC_ACM" based application. - - CubeMx -

Ux_Device_HID_Standalone

This application provides an example of Azure RTOS USBX stack usage on NUCLEO-C071RB board, it shows how to develop USB Device Human Interface "HID" mouse based bare metal application. - - CubeMx -

Ux_Host_CDC_ACM

This application provides an example of Azure RTOS USBX stack usage . - - CubeMx -

Ux_Host_HID_Standalone

This application provides an example of Azure RTOS USBX stack usage . - - CubeMx -
Total number of applications: 22 3 1 14 4
Total number of projects: 187 20 19 75 73