Ask questions and find answers on STM32Cube packages, including HAL, LL and middleware, and expansion software.
Most recent activity
Dear STM32 Community, We believe that the example projects provided for the STM32Cube embedded software are a valuable resource when developing projects. We would like to better understand how developers use these examples in their workflow and explore ways to improve them. Therefore, we have a few questions we would like to ask: From where do you obtain the examples, and why? Are you working with the examples through the STM32Cube MCU packages, the STM32CubeMX Example Selector, or through GitHub? Is there a particular reason you prefer one channel over the others? How do you use the examples in your work with STM32 embedded software? Do you use the examples to learn how to use a driver or a feature, as reference code for implementation, and/or for debugging? What is working well, and what can we do to improve the examples and/or your experience working with them? You can either reply directly in this thread or feel free to send me a private message. &nb
Hello there, I’m working on a device that in its normal operation uses the MSC.But I want my clients to also be able to update the device via USB using DFU.#define USBD_PID_FS 57105#define USBD_PRODUCT_STRING_FS "STM32 DownLoad Firmware Update"#define USBD_CONFIGURATION_STRING_FS "DFU Config"#define USBD_INTERFACE_STRING_FS "DFU Interface"#define USBD_PID_FS 22314#define USBD_PRODUCT_STRING_FS "STM32 Mass Storage"#define USBD_CONFIGURATION_STRING_FS "MSC Config"#define USBD_INTERFACE_STRING_FS "MSC Interface"I found these differences and made a work around, CubeProgrammer is detecting a DFU device when a button is pressed:void MX_USB_DEVICE_Init(void){ /* USER CODE BEGIN USB_DEVICE_Init_PreTreatment */ //check to enter DFU mode if(HAL_GPIO_ReadPin(USR_BUT_ENTER_GPIO_Port, USR_BUT_ENTER_Pin) == GPIO_PIN_RESET){ if (USBD_Init(&hUsbDeviceFS, &DFU_Desc, DEVICE_FS) != USBD_OK) { Error_Handler(); } if (USBD_RegisterClass(&hUsbDeviceFS, &U
Hi.I'm trying out new STM32N6 Nucleo board. It has cmera interfaces, so I wanted to try some examples with the camera.My usual routine for quickstarting some new STM32 product was to download CubeMX package for it, go to Repository folder -> Projects -> [board] -> Applications or Examples, and run an exaple project. But I didn't find any example neather for Nucleo nor other boards.Where can I find camera examples for NUCLEO-N657 board?Thanks.
I have an application that uses internal flash for logging. Unfortunately, after exiting stop3 subsequent writes to flash fail. Here’s my exit code -- the names of the routines should give a general idea. I don’t really have a clue what changed and the reference manual is notably sparse on details about the various stop/standby/shutdown modes SET_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SLEEPDEEP_Msk)); __DSB(); __WFI(); __ISB(); CLEAR_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SLEEPDEEP_Msk)); PWR->APCR &= ~PWR_APCR_APC; palSetLine(LINE_testpin); chSysLock(); tagPowerRestoreClocksAfterStop3(); tagPowerPostStop3WakeEventI(); chSysUnlock(); // Ensure Flash is awake and not stuck in low-power mode FLASH->ACR &= ~(FLASH_ACR_SLEEP_PD); __DSB();
I am working on an STM32H7-based project where I continuously poll sensor data over SPI in DMA mode. Everything works as expected for the first few hours, but occasionally the SPI bus freezes and triggers a timeout error (HAL_SPI_ERROR_TIMEOUT).Resetting the SPI peripheral manually recovers the communication, but I want to identify the root cause instead of using a soft-reset workaround.Has anyone encountered similar bus lockup issues with STM32H7 SPI DMA implementation? Any tips on proper flag clearing or clearing the FIFO buffer safely would be greatly appreciated!
Hi,Could you please share example for using IIS2MDCTR via SAI on STM32U385.Thanks
As the title suggests, I see in debug mode that audio is captured from I2S_RX, but it is not transmitted on the transducer (I cannot hear any audio coming from I2S_RX with my hear). And the problem is that with the same hardware wiring it works on the other boards (including H7S3L8), but not on this specifically. I’ve tried to place dma buffer in RAM D2 and I’ve disabled D cache, ut it does not solve anything. Is the board I’ve ordered broken? I upload the code below
Board: STM32N6570-DK Sensor: Sony IMX219 (Raspberry Pi Camera Module 2 / NoIR), custom driver, connected via a 15-pin-to-22-pin adapter cable into the board's camera connector (normally used for the MB1854/IMX335 module)SummaryI've written a from-scratch IMX219 driver (I2C register map transcribed from the Linux kernel's imx219.c) as an additive sensor option alongside the working IMX335 path. I2C control, power sequencing, and CSI-2 D-PHY link all come up healthy. DCMIPP's own status registers report that PIPE1 is continuously and successfully capturing new frames. But the actual pixel data written to memory is frozen — bit-for-bit identical — and does not respond to real scene changes. I'm looking for insight into what could produce this specific disconnect.Configuration2 CSI-2 lanes, D-PHY bitrate bucket DCMIPP_CSI_PHY_BT_900 (900 Mbps bucket, closest available to the computed 912 Mbps for this PLL config) Sensor PLL: VTPXCK_DIV=5, PREPLLCK_VT_DIV=3, PLL_VT_MPY=57, OPSYCK_DIV=1, PRE
Hi,I am using the STM32H745I-DISCO board and trying to boot an application from the external QSPI flash (MT25QL512ABB).For this purpose, I created two separate projects: Bootloader Project Initializes the QSPI flash. Configures the QSPI in Memory-Mapped mode. Jumps to the application stored in the external QSPI flash. Application Project Modified the linker script (.ld file) to change the application start address from 0x08000000 to 0x90000000. Added the following statements in CM7/Common/Src/system_stm32h7xx.c (around lines 295–296) inside SystemInit(): As a basic test, the application code is only trying to blink the LED connected to GPIO Pin 13 after booting from the QSPI flash. RCC->CFGR = 0; SCB->VTOR = QSPI_BASE;After building the application, I generated the .bin file and programmed it into the QSPI flash using STM32CubeProgrammer.When I read back the contents from address 0x90000000 using CubeProgrammer, I can see valid data programmed in the fla
Based on discussion here, conclusion is, that given in 'L45x/'L46x there's no DAC1_CH2, and in 'L41x/'L42x no DAC at all, these are unavailable for inputs selectable for COMP for these sub-families of the low-end 'L4xx family group handled collectively by RM0394. Description in stm32l4xx_hal_comp.c does not tell these completely, and there are also references to 'L43x/'L44x having some exceptions, which based on RM/DS doesn't appear to be the case: Also, macros in stm32l4xx_ll_comp.c don't take the missing DAC channels into account, and they should. Can these be looked at, please. Thanks, JW
I am attempting to exist from a Shutdown mode using the WKUP6 pin (PB5) on an STM32G0B1CEU.This is my shutdown code.HAL_SuspendTick();__HAL_RCC_PWR_CLK_ENABLE();HAL_PWREx_EnableGPIOPullUp(PWR_GPIO_B, PWR_GPIO_BIT_5);HAL_PWREx_EnablePullUpPullDownConfig(); // sets the APC bit in PWR_CR3HAL_PWREx_EnablePORMonitorSampling();HAL_PWR_EnableWakeUpPin(PWR_WAKEUP_PIN6_LOW);// Do reads of registers to ensure they were written(void)PWR->CR3;(void)PWR->CR4;/* Clear all related wakeup flags*/__HAL_PWR_CLEAR_FLAG(PWR_FLAG_WUF);HAL_PWREx_EnterSHUTDOWNMode();This seems to do almost exactly what I would expect it to do.PB5 goes high.Power consumption drops.However, it never wakes up. I have a wire connected to PB5, which I am measuring with a scope, and confirm that it is going high. I am them shorting that wire to ground and confirm that it goes low. The system doesn’t wake up. I know it’s not immediately going back to sleep because right now there is no automated way for it to enter sleep m
Hi everyone,I'm working on Azure RTOS USBX CDC ACM on an STM32F429ZIT6. The USB device is detected successfully by Windows, and a COM port is created, but I'm unable to transmit or receive any data.EnvironmentMCU: STM32F429ZIT6 STM32CubeIDE: 1.19 STM32CubeF4: 1.28.3 Azure RTOS USBX (X-CUBE-AZRTOS-F4)ProblemThe USB device enumerates successfully:Device Manager detects the USB CDC device. A COM port is created. No data transfer occurs. _ux_device_class_cdc_acm_activate() is never called. The CDC ACM class never becomes active.While debugging, I found that execution reaches: UINT _ux_device_stack_interface_start(UX_SLAVE_INTERFACE *interface)where the following assignment is made: class_command.ux_slave_class_command_class = interface->ux_slave_interface_descriptor.bInterfaceClass;Later, USBX calls: _ux_device_class_cdc_acm_entry(&class_command);During the UX_SLAVE_CLASS_COMMAND_QUERY request, the following check is performed: if (command->ux_slave_class_command_class == UX
Hello,Is there any chance ST could provide examples or guidance on interfacing a CSI (MIPI) camera with Raspberry Pi Camera Module 2 NoIR cameras?From my initial research, it seems the CSI connector uses the same pin layout as Raspberry Pi cameras. However, available examples are quite limited, making it challenging to implement this on my own — especially compared to the simplicity of working with DCMI.Any documentation, sample code, or community insights would be greatly appreciated!Thank you.With best regards,Linas
Hello @ST Community @ST MICROCONTOLLER I have purchase NUCELO-H563ZI board.Purpose: I need to read and write pendrive sector using only pure HAL HCD driver (Baremetal Code only) (No FILEX, USBx, ThreadX, FreeRTOS)Following is my Hardware Connection: I am using external USB Type A Female Breakout board. Not using internal CN13 TypeC USB connector.PA11 : D-MinusPA12 : D-PLUSVCC : 5VGND : Board GroundI have attached file which can read and write the sector.While submitting request for “Get Descriptor” command. Code is stuck during USB_EnumerateMSC » USB_GetDescriptor » “USB_ControlTransfer” » “USB_SubmitTransfer” >> “HAL_HCD_HC_SubmitRequest” stuck in “USB_WaitForURB>>HAL_HCD_HC_GetURBState” function.I can observe that while submitting “HAL_HCD_HC_SubmitRequest” request on channel 0 HAL Drive respond on channel 1 instead of channel 0. ch[0].urbState = USB_IDEL while ch[1].urbState = USB_DONE.Also i have also observe that “HCD_HC_OUT_IRQHandler(hhcd, (uint8_t)i);” API “uint8
Hello everyone,I am working with an STM32H743 running at its maximum frequency of 480 MHz. I am trying to implement VBlank synchronization using the LTDC Line Interrupt and CMSIS-RTOS v1 (FreeRTOS). My goal is to unblock a display/rendering task at every frame interval.According to my hardware configuration, the frame time should be 16.6ms (60Hz refresh rate). The mathematical formula confirms this:Total Width = 920, Total Height = 542, Pixel Clock = 30 MHz. (920 * 542) / 30,000,000 Hz = 0.01662s -> 16.62ms.My FreeRTOS configuration is strictly set to configTICK_RATE_HZ = 1000 (1 tick = 1ms).The Problem & Debugging History:Initially, I placed three hardware breakpoints in my code to track execution flow:(1) Right at osSemaphoreWait in the task loop. (2) Inside the HAL_LTDC_LineEventCallback after re-programming the line. (3) Right at the gm_sprintf line where time delta is formatted.If the synchronization loop worked correctly, the debugger should have hit these breakpoints sequ
Hello ST Community,I am working on an STM32N6 project where I need to implement a USB composite device containing three distinct classes: CDC ACM Instance 1 CDC ACM Instance 2 UVC (USB Video Class) Current Status & Setup:The dual CDC ACM implementation is fully stable and working properly. I generated the basic framework using STM32CubeMX (.ioc), which handles the initial USBX configuration, the first CDC instance, and sets up the composite device configuration. Following that, I manually added the second CDC ACM instance code to the project.On top of this working multi-CDC setup, I now want to integrate the Video Class layer. I have enabled the core video class inside the .ioc file and regenerated the code to expand the descriptor framework.The Challenge:To support high-bandwidth Isochronous (ISO) streaming for the Video class component, I integrated the uvcl (USB Video Class Library) middleware extracted from the ST Edge AI Getting Started exampleThe issue started exactly upo
Hello everyone,I’m using Nucleo STM32N6 for a project of mine, and I used template XIP to begin with.In template XIP, clock frequency of the XSPI2 is set to 50Mhz without any prescalers, and VDDIO3 is set to 1 (1.8V). That setup works fine for XIP up to 85Mhz clock frequency, but above that at BOOT (00) it fails as soon as it tries to jump to a application. I haven’t been able to resolve this problem. Is it setup, or something with EXT_MEM middleware?In MX25 datasheet it can be seen that frequency heavily depends on dummy cycles, and 86Mhz corresponds to 8 dummy cycles, but on 200Mhz it requires 20. In EXT_MEM setup there is a 8D8D8D case where i go into during setup and it sets object to 20 dummy cycles, but I’m not sure is it successful in actually forcing that setup. Any help would be welcome.
I am currently developing a USB Mass Storage application using the STM32H563ZI with the following architecture:PC ← USB ← NUCLEO-H563ZI ← SD CardThe SD Card and USB Device have both been tested separately, and each works correctly on its own.However, after integrating the two, I would like to use USB MSC to expose the SD Card connected to the STM32H563ZI as a removable storage device on the PC. The PC is currently unable to recognize the SD Card properly.I would like to ask if there is any example code or reference project for the STM32H563ZI that demonstrates USB MSC with an SD Card.Thank.
Dear ST Community Team,I am working on an STM32H747 project with a custom bootloader and OTA update mechanism. The OTA download completes successfully, metadata is written, and CRC verification passes. However, after the OTA apply step, the device does not reboot into the new firmware. The system continues running the old application, and I never see the expected reboot message from the bootloader.Details: Device: STM32H7 series Bootloader checks metadata at 0x081E0000 Staging slot at 0x08100000, App slot at 0x08020000 OTA side writes metadata fields (magic, version, staging base, app base, slot size, image size, CRC) Logs show: "Download OK" and "Applying..." but no reboot occurs
MCU / setupSTM32F746IGK, VDD = 3.3 V HSE 16 MHz, PLL: M=8, N=200, P=/2 → SYSCLK = 200 MHz (AHB=200, APB1=/4, APB2=/2) Scale 1 + Over-drive, FLASH_LATENCY_6 Already below the 216 MHz maximum Application executes from the ITCM Flash alias (0x002xxxxx; AXI alias 0x080xxxxx) Cortex I-Cache and D-Cache disabled at startup ART accelerator / prefetch enabled in HAL (ART_ACCELERATOR_ENABLE, PREFETCH_ENABLE) Bare metal, 1 ms cyclic scheduler, no RTOS X-CUBE-STL Flash TM every 1 ms: 1 KB window, HW CRC-32 (poly 0x04C11DB7, init 0xFFFFFFFF, word reverse in / reverse out). Expected CRC is a table built offline from the same image (zlib.crc32 / IEEE 802.3).What we see After several hours in RUN (typically ~11–19 h, not at POST), Flash TM returns STL_FAILED (0xD32D) on a 1 KB window. A software CRC of the same window also mismatches, so this is not only the CRC peripheral.On fail we dumped the 1 KB window from the CPU. The dump CRC always equals the TM computed CRC and differs from the programmed im
Hello,I am working on an STM32 USB CDC (Virtual COM Port) device using the STM32 USB Device Library (CubeMX-generated project).My goal is to have the device appear on Windows as a custom COM port name such as:MO3 Device (COMx)However, I want to achieve this without using a custom INF file, since distributing and installing drivers on every PC is not practical for my use case.From my current understanding:The Product String (iProduct) in usbd_desc.c can be modifiedThe Interface String (iInterface) in the CDC descriptor may also influence the displayed nameWindows typically uses usbser.sys and assigns "USB Serial Device (COMx)" by defaultFriendly Name seems to be controlled primarily via INF, not firmwareI have a few specific questions:Is there any reliable way to influence or override the COM port Friendly Name purely from STM32 firmware (USB descriptors), without an INF file?Does modifying iInterface (or using IAD / composite device descriptors) improve the likelihood of Windows using
I'm trying to get USBX Device MSC to work in Standalone mode (without RTOS). I loosely followed @B.Montanari 's example in https://community.st.com/t5/stm32-mcus/how-to-implement-usbx-in-standalone-mode/ta-p/614435, and also referred to a CubeMX example for Device MSC which does use an RTOS (STM32Cube_FW_U5_V1.6.0\Projects\STM32U575I-EV\Applications\USBX\Ux_Device_MSC). I'm running this on an STM32U5 dev kit.There are no errors, Windows recognizes the USB MSC device, and a drive shows up. But something isn't working quite right, since Windows tells me to insert a disk, won't format the volume, and doesn't seem to recognize its size.I'm not quite sure yet where things are going wrong, but I thought I'd see if this configuration is expected to work or if I'm overlooking any other examples before digging further...
I'm learning embedded development and would like to build a simple USB game controller as a practice project. I also manage a gaming website called TomodachiLifeROM, where I write about Nintendo games and gaming-related projects, so I'd like to experiment with custom hardware in the future.I'm considering using an STM32 development board, but I'm not sure which one would be the best starting point.Could you please advise:Which STM32 Nucleo or Discovery board is best for beginners? Is STM32CubeIDE sufficient for this type of project? Are there any official examples for USB HID game controllers? Which STM32 MCU family would you recommend for learning embedded programming and USB development?I've read through the STM32 documentation and examples, but I'd really appreciate recommendations from developers with hands-on experience.Thank you!
Hello everyone, I'd like to use the LevelX API with FreeRTOS on an STM32H5 microcontroller. I know that LevelX is typically used with AzureRTOS, but I'd like to know if ST provides any guidance on integrating it with FreeRTOS or if anyone has any suggestions on how I can do this. Thanks for your help.
I’m trying to implement USB mass storage class device standalone(no RTOS) on nucleo board STM32U575ZI-Q, using RAM for memory.I tried adapting these steps : but right now, in MX_USBX_Init(), inside ux_device_stack_initialize , at this point:#if UX_DEVICE_ENDPOINT_BUFFER_OWNER == 0 /* Obtain some memory. */ endpoints_pool -> ux_slave_endpoint_transfer_request.ux_slave_transfer_request_data_pointer = _ux_utility_memory_allocate(UX_NO_ALIGN, UX_CACHE_SAFE_MEMORY, UX_SLAVE_REQUEST_DATA_MAX_LENGTH); /* Ensure we could allocate memory. */ if (endpoints_pool -> ux_slave_endpoint_transfer_request.ux_slave_transfer_request_data_pointer == UX_NULL) { status = UX_MEMORY_INSUFFICIENT; break; }#endifit goes : status = UX_MEMORY_INSUFFICIENT;Because of that, ux_device_stack_initialize returns UX_ERROR; witch i think causes Hard fa
ST Community highlights – April to June 2026
Already have an account? Login
No account yet? Create an account
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.