STM32CubeF0 MCU Firmware Package

repository·master·Indexed 41 days ago

https://github.com/stmicroelectronics/stm32cubef0

A comprehensive embedded software platform for the STM32F0 series. It includes CMSIS modules, HAL/LL drivers, Board Support Package (BSP) drivers, middleware libraries (RTOS, USB, FatFS), and various software projects, examples, and demonstrations.

Tokens
196.8K
Snippets
173
Records
976
Agent score
49%

What's inside STM32CubeF0

  1. Overview of USB Device Mass Storage (MSC) Standalone Example

    master

    This application demonstrates how to use the STM32F0xx USB Device peripheral to implement a Mass Storage Class (MSC) device. The STM32 MCU acts as a removable drive, communicating with a PC Host using Bulk Only Transfer (BOT) and SCSI transparent commands. In this specific implementation, a microSD card is used as the storage media.

    When the application is running, plugging the USB cable into a PC host will cause the device to be automatically detected as a new removable drive, allowing standard read, write, and format operations.

  2. Overview of STM32CubeF0 MCU Firmware Package

    master

    The STM32CubeF0 MCU Package is a comprehensive embedded software platform designed for the STM32F0 series. It provides a standardized set of tools to reduce development effort, including:

    • CMSIS modules: Core and device modules for the ARM core.
    • HAL-LL drivers: Hardware Abstraction Layer (HAL) and Low-Layer (LL) drivers for portability across the STM32 portfolio.
    • BSP drivers: Board Support Package drivers for specific evaluation, demonstration, or Nucleo boards.
    • Middleware libraries: Standard libraries such as RTOS, USB, FatFS, graphics, and touch sensing.
    • Software projects: A collection of basic examples, applications, and demonstrations organized by board in the Projects/*Board name* directories.

    Note on Restricted Middleware: Due to restrictive licensing, the ./Middlewares/ST/STemWin library and associated projects are not included in this GitHub repository. To access them, you must download the full firmware package from the official st.com website.

  3. Overview of USB Device CDC Standalone Example

    master

    The USB Device CDC Standalone application implements a USB-to-RS232 bridge using the Device Communication Class (CDC) and the PSTN subprotocol. The STM32 MCU acts as a Virtual COM Port (VCP), where:

    • Data is exchanged with a PC host via the USB interface (Device mode).
    • Data is exchanged with other devices via the UART interface (RS232).

    Key features include:

    • Full-duplex communication: UART receiving is handled by interrupts, while UART transmitting is handled by DMA.
    • Configurable USB Clock: The 48 MHz USB clock can be sourced from the PLL (via HSE) or the internal HSI48 oscillator with Clock Recovery System (CRS) trimming.
    • Standard COM Port Emulation: Supports standard baudrate, data format, parity, and stop bit configurations (Note: 7-bit data length with no parity is NOT supported).
  4. Overview of STM32091C_EVAL Demonstration

    master

    The STM32091C_EVAL demonstration is a firmware package based on STM32Cube designed to help developers discover STM32 Cortex-M devices connected to an STM32 EVAL board.

    Key features included in this demonstration:

    • 8uarts application: Uses the 8 available UARTs to transfer buffers via packets.
    • File browser: An application to browse files on an SD card.
    • Image browser: Displays .bmp pictures stored on the SD card (specifically in the \USER directory).
    • Low power: Demonstrates entering low power modes (Stop and Standby) with wakeups triggered by EXTI or an alarm.
    • Thermometer: Displays temperature readings using an STLM75 sensor.
  5. Overview of STM32F091RC-Nucleo RevC Demonstration

    master

    This demonstration firmware is designed to help users discover STM32 Cortex-M devices using an STM32 Nucleo board. It features two primary modes of operation based on the presence of an Adafruit 1.8" TFT shield.

    Hardware Requirements

    • Target Device: STM32F091xC devices.
    • Development Board: STM32F091RC-Nucleo RevC.
    • Display: Adafruit 1.8" TFT shield connected to CN5, CN6, CN8, and CN9 Arduino connectors.
    • Storage: A microSD card (up to 4GB capacity) formatted with FAT.

    Operation Modes

    1. Without TFT Shield: The system detects the absence of the shield by checking pin PB.00. In this mode, LED2 toggles at different frequencies (~1Hz, ~5Hz, or ~10Hz) depending on whether the User button is pressed.
    2. With TFT Shield: The system detects the shield via PB.00. LED2 remains ON (as it shares a pin with SPI CLK). A menu is displayed on the TFT allowing users to switch between:
      • Manual Mode: Navigate through images on the SD card using the Joystick (LEFT/RIGHT). Use a long press (~1s) on Joystick SEL to return to Automatic Mode.
      • Automatic Mode: Images on the SD card are displayed sequentially in a continuous loop.
  6. Overview of FatFs with uSD card drive example

    master

    This application demonstrates how to use the STM32Cube firmware with the FatFs middleware component as a generic FAT file system module. It specifically utilizes a microSD drive configuration to perform file operations.

    Core Workflow:

    1. Initialization: The program calls HAL_Init() to reset peripherals and initialize Flash/SysTick, followed by SystemClock_Config() to set the system clock (SYSCLK) to 48 MHz.
    2. File Operations: The application performs a sequence of FatFs API calls to write and read a text file:
      • Link the uSD disk I/O driver.
      • Mount the file system object.
      • Format the uSD drive (create FAT file system).
      • Create and open a new text file with write access.
      • Write data to the file.
      • Close the file.
      • Open the file with read access.
      • Read data back.
      • Close the file.
      • Unlink the uSD disk I/O driver.

    Status Monitoring via LEDs (STM32091C-EVAL):

    • LED1 ON: Example running successfully.
    • LED3 ON: An error occurred.
  7. Overview of the USB HID Standalone Example

    master

    This application demonstrates how to use the USB peripheral in Device mode using the Human Interface Device (HID) class V1.11. It follows the standard HID device class definition.

    Key Features:

    • Remote Wakeup: Supports bringing a suspended USB bus back to an active state. In this specific example, the onboard Tamper button is used as the remote wakeup source.
    • Mouse Emulation: The application emulates a mouse. The GetPointerData() function is responsible for moving the mouse cursor, which is triggered by the Tamper button on the board.

    Hardware Requirements:

    • Target Device: STM32F072VB.
    • Recommended Board: STM32072B-EVAL RevB.
    • Connection: Connect the board to a PC using a 'USB A-Male to A-Male' cable via the CN4 connector.
  8. Overview of the FreeRTOS Mail Example

    master

    The FreeRTOS Mail example demonstrates how to use mail queues via the CMSIS RTOS API. It implements a producer-consumer pattern using two threads:

    1. Producer Thread: Allocates mail (a structure containing var1 (uint32), var2 (uint32), and var3 (uint8)) and puts it on a mail queue.
    2. Consumer Thread: A higher-priority thread that blocks on the mail queue. When mail is posted, the consumer preempts the producer, retrieves the mail, and frees it.

    The mail queue in this example is configured with a capacity of one item.

    Hardware Requirements:

    • Target Device: STM32F091xC
    • Recommended Board: STM32091C-EVAL
  9. Overview of FreeRTOS Thread Creation example

    master

    This example demonstrates how to implement thread creation using the CMSIS RTOS API. It specifically showcases thread lifecycle management (suspending and resuming threads) and periodic execution.

    Behavioral Logic:

    • Creates two threads with equal priority executing in a 15-second cycle.
    • 0-5s: Thread 1 toggles LED1 every 200ms; Thread 2 toggles LED2 every 500ms.
    • 5-10s: Thread 1 suspends itself; Thread 2 continues toggling LED2.
    • 10-15s: Thread 2 resumes Thread 1 and then suspends itself; Thread 1 toggles LED1 every 500ms.
  10. Overview of STM32F070RB-Nucleo RevC Demonstration

    master

    This demonstration firmware is designed to help users discover STM32 Cortex-M devices using an STM32 Nucleo board. It features two primary modes of operation based on the presence of an Adafruit 1.8" TFT shield.

    Hardware Requirements

    • Target Device: STM32F070xB
    • Development Board: STM32F070RB-Nucleo RevC
    • TFT Shield: Adafruit 1.8" TFT shield (connected via CN5, CN6, CN8, and CN9 Arduino connectors).
    • Storage: A microSD card (up to 4GB capacity) formatted with FAT.

    Operational Modes

    1. Without Adafruit 1.8" TFT Shield

    The system detects the absence of the shield by checking the state of the PB.00 pin (mapped to the Joystick). In this mode, the LED2 toggles to indicate status:

    • Default: Toggling at ~1Hz.
    • User Button Press 1: Toggling at ~5Hz.
    • User Button Press 2: Toggling at ~10Hz.

    2. With Adafruit 1.8" TFT Shield

    The system detects the shield via the PB.00 pin. LED2 is turned ON (as it shares a pin with the SPI CLK signal). A menu is displayed on the TFT, allowing for two modes:

    • Manual Mode: Users can navigate images stored on the SD card using the Joystick (RIGHT for next, LEFT for previous). A long press (~1s) of the SEL button switches back to Automatic Mode.
    • Automatic Mode: Images on the SD card are displayed sequentially in a continuous loop.
  11. Overview of the FreeRTOS Queues example

    master

    This example demonstrates how to use message queues using the CMSIS RTOS API on STM32F0 devices. It implements a producer-consumer pattern with two threads:

    1. Producer Thread: Sends an incrementing number to a queue every 1 second.
    2. Consumer Thread: A higher-priority thread that blocks on queue reads. When the producer posts a message, the consumer unblocks, preempts the producer, and removes the item from the queue.

    The queue is configured with a capacity of only one item.

    Monitoring the example:

    • LiveWatch Variables: Monitor ProducerValue and ConsumerValue (these should remain equal).
    • LED Status (STM32072B-EVAL RevB):
      • LED1: Toggles every 1 second when the producer posts a message.
      • LED3: Toggles when an error occurs.
  12. Overview of the TIM OnePulse Example

    master

    This example demonstrates how to configure a timer to generate a single positive pulse in Output Compare mode. The pulse has a specific length (tPULSE) and occurs after a specific delay (tDELAY). The timer counter automatically stops at the next update event (UEV). This implementation uses the STM32F0xx Low-Layer (LL) API for optimized performance and code size.

    Key Behaviors

    • TIM1 Configuration: Generates a 50 $\mu$s pulse after a 50 $\mu$s delay. The counter is started by a user push-button. The delay and pulse length can be monitored via the debugger using the variables uwMeasuredDelay and uwMeasuredPulseLength.
    • TIM2 Configuration: Generates a 3 s pulse after a 2 s delay. The counter start is controlled via the slave mode controller, triggered by a rising edge on the TI2FP2 signal. The output is mapped to pin PA.05 (connected to LED2 on the STM32F072RB-Nucleo board).