STM32CubeU5 MCU Firmware Package

repository·main·Indexed 41 days ago

https://github.com/stmicroelectronics/stm32cubeu5

A comprehensive embedded software platform for the STM32U5 series, providing HAL/LL drivers, middleware, and software examples. Includes implementations for CMSIS-DSP, CMSIS-NN (with TFL micro compliant APIs), and Azure RTOS stacks (ThreadX, NetX, FileX) for the B-U585I-IOT02A board.

Tokens
137.1K
Snippets
180
Records
632
Agent score
49%

What's inside STM32CubeU5

  1. Overview of Ux_Host_DualClass Application

    main

    The Ux_Host_DualClass application demonstrates the usage of the Azure RTOS USBX stack on STM32U575xx devices. It functions as a dual-class USB Host capable of simultaneously supporting:

    1. USB HID Host: Enumerates and communicates with Human Interface Devices like a Mouse (decoding x/y position, wheel, and buttons) or a Keyboard (decoding pressed keys). Data is displayed via UART HyperTerminal.
    2. USB MSC Host: Operates with USB flash disks using Bulk Only Transfer (BOT) and SCSI commands, integrated with the AzureRTOS FILEX file system to perform file operations (Create, Write, Read, Close).

    The application initializes USBx resources and registers MSC and HID Class drivers during the tx_application_define() phase. It utilizes four specific threads:

    • usbx_app_thread_entry (Priority 10): Initializes USB OTG HAL HCD driver and starts the Host.
    • hid_mouse_thread_entry (Priority 30): Decodes mouse HID reports.
    • hid_keyboard_thread_entry (Priority 30): Decodes keyboard HID reports.
    • msc_process_thread_entry (Priority 30): Handles file system operations.
  2. Overview of Fx_NoR_Write_Read_File Application

    main

    This application demonstrates the usage of Azure RTOS FileX and LevelX stacks on the STM32U5G9J-DK1 board. It specifically shows how to create a FAT32 compatible file system on a MX25LM51245G NOR flash device using the LevelX wear-leveling layer.

    Key Features

    • File Operations: Creates a file named STM32.TXT in the root directory, writes dummy data, and verifies it by reading it back.
    • Thread Management: Uses a single ThreadX thread named fx_app_thread (Priority: 10, Preemption Priority: 10) to handle all file operations.
    • Flash Management: Formats the NOR flash with 512 bytes per sector and 8 sectors per cluster.
    • Logging: Outputs flash size (before/after write) and occupied sector counts to the serial port.

    Success and Error Indicators

    • Success: Toggling green LED; serial logs show flash size and status.
    • Failure: Toggling red LED; green LED is switched off.
  3. Overview of USBPD_SRC_UX_Host_MSC Application

    main

    The USBPD_SRC_UX_Host_MSC application demonstrates a USB Type-C Provider (Source) and USB Host implementation using the Azure RTOS USBX stack. It is designed to act as a USB Mass Storage Class (MSC) Host that can enumerate and communicate with a removable USB flash disk using Bulk Only Transfer (BOT) and SCSI commands, integrated with the Azure RTOS FileX file system.

    Key Components:

    • USB MSC Host: Operates with a USB flash disk via BOT and SCSI commands combined with FileX.
    • USBPD Provider: Initializes Type-C port 1 in source mode with a single Power Data Object (PDO) at 5V.
    • ThreadX Integration: Uses tx_application_define() for resource initialization. The application spawns two specific threads:
      • app_ux_host_thread_entry (Priority 10): Initializes the USB OTG HAL HCD driver.
      • msc_process_thread_entry (Priority 30): Handles file operations after device enumeration.

    Expected Success Behavior: When a USB flash disk is connected, the application performs the following file operations:

    1. Create Test.txt.
    2. Write text to the file.
    3. Read the text back to verify integrity.
    4. Close the file.

    Status messages (including Vendor ID, Product ID, and operation outcomes) are displayed via the UCPD Cube Monitor on the VCP (Virtual COM Port).

  4. Overview of STM32CubeU5 software components

    main

    The STM32CubeU5 MCU Package provides a comprehensive embedded software platform for the STM32U5 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 Packages for supported evaluation, demonstration, or Nucleo boards.
    • Middleware libraries: Includes ThreadX, FileX, USBX, NetDuoX, OpenBootloader, USBPD, trustedfirmware, mbed-crypto, and Network Library.
    • LPBAM utility: A software helper for elaborating Low Power Background Autonomous Mode (LPBAM) scenarios.
    • Software projects: Applications, demonstrations, and basic examples located in Projects/<Board_name>/ directories.
    • Toolchain support: IAR Embedded Workbench for ARM (EWARM), RealView Microcontroller Development Kit (MDK-ARM), and STM32CubeIDE.
  5. Overview of Tx_SecureLEDToggle_TrustZone

    main

    This application demonstrates how to use the Azure RTOS ThreadX stack on STM32U5 devices when TrustZone is enabled (TZEN=1).

    Core Behavior:

    • The system boots in a secure context.
    • The secure application is responsible for launching the non-secure application.
    • A ThreadX thread (tx_app_thread) runs in the non-secure context.
    • This non-secure thread invokes a secure function to toggle an LED every 1 second.

    Project Structure:

    • xxxxx_S: The secure application part.
    • xxxxx_NS: The non-secure application part.

    Success/Error Indicators:

    • Success: LED_GREEN toggles every 1s.
    • Error: LED_RED toggles every 1s if an error occurs.
  6. Overview of the LL Template for NUCLEO-U575ZI-Q

    main

    This project is a reference template using the LL API designed for the STM32U575xx device on the NUCLEO-U575ZI-Q board. It serves as a foundation for building firmware applications with the following characteristics:

    • Clock Configuration: Configured for a maximum system clock frequency of 160MHz via the SystemClock_Config() function.
    • Driver Support: Includes all LL drivers (requires USE_FULL_LL_DRIVER in the IDE).
    • Target Hardware: Optimized for STM32U575xx and the NUCLEO-U575ZI-Q, but tailorable to other supported STM32U5 devices.
  7. Overview of BLE_AT_Client Example

    main

    The BLE_AT_Client example demonstrates BLE connectivity using the STM32WB5MMG module on the B-U585I-IOT02A board. It acts as an AT client to control an STM32WB5MMG module running a BLE AT server application.

    Key Features:

    • Service Toggling: Switch between two BLE services: Heart Rate sensor and P2P server.
    • User Interaction:
      • Single button press: Sends a BLE notification to a connected smartphone.
      • Double button press: Toggles the active BLE service.
    • Monitoring: Instructions and logs are output via the ST-LINK UART.
  8. Overview of LPBAM_LPTIM_PWMGen Application

    main

    The LPBAM_LPTIM_PWMGen application demonstrates how to handle Low Power Background Autonomous Mode (LPBAM) using the LPTIM (Low Power Timer) for PWM generation. It utilizes the DMA linked-list feature to change signal characteristics (period, pulse, and repetition) automatically while the MCU is in a low-power state.

    Key Features

    • Low Power Operation: The system enters Stop2 mode after configuring the LPBAM scenario, achieving a typical average power consumption of approximately 4.4uA during PWM generation.
    • MultiValue Scenario: A specific LPBAM scenario that executes 5 different sequences of PWM signals in an infinite loop, varying the period, pulse width, and repetition count.
    • Autonomous Execution: The LPBAM sub-system continues to operate even when the Cortex-M33 core is not clocked in Stop2 mode.

    Hardware Setup

    • Target Board: NUCLEO-U575ZI-Q (MB1549).
    • Waveform Monitoring: Connect an oscilloscope to pin PC.1 (Pin 36 in CN11 connector) to observe the LPTIM1 output waveform.
    • User Interaction: The user push-button (PC.13) is configured as an external interrupt (EXTI_Line13, falling edge) to wake the system or stop the scenario.
  9. Overview of Ux_Host_MSC Application

    main

    The Ux_Host_MSC application demonstrates the usage of the Azure RTOS USBX stack on STM32U575xx devices. It implements a USB Host Mass Storage Class (MSC) capable of enumerating and communicating with removable USB flash disks.

    Key Features:

    • Uses Bulk Only Transfer (BOT) and SCSI transparent commands.
    • Integrates with Azure RTOS FileX for file system operations.
    • Automatically initializes USBx resources and registers the MSC Class driver during the tx_application_define() call.

    Thread Model:

    • usbx_app_thread_entry (Priority: 10): Initializes the USB DRD HAL HCD driver.
    • msc_process_thread_entry (Priority: 30): Performs file operations once the device is enumerated.

    Expected Success Behavior: Upon plugging in a USB flash disk, the board will display the device's Vendor ID and Product ID via UART. The host then performs the following sequence:

    1. Create Test.txt.
    2. Write text to the file.
    3. Read the text back to verify integrity.
    4. Close the file.

    Status messages for each operation (Create/Write/Read/Close) are sent to the HyperTerminal.

  10. Overview of Nx_HTTP_SSE Application

    main

    The Nx_HTTP_SSE application demonstrates the usage of the Azure RTOS NetX/NetXDuo stack on the B-U585I-IOT02A Discovery board. It implements an HTTP server that uses Server-Sent Events (SSE) to push real-time updates to a web browser on a remote PC.

    Success Behavior:

    • The server responds with an HTML page.
    • For each connected client, the page is automatically updated whenever the server sends new events (specifically, information about the Live thread list).

    Error Behavior:

    • If too many clients attempt to connect, an error message is displayed on the UART console.
    • Closing a web page for one client frees up a slot for a new client connection (up to 5 concurrent sessions).
  11. Overview of Ux_Device_MSC Application

    main

    The Ux_Device_MSC application demonstrates how to use the Azure RTOS USBX stack on an STM32U575I-Eval board to implement a USB Device Mass Storage Class (MSC). The application emulates a USB MSC device, providing all necessary device and class descriptors to be compliant with USB standards.

    Key components include:

    • ThreadX Integration: Uses tx_application_define() for resource initialization.
    • Main Thread: app_ux_device_thread_entry (Priority 10) initializes the USB OTG HAL PCD driver and manages the USB device state (start/stop) based on USB Power Delivery (USB_PD) messages.
    • Media Callbacks: app_usb_device_thread_media_read and app_usb_device_thread_media_write handle data transfers to/from the mass storage media using DMA.

    Expected Behavior: Upon connection to a host PC, the board should enumerate as a removable USB MSC device, allowing standard read, write, and format operations.

  12. Overview of Ux_Device_HID_CDC_ACM Application

    main

    This application demonstrates the use of the Azure RTOS USBX stack on the B-U585I-IOT02A board. It implements a composite USB device consisting of two communication classes:

    1. HID (Human Interface Device): Emulates a USB HID mouse. When the User Button is pressed, the device sends HID reports to move the PC host cursor.
    2. CDC_ACM (Communication Device Class - Abstract Control Model): Acts as a USB-to-UART bridge (Virtual COM Port/VCP). It allows data exchange between the PC host and the STM32 device via UART.

    The application uses ThreadX for multitasking and manages the USB device lifecycle (start/stop) based on USB Power Delivery (USB_PD) plug/unplug events.