Ask questions and find answers on STM32Cube packages, including HAL, LL and middleware, and expansion software.
Most recent activity
Hi,I am trying to use the AES hardware on the STM32U545 with the STM HAL libraries.I am able to correctly encrypt and tag an number of bytes of plain text. However, whenever I try to decrypt an encrypted message with a length not divisible by 4 I get a tag mismatch but the decrypted plain text is correct.I am using byte size data width for everything and have no header data. From what I can see is that the encryption will work for any arbitrary size, however, the decryption tag is not computed correctly, unless the size is divisible by 4. Is this expected behavior or is this an issue with the HAL? Thanks!
I have a simple recommendation that would greatly improve your HAL drivers: please add a UserContext field to the handle structures for HAL peripherals (e.g. UART, I2C, SPI). I'll explain.I write compatibility drivers for communication peripherals for each MCU our company works with. That way, no matter which MCU we select for a project, we have a common API for a given peripheral type. We always enable HAL callbacks for peripherals like UART, I2C, and SPI, since this simplifies registering a pre-made library function with the STM32 HAL. Each peripheral instance has an associated runtime data structure; for instance, a UART structure contains a receive FIFO queue and transmit FIFO queue. When my application wants to receive data, it just checks the receive FIFO; the driver I've written handles RX callbacks and stuffs that data into the FIFO.The problem I run into with the STM32 HAL, however, is that when a callback arrives, it is not simple to associate th
I am working on a custom dual-boot bootloader for the STM32G0B1CCT6 with the following features:Bootloader located at 0x08000000 (about 20 KB flash).Two application firmware slots:App1 at 0x08005000 (22 KB)App2 at 0x0800A800 (22 KB)On reset, the bootloader checks the CRC of App1 and App2 firmware:If App1 is valid, it jumps to App1.Else if App2 is valid, it jumps to App2.Else it stays in bootloader mode.Firmware updates are sent via FDCAN as .bin files (no special commands, just the binary data).The bootloader receives the firmware, writes it to the free app slot, verifies CRC:If CRC passes, it overwrites the old firmware and jumps to the new app.If CRC fails, it keeps the old firmware and stays in bootloader mode.I want to support multiple firmware updates this way reliably.I have basic HAL code generated from CubeMX for FDCAN and CRC peripherals.My questions:Is my memory layout and CRC validation approach suitable for STM32G0B1CCT6 with 64KB flash?How can I best implement the FDCAN re
Hi everyone, I'm working on implementing a UDP communication between my STM32H755 (Nucleo-144) and a PC, where the microcontroller acts as a UDP client. I'm using lwIP with the netconn API and FreeRTOS is already running with several tasks (that's the only reason why I went directly for netconn API instead of RAW API). The communication works fine when I use osDelay(100) in the data transmission task, but if I try to increase the transmission frequency (e.g., osDelay(10)), I start running into RAM overflow issues. I've placed the lwIP sections in D2 SRAM like this in the -FLASH.ld code: .lwip_sec (NOLOAD) : { . = ABSOLUTE(0x30000000); *(.Rx_PoolSection) . = ABSOLUTE(0x30040000); *(.RxDecripSection) . = ABSOLUTE(0x30040060); *(.TxDecripSection) } >RAM_D2 I also set PBUF_POOL_SIZE = 128, but increasing this value doesn't solve the issue. Is there a better way to optimize memory handling with netconn at high data rates? Any insights or suggestions would be greatly appreciated.T
Greetings , I ve tried to work with ethernet and lwip on stm32f756 nucleo board but somehow didint figure out whats wrong. https://community.st.com/t5/stm32-mcus-products/stm32f756-ethernet-and-lwip-lwip-ram-heap-pointer/m-p/768279#M272145I tried this solution Watched https://www.youtube.com/watch?v=Wg3edgNUsTk&list=PLfIJKC1ud8ggZKVtytWAlOS63vifF5iJC&t=607sbut still cannot ping my board with direct connection on my computer or by using my internet modem.May I get example or proper tutorial for that step by step because I didint understand whats going on , why I need to change ram locations etc.I just cancelled everything and uploading my file here. May I get help for eth?
Hello,I'm new to the USB protocol and currently facing an issue with USBX.I'm working on a project using ThreadX and the USBX stack, trying to develop a Custom HID device with two endpoints: one IN and one OUT.I generated the code using STM32CubeMX, and then modified:the HID descriptor,the USBD_Custom_HID_Activate and USBD_Custom_HID_Deactivate functions,as well as the thread entry:static VOID app_ux_device_thread_entry(ULONG thread_input) { /* USER CODE BEGIN app_ux_device_thread_entry */ TX_PARAMETER_NOT_USED(thread_input); HAL_PWREx_EnableVddUSB(); // Enable USB power /* Initialize USB DRD_FS controller */ MX_USB_PCD_Init(); /* Configure USB packet memory area (PMA) for endpoints */ HAL_PCDEx_PMAConfig(&hpcd_USB_DRD_FS, 0x00, PCD_SNG_BUF, 0x0C); // EP0 HAL_PCDEx_PMAConfig(&hpcd_USB_DRD_FS, 0x80, PCD_SNG_BUF, 0x4C); // EP1 IN HAL_PCDEx_PMAConfig(&hpcd_USB_DRD_FS, 0x81, PCD_SNG_BUF, 0x8C); // EP2 IN HAL_PCDEx_PMAConfig(&hpcd_USB_DRD_FS, 0x02, PCD_SNG_BUF,
Hi to everybody.I'm trying to create a simple program testing the anti tamper function of the STM32 serie U0.I have the Nucleo U031, but I have tested with the U083's example (adjusted in the MCU tipe) but nothing changes, both LL and HAL. (there are different examples using LL and HAL, but only for U083 version).Create a new HAL project using the U031 but the pressing of the blue button (connected to the PC13) doesn't work.The new self create project is exaclty = to the example, but nothing.Using another Nucleo such as L073 and create a new project from scratch work.Simply, I have enabled the RTC_Tamp IRQ from NVIC, put a breakpoint in the ISR but nothing.Where is the problem?
Hello all,I am using IAR Embedded Workbench 8.22.3 and needed to add support for the STM32G4 series (specifically the STM32G431RB). Since this version of IAR does not natively support STM32G4, I followed the official patch installation process.Steps Followed & ObservationsDownloaded & Installed Patch for IARDownloaded STM32G4 patch from ST’s official GitHub/STM32CubeG4 Patch for EWARM.Ran Install_Patch.bat as Administrator → Patch installed successfully.Restarted IAR → STM32G4 series appeared in the device list.Compiled application successfully.Created a new project targeting STM32G431RB.Compilation completed successfully without errors.Download & Debug Issue (Flashing Failure)When trying to Download and Debug, the following error appeared in the IAR Debug Log: Checked the flash loader directory::file_folder: C:\Program Files (x86)\IAR Systems\Embedded Workbench 8.0 EWARM F\S 8.22.3\arm\config\flashloader\ST\Found the following files:FlashSTM32G43xxB.flashFlashST
Dear All, I'm trying to develop a USB HID mouse and keyboard both on the same USB connection for the nucleo-H755ZIQ board. I mean a complete project (from configuration in CubeMx) and software implementation for CubeIDE. On the net I've tryed some example to emulate mouse and keyboard separately (one a time) and they work. But I'm not able to implement mouse and keyboard simultaneously on the same single USB connection. My goal, at the moment, is software in which if I press the user button could move the mouse pointer and send a character as a keyboard. Could somebody help me? Best regards
Hello,I need to connect SD card to STM32H5 device. CubeMX does not support fatfs I was using in the past, but only ThreadX and FileX. We decided to use this as STM32H5 seems like a good choice for many future projects.So we connected the SD via SPI.My understanding is that I need to enable Custom interface like this: And than implement several low level functions in FileX/Targer/fx_stm32_custom_driver.c. This looks like this should be common task, but I could find no examples anywhere. Is there something I could use or at least some useful documentation regarding the custom driver?Thank you Jeronym
Hi,I have spent the last two days trying to build a demo application that connects a B-L475E-IOT01A1 to AWS.However, I keep finding that the demos will not build due to it needing an old tool chain.The documentation for the board on how to run AWS FreeRTOS, is from 2018 and references older AWS free RTOS version, none of the STM documentation tells you how and where to download source code from.The AWS help on FreeRTOS has not helped. Most available documentation appears to be deprecated.So the bottom line is:"Is there a definitive, step by step, guide on how to set up and run an AWS demo on a B-L475E-IOT01A1?"I would prefer to use STM32CubeIDE, however, to get myself out of a death spiral I'm prepared to try another tool chain.Or am I wasting my time?ThanksJorgie
[moderation:] Please see How to write your question to maximize your chances to find a solution, How to insert code [/moderation] I am trying to generate a sbus signal for radio transmission in drones. imhave tried this code. in oscilloscope, uart output is showing, but qgc is not detecting sbus. i do pass a 16 channel array to convert into sbus. the project is as below:- /* USER CODE BEGIN Header */ /** ****************************************************************************** * @file : main.c * @brief : Main program body ****************************************************************************** * @attention * * Copyright (c) 2025 STMicroelectronics. * All rights reserved. * * This software is licensed under terms that can be found in the LICENSE file * in the root directory of this software component. * If no LICENSE file comes with this software, it is provided AS-IS. * ****************************************************************************** */ /* USER COD
I am trying to flash BSP example from https://github.com/STMicroelectronics/STM32CubeU5/tree/main/Projects esp. the ones for STM32U5A9J-DK. While trying to compile BSP : https://github.com/STMicroelectronics/STM32CubeU5/tree/main/Projects/STM32U5x9J-DK/Examples/BSP, I am not able to get a compiled binary to flash. Tried following ways to import the checkout code in STMCubeIDE -1) "Open project from file system" or "Import -> Projects from Folder or Archive" - Build not enabled2) "Existing project in workspace" -> "Copy project in workspace"Errormake -j8 allmake: *** No rule to make target '/Utilities/lcd/stm32_lcd.c', needed by 'Utilities/stm32_lcd.o'. Stop.3) "Import" -> "File System"Cannot import into a workspace with no open projects. Please create a project before importing.what is the first way to get these examples build and flashed.
I'm trying to get USBX MSC working in standalone mode on the STM32H573I Discovery board.I've come across a few tutorials for setting up USBX in VCP mode and have attempted to adapt them for MSC, but I haven’t been able to get the USB to enumerate properly. My background is in electronic hardware design, so this software side is quite new to me.Are there any tutorials specifically for setting up USB MSC in standalone mode that I can follow? Alternatively, are there any example projects available?Thank you
Hi ST Community,I'm working with the STM32U5G9ZJT6Q and need to send real-time data from DCMI over USB through CDC . I generated a CDC-ACM project using CubeMX 6.14.0, and by default, it appears as a Virtual COM Port under device manager . Then i used Zadig to replace the driver with libusb-win32, and now the device shows up under libusb devices, ready for high-speed (HS) USB communication.However, all CDC-ACM examples I’ve found using with UART, which doesn’t meet the performance needs for my video streaming use case.I’m requesting a sample project or reference code using the STM32U5 USB stack, where CDC-ACM works with libusb (HS mode) and does not rely on UART, so I can send DCMI data directly over USB.thanks,
Hello everyone,I have a project using the STM32H7, using FreeRTOS and with a FatFS (ChaN) runnin on a 4GB eMMC (Kingston), using peripheral SDMMC1.Normally everything works fine. SDMMC1 and FatFS (FAT32) are initialized at main, before OS, and is used later on for many things such as creating and writing/reading files, etc.However, we found some devices that were working fine and suddenly (after a couple of thousands of writings in the eMMC, I'd assume not too intense) we start having a constant and reproducible error. What happens is that the FatFS initializes OK but as soon as we want to write something (still at main, before OS), it fails. Basically when trying to open a file (that already exists) it fails with FR_DISK_ERR and we cannot use the FatFS anymore. Trying to debug a bit, I saw that on the lowest level HAL_MMC_ReadBlocks (from stm32h7xx_hal_mmc.c) is failing with HAL_TIMEOUT.However, if I send a "reset" command to our device (it basically just executes a __NVIC_SystemReset
I have stm32cubeIDE version 1.17.0 and I'm not able to import this project and build it: https://github.com/stm32-hotspot/USBD_Composite_STM32H503
I'm starting a project on the STM32U5G9, and one feature we want is USB connectivity, just a simple virtual COM port (CDC class). Looking at the Middleware picker in CubeMX, the only USB-related items are USBPD (don't need Power Delivery at the moment), and USBX, which is the ThreadX/Azure RTOS USB stack. If I look for CubeMX examples for the STM32U5G9J-DK2, the only USB examples offered are for ThreadX and USBX.Is it reasonable to assume that if I don't want to be writing my USB application from scratch on the STM32U5, I should be using ThreadX/Azure RTOS instead of FreeRTOS?Dana M.
Hi All, I had the need to use the independent watchdog timer and rather than a straight reset of the system I wished to put the system into a fault mode. You can do this by examining the RCC control and status register (CSR) viz: int main(void) { /* MCU Configuration--------------------------------------------------------*/ /* TODO: */ /* Reset of all peripherals, Initializes the Flash interface and the Systick. */ HAL_Init(); /* Configure the system clock */ SystemClock_Config(); MX_USART2_UART_Init(); checkIWDG(); #if(IWDG_ENABLE == 1) void checkIWDG(void) { if(RCC->CSR & RCC_CSR_IWDGRSTF) { /*** FAULT MODE ***/ /* The IWDG has reset the system */ printf("IWDG Reset\n\r"); /* Run fans flat out */ GPIO_InitTypeDef GPIO_InitStruct = {0}; __HAL_RCC_GPIOA_CLK_ENABLE(); /*Configure GPIO pins : PA9_FAN1_POWER_Pin PA10_FAN2_POWER_Pin */ GPIO_InitStruct.Pin = PA9_FAN1_POWER_Pin|PA10_FAN2_POWER_Pin|PA11_TEST_OUTPUT_Pin|PA6_TIM3_CH1_FAN1_SPEED_DEMAN
Hello, I've bought Riverdi board and I'm developing a code that uses Ethernet and act as TCP server. The code sends "Hello word %d", i++ every 10ms on that TCP socket and it works fine, but when I try to send some byte on client size it goes to HardFault: Can some one help me ? it is related to HardFault_Handler when enable LWIP and touchgfx - Page 2 - STMicroelectronics Community
Hello, I am working with an STM32F769I-DISCO board and trying to implement functionality that allows switching between USB Host and Device modes via a button press. I have configured the board for OTG/Dual Role in STM32CubeMX, but I did not enable the Middleware for USB Host or USB Device, so I need to manage the switching at the register level and using HAL APIs. I would appreciate any advice or code examples for properly managing this switch: Initialization: How should I correctly initialize the USB peripheral to support both modes (Host and Device)? Mode Switching: What are the recommended steps to deactivate one mode and activate the other without causing conflicts or stability issues? Specific APIs and Registers: Are there specific HAL APIs to use, or do I need to manipulate the registers directly? If so, which are most relevant for this purpose? I've attempted to implement a basic switch using HAL_PCD_Stop() and HAL_HCD_Start(), but I'm not sure if this is the best approa
I need to implement the SNMP V3 protocol using the NUCLEO-H755ZIQ Board with AZURE RTOS. Provide any document regarding to this one.
I have seen linker scripts like this:MEMORY { RAM (xrw) : ORIGIN = 0x200000C0, LENGTH = 32K - 192 /* 192 for vector table */ BOOTLOADER (rx) : ORIGIN = 0x08000000, LENGTH = 4K FIRMWARE (rx) : ORIGIN = 0x08001000, LENGTH = 256K - 4K } /* Main app start address symbol */ _main_app_start_address = 0x08001000;with multiple DRY issues.After trawling through linker script documentation, I came up with the following alternative:/* Entry Point */ ENTRY(Reset_Handler) BL_ORIGIN = 0x08000000; BL_SIZE = 32K; FW_ORIGIN = (BL_ORIGIN + BL_SIZE); ... /* Memories definition */ MEMORY { ... BOOTLOADER (rx) : ORIGIN = BL_ORIGIN, LENGTH = BL_SIZE FIRMWARE (rx) : ORIGIN = FW_ORIGIN, LENGTH = 256K - BL_SIZE } ...where the symbol FW_ORIGIN can be used straight from c, e.g. using:extern uint32_t FW_ORIGIN[]; const uint32_t FIRMWARE_START_ADDR = (uint32_t)FW_ORIGIN;I did not see this suggestion anywhere when looking for ways to do this (using search terms like the title of this post), and it works,
Does STM32N6570-DK support TCP protocol? I want to create TCP server on the board and send/receive data over 1Gbit Ethernet. How can ı do that? I didn't see the NetXDUO Protocols under NETX Middleware. It seems like it is not configurable to open UDP/TCP or ICMP protocols in this board. Also there is no any example or application avaible about that.
Hello, today I received a stm32f746-disco board and I immediately coded with the external flash memory that I used on my stm32f750-disco, the problem is that the code doesn't work and I can't debug (before this was easy to do on the f750), after testing I found out that I flashed to its external chip and they are different: n25q128 for the f750 and w25q128 for the f746. My question is whether their external flash memory configuration is the same or do I have to create another project for the stm32f746-disco?Here is the video tutorial I used
ST Community highlights – April to June 2026
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.