STM32CubeL4 MCU Firmware Package

repository·master·Indexed 43 days ago

https://github.com/stmicroelectronics/stm32cubel4

A comprehensive embedded software platform for the STM32L4 series, providing HAL/LL drivers, middleware, and software examples. Includes CMSIS components such as Core, DSP, NN, and RTOS, along with an experimental CMSIS-DSP Python wrapper for testing algorithms using numpy.

Tokens
233.4K
Snippets
219
Records
1.2K
Agent score
45%

What's inside STM32CubeL4

  1. Overview of the BLE HeartRate Application

    master

    The BLE HeartRate application demonstrates how to implement a Heart Rate profile using Bluetooth Low Energy (BLE) on the STM32 B-L475E-IOT01A Discovery board.

    In this setup, the STM32 board acts as a GATT server. Once the code is executed, the device begins advertising. To interact with the board, you must use a smartphone or another device acting as a GATT client to connect and read the heart rate measurements.

    Key Features:

    • Sends dummy heart rate values every second.
    • Supports the full Heart Rate Service specification, including sensor location information.
    • Supports resetting the Energy Expanded field by writing 0x1 to the Heart Rate Control point.
  2. Overview of the FreeRTOS Mail Example

    master

    This application demonstrates how to use mail queues using the CMSIS RTOS API on STM32L4 devices. It implements a producer-consumer pattern where one thread produces data and another consumes it via a mail queue.

    Key Concepts

    • Data Structure: The mail sent consists of a structure containing three variables: var1 (uint32), var2 (uint32), and var3 (uint8).
    • Thread Roles:
      • Producer: Allocates mail and puts it on the queue.
      • Consumer: A higher-priority thread that blocks on receiving mail. When mail is posted, the consumer preempts the producer, retrieves the mail, and frees it.
    • Queue Capacity: The mail queue is configured with space for exactly one item.

    Monitoring and Validation

    • LiveWatch Variables: To verify successful data transfer, monitor these variables in LiveWatch. The consumer values must always match the producer values:
      • ConsumerValue1 == ProducerValue1
      • ConsumerValue2 == ProducerValue2
      • ConsumerValue3 == ProducerValue3
    • LED Status (LED2):
      • Toggling: Indicates the application is running successfully.
      • Steady ON: Indicates an error has occurred.
  3. Overview of the USB Device Mass Storage (MSC) Standalone Example

    master

    This application demonstrates how to use the STM32L4xx USB OTG Device peripheral to act as a Mass Storage Class (MSC) device. It uses Bulk Only Transfer (BOT) and SCSI transparent commands to communicate with a PC Host, utilizing an eMMC card as the storage media.

    Key characteristics:

    • Enumeration: The STM32 MCU is enumerated as a standard MSC device by the PC Host.
    • Clock Configuration: The system clock (SYSCLK) is configured to 120 MHz. The Full Speed (FS) USB module uses an internal 48-MHz clock generated via an integrated PLL.
    • Functionality: Once running, the device appears as a removable drive on the host PC, supporting standard read, write, and format operations.
  4. Overview of the USB CDC Standalone Application

    master

    The USB Device CDC (Communication Device Class) Standalone application implements a USB-to-UART bridge, also known as a Virtual COM Port (VCP). The STM32 MCU acts as a USB device to a PC host while simultaneously communicating with other devices via its UART peripheral.

    Key Features:

    • Full-Duplex Communication: Uses UART interrupts for receiving data and DMA for transmitting data, allowing simultaneous bidirectional communication.
    • PSTN Subprotocol: Implements the CDC class following the PSTN subprotocol.
    • Endpoint Configuration:
      • Bulk IN: Transmits data from the STM32 to the PC host. Data is buffered in UserTxBuffer and transmitted based on a timer callback defined by CDC_POLLING_INTERVAL.
      • Bulk OUT: Receives data from the PC host to the STM32. Data is saved in UserRxBuffer and transmitted over UART using interrupt mode.
      • Interrupt IN: Handles control requests such as Set line and Get line to configure baud rate, stop bits, parity, and data bits via CDC_Itf_Control().
  5. Overview of USB Host HID Standalone Example

    master

    The USB Host HID Standalone example demonstrates how to use the STM32L4xx USB OTG Host peripheral to interact with Human Interface Devices (HID) such as a Mouse or a Keyboard.

    Core Behavior:

    • When a USB device is attached, the host enumerates it and checks for HID support.
    • If supported, the host extracts device metadata (VID, PID, manufacturer name, Serial no, and product name) and displays it on the LCD.
    • The application provides a menu to launch specific HID routines:
      • Start Mouse / Re-Initialize: Enables mouse interaction. Moving the mouse moves a pointer on the display; button presses highlight rectangles in Blue.
      • Start Keyboard / Clear: Enables keyboard interaction. Typed characters are displayed on the LCD.
      • Re-Enumerate: Triggers a new enumeration process for the connected device.
  6. Overview of the WrAARtoRunBLEapp application

    master

    The WrAARtoRunBLEapp application demonstrates how to write an Android Application Record (AAR) NDEF message to an M24SR Type 4 NFC tag. When a smartphone with NFC enabled approaches the antenna, this message triggers the automatic launch of the BLE STM32 Profiles application. If the app is not installed, the smartphone will attempt to download it from the Google Play Store.

    Application Workflow:

    1. Initialization: The NFC component is initialized. LED2 turns ON to signal that initialization is complete.
    2. NDEF Writing: An AAR NDEF message is written to the M24SR tag.
    3. Interaction: A smartphone approaches the NFC antenna to trigger the application launch.
  7. Overview of USB Host CDC Standalone Application

    master

    The USB Host CDC (Communication Device Class) application allows an STM32L476xx device to act as a USB Host for CDC-compliant devices. It supports two primary modes of operation:

    • Transmission Mode: The Host reads a file from an SD card (via the menu) and sends its content to the connected USB CDC device. Data is stored in the CDC_TX_Buffer.
    • Reception Mode: Data entered via a HyperTerminal (on the Device side) is transferred to the Host and displayed on the Host's LCD. Data is stored in the CDC_RX_Buffer.

    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.

  8. Overview of the USB Host MSC Standalone Application

    master

    The USB Host Mass Storage Class (MSC) application demonstrates how to use the STM32L4xx USB OTG Host peripheral to operate a USB flash disk. It utilizes Bulk Only Transfer (BOT) and SCSI transparent commands in conjunction with the FatFs middleware component for file system operations.

    Key Features:

    • Enumerates USB devices and extracts metadata (VID, PID, manufacturer name, Serial no, and product name).
    • Displays device information via a debugger IO terminal.
    • Uses the STM32Cube USB Host library.

    Hardware Requirements:

    • Target Device: STM32L475xx.
    • Recommended Board: B-L475E-IOT01A.
    • Clocking: The USB OTG Full Speed (OTG-FS) module uses an internal 48-MHz clock source based on the MSI oscillator. For high precision (recommended for host mode), an 8 MHz crystal should be added at the X1 position.
  9. Overview of the AWS Cloud demonstration for B-L475E-IOT01A

    master

    The AWS Cloud demonstration implements an Amazon AWS IoT Cloud client for the B-L475E-IOT01A board. It utilizes the on-board Inventek ISM43362 Wi-Fi module for connectivity and mbedTLS for secure network communication.

    Key Features:

    • Cloud Connectivity: Connects to Amazon AWS IoT Cloud using user-provided credentials.
    • Interactive Control: When the User button is pressed, the board sends a LED toggle command to the IoT Cloud endpoint. The endpoint returns the message to the board, which then triggers the LED toggle.
    • Sensor Data: The application collects board sensor data and publishes it to the cloud.
  10. Overview of the ZLib Delphi Interface Unit

    master
    This directory provides an updated Delphi interface unit for the ZLib library. It is designed to replace older Borland-distributed versions (based on zlib 1.0.4) which contain bugs and security vulnerabilities. This version is adapted for compatibility with zlib 1.2.1 and includes improvements for 64-bit readiness and C-style calling conventions.
  11. Overview of the USB Host Mass Storage (MSC) Standalone Application

    master

    The USB Host MSC Standalone application demonstrates how to use the STM32L4xx USB OTG Host peripheral to operate a USB flash disk. It utilizes Bulk Only Transfer (BOT) and SCSI transparent commands in conjunction with the FatFs middleware to perform file system operations.

    Key Features:

    • Device Enumeration: Automatically detects connected USB flash disks in MSC mode.
    • Information Extraction: Retrieves and displays VID, PID, manufacturer name, serial number, and product name via the STLink Virtual COM Port.
    • File Operations: Provides routines to read/write files and explore the contents of the USB flash disk.

    Hardware Requirements:

    • Target Device: STM32L4R9I.
    • Development Board: STM32L4R9I-Discovery.
    • Connection: Connect a USB Flash Disk to the board's CN9 (OTG-FS) connector using a 'USB micro A-Male to A-Female' cable.
  12. Overview of the USB Device MSC Standalone Example

    master

    This application demonstrates how to use the STM32L4xx USB OTG Device peripheral to implement a Mass Storage Class (MSC) device. The STM32 MCU acts as a removable drive (using Bulk Only Transfer (BOT) and SCSI transparent commands) connected to a PC Host, with a microSD card serving as the storage media.

    Key Technical Details:

    • Target Hardware: STM32L4R9xx devices (specifically tested on STM32L4R9I-EVAL).
    • Clock Configuration: The system clock (SYSCLK) is configured to 120 MHz. The Full Speed (FS) USB module uses an internal 48-MHz clock generated via an integrated PLL.
    • Functionality: Once plugged into a PC, the device is automatically detected as a removable drive, allowing standard read, write, and format operations.