STM32CubeF4 Embedded Software Platform

repository·master·Indexed 23 days ago

https://github.com/stmicroelectronics/stm32cubef4

A comprehensive embedded software platform for STM32F4 series microcontrollers. It includes HAL/LL drivers, CMSIS modules (including CMSIS-DSP and CMSIS-NN), middleware, and board-specific software projects. The repository provides optimized Neon functions for CMSIS-DSP and supports both Legacy and TFL Micro Compliant APIs for CMSIS-NN. Note that certain middleware like STM32_Audio, STemWin, and TouchGFX are excluded due to licensing and must be downloaded from the official ST website.

Tokens
176K
Snippets
82
Records
1K
Agent score
77%

What's inside STM32CubeF4

  1. Overview of USB Host Mass Storage (MSC) RTOS Application

    master

    This application demonstrates how to implement a USB Host Mass Storage Class (MSC) using an STM32F412xG device in an RTOS-enabled configuration. It utilizes the USB OTG Host peripheral to interact with USB flash disks using Bulk Only Transfer (BOT) and SCSI commands, integrated with the FatFs middleware for file system operations.

    Key features include:

    • Device Enumeration: Automatically detects connected USB flash disks and extracts metadata (VID, PID, Manufacturer, Serial Number, Product Name).
    • File Operations: Ability to write small text files and explore disk content.
    • RTOS Integration: Built around FreeRTOS and the CMSIS-OS abstraction layer.
    • User Interface: Uses an LCD screen (via Adafruit 1.8" TFT shield) and a joystick to navigate menus and display disk contents.
  2. What is the Templates_LL project?

    master

    The Templates_LL project is a reference template designed to help developers build firmware applications using the Low-Layer (LL) API. It provides a foundational project structure for the STM32F469xx device, specifically tested on the STM32F469I-DISCO RevB board.

    Included features:

    • LL Driver Inclusion: All LL drivers are included via main.h and source files. In IDE environments, ensure the option USE_FULL_LL_DRIVER is enabled.
    • Hardware Definitions: Definitions for LEDs and the user button are provided in main.h.
    • Clock Configuration: Initial clock setup is provided in main.c via the SystemClock_Config() function.

    Note on Optimization: To optimize the final binary, you can manually remove unused LL drivers after initial development.

  3. Overview of the Camera to USB Disk application

    master

    This application demonstrates how to interface a camera module via the Digital Camera Interface (DCMI) to display images continuously on an LCD and save captured images to a USB device.

    Key Features:

    • DCMI Interface: Configured to receive captures from a camera module (specifically tested with the STM32446E-EVAL board).
    • DMA Transfer: Uses DMA2 Stream1 channel1 to transfer picture data from the DCMI peripheral to external RAM, which serves as the LCD frame buffer.
    • Resolution: Both the camera module and the LCD are configured for QVGA image resolution.
    • USB Storage: When the tamper button is pressed, the current image is saved to a USB disk.

    Status Indicators:

    • LED1: Turns ON to indicate the end of a saving operation.
    • LCD Messages: Displays notifications at the beginning and end of the saving process.
    • LED3: Turns ON if any error occurs.
  4. Overview of the LCD DSI Images Slider application

    master

    The LCD DSI Images Slider application demonstrates the capabilities of the Display Serial Interface (DSI) peripheral by displaying high-resolution images (800x480). It utilizes Tearing Effect and Partial refresh features to allow rapid, user-triggered updates to specific LCD regions.

    Key Features:

    • Image Transition: Moving a finger on the Touch Screen (TS) causes a new image to progressively appear while the old one disappears.
    • Draw Modes: Supports both HORIZONTAL_DRAW (default) and VERTICAL_DRAW modes.
      • In HORIZONTAL_DRAW, sliding left/right changes images.
      • In VERTICAL_DRAW, sliding up/down changes images.
    • Mode Switching: The user can toggle between draw modes by pressing the Tamper button.
    • Hardware Initialization: The application initializes QuadSPI to load images, followed by the Touch Screen (TS) and LCD DSI.
  5. Overview of STM32CubeF4 components

    master

    The STM32CubeF4 MCU Package provides a comprehensive embedded software platform for the STM32F4 series, including:

    • CMSIS modules: Core and device modules for the ARM core.
    • STM32 HAL-LL drivers: Abstraction layers for maximized portability.
    • BSP drivers: Board Support Package drivers for supported evaluation, demonstration, or Nucleo boards.
    • Middleware libraries: RTOS, USB, FatFS, graphics, touch sensing, etc.
    • Software projects: Applications, demonstrations, and basic examples located in Projects/*Board name* directories.
  6. Overview of USB Host AUDIO Standalone Application

    master

    This application demonstrates how to use the USB Host Audio OUT class on STM32F4xx devices. The STM32 MCU acts as a USB Audio Host, enumerating connected USB headset devices and extracting metadata such as VID, PID, manufacturer name, Serial number, and product name.

    Key Features:

    • Device Enumeration: Automatically detects and initializes connected USB headsets.
    • File Exploration: Searches for .Wav files on a connected uSD card using the FatFs file system.
    • Audio Playback: Plays uncompressed WAV files from the uSD card using a circular buffer.
    • User Interface: A menu system controlled via Joystick buttons allows for file exploration, starting playback, and re-enumerating the device.
    • Volume Control: Supports volume adjustment during playback.

    Note: This application does not support compressed WAV formats. For detailed information on the underlying library, refer to UM1720 "STM32Cube USB Host library".

  7. Overview of FatFs with uSD card drive application

    master

    This application demonstrates how to use the STM32Cube firmware with the FatFs middleware component as a generic FAT file system module. It specifically exploits FatFs features using a microSD drive configuration on an STM32F412ZG device.

    The application workflow follows these steps:

    1. Link the uSD disk I/O driver.
    2. Mount the file system object to the FatFs module.
    3. Format the uSD drive to create a FAT file system.
    4. Create and open a new text file with write access.
    5. Write data to the file.
    6. Close the file.
    7. Re-open the file with read access.
    8. Read the data back and verify it.
    9. Close the file.
    10. Unlink the uSD disk I/O driver.

    Status Monitoring (NUCLEO-F412ZG Rev B):

    • LED2 ON: Application running successfully.
    • LED3 ON: An error occurred.
  8. Overview of the LTDC Paint Application

    master

    The LTDC Paint application demonstrates how to configure an LCD touchscreen, handle touch zone actions, and save BMP pictures to a USB Disk.

    Key Features:

    • LCD & Touchscreen: Configures the LTDC (LCD-TFT Display Controller) and initializes the touchscreen with a calibration step for improved accuracy.
    • Drawing Interface: Provides a menu with a color palette, brush size selection, a working rectangle for drawing, and icons for 'Clear' and 'Save'.
    • USB Storage: Allows saving the drawn picture as a BMP file to a USB Mass Storage device.
    • Status Indicators:
      • LED1: Turns ON to indicate the end of a saving operation.
      • LED3: Turns ON when an error occurs.
      • LCD Messages: Displays status messages indicating the start and end of saving operations.
  9. Overview of the USB Device Mass Storage (MSC) Standalone Application

    master

    This application demonstrates how to implement a USB Mass Storage Class (MSC) device using an STM32F4xx MCU. It uses the USB OTG Device peripheral to communicate with a PC Host via Bulk Only Transfer (BOT) and SCSI transparent commands. The application uses a microSD card as the storage media, allowing the STM32 to be enumerated as a removable drive on a PC host for standard read, write, and format operations.

    Key Technical Details

    • Communication Protocol: Bulk Only Transfer (BOT) and SCSI.
    • Storage Media: microSD card.
    • Clock Configuration: The Full Speed (FS) USB module requires a 48-MHz clock. This can be derived from either the PLL clock (USBCLK = PLLVCO/PLLQ) or the PLLI2S clock (USBCLK = PLLI2SVCO/PLLI2SQ), both clocked by the HSE.
    • System Initialization: Uses HAL_Init() for peripheral reset and Flash/Systick initialization, and SystemClock_Config() to set the SYSCLK to 100 MHz.
  10. Overview of USB Host Mass Storage (MSC) Application

    master

    This application demonstrates how to use the USB Host Mass Storage Class (MSC) on STM32F4xx devices. It utilizes the STM32F469xx USB OTG Host peripheral to interact with a USB flash disk using Bulk Only Transfer (BOT) and SCSI transparent commands, integrated with the FatFs middleware for file system operations.

    Key Features:

    • Device Enumeration: Automatically detects connected USB flash disks and extracts metadata (VID, PID, manufacturer name, Serial no, and product name) displayed on an LCD.
    • File Operations: Includes a routine to write a small text file (< 1 KB) to the USB flash disk.
    • Disk Exploration: Includes a routine to explore and display the USB flash disk content on the LCD (supports recursion up to level 2).

    Hardware Requirements:

    • Target MCU: STM32F469xx.
    • Recommended Board: STM32469I-Discovery.
    • Connection: Use a 'USB micro A-Male to A-Female' cable to connect the USB key to connector CN13 for USB Full Speed (FS) operation.
  11. Overview of the USB Host MTP Standalone Application

    master

    This application demonstrates how to use the USB Host Media Transfer Protocol (MTP) on STM32F4xx devices. It allows the STM32 MCU to act as an MTP Host, enabling it to connect to intelligent storage devices (such as Android smartphones or tablets) to explore and play audio files.

    Key Features:

    • Device Enumeration: Extracts VID, PID, manufacturer name, serial number, and product name, displaying them on an LCD.
    • File Exploration: Searches for and displays .wav files present on the root of the connected device's storage.
    • Audio Playback: Streams audio data from the USB Host to an audio codec via the I2S interface. It automatically detects sampling frequency, channel count, and file duration.
    • Menu Navigation: Uses joystick buttons to select operations like 'Explore audio file', 'Start audio Player', or 'Re-Enumerate'.

    Compatibility:

    • Compliant with MTP implementation for Android 4.0.x through 4.3.x (with USB debug mode disabled).
    • Target hardware: STM32F407xx/STM32F417xx devices.
  12. Overview of USB Host CDC Standalone Application

    master

    This application demonstrates how to use the STM32 USB Host library with the Communication Class (CDC) on STM32Fxx devices. It specifically utilizes the STM32F469xx USB OTG Host peripheral to interact with a USB CDC device using two transfer directions with dynamic serial configuration.

    Key Functionalities

    • Transmission: Sends dummy data from the CDC_TX_Buffer to the connected USB device.
    • Reception: Receives ASCII data (e.g., from a Hyperterminal) via the device, stores it in CDC_RX_Buffer, and displays it on the host's LCD screen.
    • Enumeration: Upon connection, the host enumerates the device and extracts metadata including VID, PID, manufacturer name, Serial number, and product name, which are then displayed on the LCD.

    Hardware Requirements

    • Target MCU: STM32F469xx.
    • Development Board: STM32469I-Discovery (tested on RevC; RevA and RevB require configuration changes).
    • Connection: Use a 'USB micro A-Male to A-Female' cable. Connect to CN13 for USB Full Speed (FS) operation.