Ask questions and find answers on STM32Cube packages, including HAL, LL and middleware, and expansion software.
Most recent activity
Hi all,I am having issues with Clock setup for Stm32h755. Especially regarding the M4 core. Currently, I only run the M4 core. The M7 core has no valid firmware. Is that even a supported mode?I try to setup a rather basic clock setup but the setup keeps failing at the call: HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_4), which will return an not ok return value.I also tried using HSI and other different setups. But it seems the keep failing in the same way. Interestingly... When I simply ignore the error. Then most stuff seems to work just fine. I got ADC, SPI, Timers working. However, I am not sure where the issue is with the clock configuration.The entire clock setup: static void SystemClock_Config(void) { RCC_OscInitTypeDef RCC_OscInitStruct = {0}; RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; __HAL_RCC_SYSCFG_CLK_ENABLE(); RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI | RCC_OSCILLATORTYPE_HSE; RCC_OscInitStruct.HSEState = RCC_HSE_ON; RCC_Os
BackgroundWe have a battery-powered device using:MCU: STM32 (STM32L4series)Modem: Quectel BG95 (cellular)Communication: UART with Idle Line Interrupt (HAL_UARTEx_ReceiveToIdle_IT)Power mode: Device goes to sleep periodically, wakes up to communicate with modemArchitecture PatternOur communication pattern:Device wakes from low-power modeCall low-level AT command function that:Enables UART RX Interrupt with Idle Line detection (HAL_UARTEx_ReceiveToIdle_IT)Sends AT commandWaits for response with timeoutDisables interrupt (HAL_UART_Abort_IT)Process responseGo back to sleepThis means we re-enable/disable UART Idle Line interrupt on every transaction (potentially hundreds of times per day).UART + Ring Buffer Setup:#define RING_BUFFER_SIZE 2048 #define ISR_BUFFER_SIZE 1024 typedef struct { lwrb_t rb; // lwrb ring buffer volatile bool rx_data_ready_flag; // Flag set by ISR uint8_t rb_buffer[RING_BUFFER_SIZE]; // Ring buffer storage uint8_t isr_buffer[ISR_BUFFER_SIZE]; // Intermediate buff
Hi ST community,I am facing an issue of 10us delay between CS line going low and SPI SCK start, when I am doing SPI communication with a slave device, which supports upto 15MHz SPI communication.Below is the main.c file snippet for your reference. Please help in fixing the issue. I have also attached complete code file as well as the CRO capture of SPI comm for your ref. Thanks in advance!/* 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. * ***************************************************************************
Good evening, I need freeRTOS tick speed to be greater than 1kHz, I tried to change the configTICK_RATE_HZ parameter but get a divby0 error which I can't fix. Is there a way garanteed way to achieve what im looking for? Thx in advance
Hello! This is the first time I'm using an STM32L0 (...11F4Ux) and also the first time I've tried implementing an I2C IRQ Handler. The code snippet mostly works, but there's a bug in which a READ commands sends data from the previously requested register, giving bad data. Basically, the data I receive is old by 1 request, which tells me this IRQ Handler is not handling the repeated start correctly. The exception to this is that the very first READ command is correct when I start up I2C tools on a RP5. I've been trying to figure out this bug for a couple of days now, so I'd really appreciate any help from more experience developers, thank you!Details:Flash limited to 16KB, so using LL drivers onlyThis snippet is broken out into its own file and is called by I2C1_IRQHandler();WRITE commands work perfectly fineWhen placing a stop at the LL_I2C_TransmitData8(I2C1, tx_val);, I get data from my previous command without this line executing. Master: Raspberry Pi 5
Hey everyone,I'm currently trying to integrate the STM32 FP-AUD-AEC-1 software package in a multithreaded environment (ThreadX) on an STM32wb55rev7 mcu chip. Library compiles and runs but eventually hard faults during thread initializations. Any advice or help would be appreciated, and if there's any additional info needed please lmk.
Hi community,Before I start discussing my specific issue, I would like to know if dual USB host operation is allowed on STM32H7 MCUs. The H7 MCU has both FS and HS USB cores, and I want to configure both FS and HS as USB hosts, not using the OTG feature. The HS USB core will also run in full-speed host mode without an external PHY, with each host having its own USB port. Are there any potential issues with this configuration?I encountered unexpected behavior during project development: USB FS MSC class functionalities were affected when devices were plugged into the USB HS port.Here is my USB class setup:The USB FS core is registered with two classes — MSC class and a custom printer class.The USB HS core is registered with a HID class.All classes worked individually.If no device is plugged into the USB HS port, the USB FS port works normally. It prints correctly when connected to a thermal receipt printer and creates text file reports using FATFS when connected to a flash drive.However
Hi everyone, my custom board previously had an STM32F746BGT6. Since we were looking for a microcontroller with a graphics accelerator, we opted for the STM32H743BIT6 (which is pin-to-pin compatible). All the peripherals work, but I'm having trouble initializing the SDRAM (IS42S16160G-6TL). I set the clock to 216 MHz on Cube, and with a prescale of 2 and an oscilloscope, I get 108 MHz. However, the program crashes (neither returns an error nor continues) when I send the PALL configuration.I'm keeping the same declarations in the previous version (STM32F746BGT6), which is currently working. How can I fix this? static void MX_FMC_Init(void) { /* USER CODE BEGIN FMC_Init 0 */ /* USER CODE END FMC_Init 0 */ FMC_SDRAM_TimingTypeDef SdramTiming = {0}; /* USER CODE BEGIN FMC_Init 1 */ /* USER CODE END FMC_Init 1 */ /** Perform the SDRAM1 memory initialization sequence*/ hsdram1.Instance = FMC_SDRAM_DEVICE; /* hsdram1.Init */ hsdram1.Init.SDBank = FMC_SDRAM_BANK2; hsdram1.Init.Column
There have been previous posts about determining how the DFU serial number is formed from the 96-bit Unique ID. However, when using the ROM bootloader for the STM32F723xx MCU I don't see unique serial numbers at all. I am always seeing the same DFU serial number in the iSerial string of the USB descriptor set to "STM32FxSTM32" no matter which device I query. I haven't found any mention of a setting that I need to configure in order to enable unique serial numbers for DFU, but I was hoping that someone in the community might have a suggestion. Or at least be able to confirm that it is expected behavior for the DFU serial number to always be "STM32FxSTM32" for all of my STM32F723xx MCUs.Thanks for the help!
Hi, this is my first post here and one of my first experiences with the STM32.I'm working on an STM32H7A3ZI-Q development board. I've connected an Adafruit PDM microphone to SAI1_A with clock on PE2 (SAI1_CK1) and data on PE6 (SAI1_D1). I'm not an expert on PDM microphones; I used to acquire analog data from an amplified microphone with an ADC and timer 2 (everything worked perfectly) and then transferred the data via UART to my PC, where I listened to it with a Python script.Now I need to switch to a PDM microphone.Now, I've configured this PDM MONO microphone to be used in PDM mode with CK1, with an 8-bit data size and a 16-bit frame, the same slot size as the data, 2 slots (the IOC forces me to use even numbers), free protocol, and asynchronous sync input.I get the peripheral clock from PLL2 and it's 40.96 MHz. I set the frequency divider after init (the HAL code generator doesn't generate the correct divider) to get a 1.024 MHz output to the microphone, and the oscilloscope shows t
Post edited by ST moderator to be inline with the community rules especially with the code sharing. In next time please use </> button to paste your code. Please read this post: How to insert source code Hi, On checking, I noticed a mismatch between the expected sampling frequency (44.1 kHz) and the actual frequency (46.875 kHz). Could this be the cause of the noise? Any suggestions on what might be going wrong? For reference, I’m using SAI1_A with circular linked-list channel 12 of GPDMA1. The configuration details for SAI and GPDMA are provided below. GPDMA Configuration: handle_GPDMA1_Channel12.Instance = GPDMA1_Channel12; handle_GPDMA1_Channel12.InitLinkedList.Priority = DMA_HIGH_PRIORITY; handle_GPDMA1_Channel12.InitLinkedList.LinkStepMode = DMA_LSM_FULL_EXECUTION; handle_GPDMA1_Channel12.InitLinkedList.LinkAllocatedPort = DMA_LINK_ALLOCATED_PORT0; handle_GPDMA1_Channel12.InitLinkedList.TransferEventMode = DMA_TCEM_LAST_LL_ITEM_TRANSFER; han
I plan to adapt the USBX host example to act as a bridge the way the current device example does. Then I can have a full link UART -> Host -> USB -> Device -> UART and vice versa. However, the data sent to the device is not displayed over its UART as expected and the device stops obtaining additional messages from the host. How can I fix this so I can move on the adapt the host example and use the device to debug?Overall Goal: Implement a USB to UART bridge using USBX Host mode on the NUCLEO-U575ZISteps:Run the Ux_Device_CDC_ACM example from the example selector on a NUCLEO-U5A5ZJConfirm device example functionality:Connect the NUCLEO-U5A5ZJ USB-C port to the PC.Open two Teraterm windows: UART serial port and VCOM (over USB) portTyping into either Teraterm window causes the text to appear on the other window. This confirms bidirectional USB to UART bridge on the NUCLEO-U5A5ZJ in USBX Device mode.Modify the device example due to lack of VBUS power bet
Hello,I am using STM32CubeIDE with the STM32F429I-Discovery board,and my goal is to connect it with the MT9M001 camera module.As a first step toward that, I would like to make the LCD display work properly.In the STM32Cube_FW_F4_V1.28.0 package,there are many sample projects organized as follows: Projects > STM32F429I-Discovery > Examples > LTDC > LTDC_Display_2Layers If I import this Example project into STM32CubeIDE,will the LCD automatically display the sample image?Or do I need to perform some additional setup or configuration steps?I would appreciate any advice or guidance.
Hi ST Community, Our project uses STM32H743 (LQFP100). The system clock is set at the max 480MHz. The USB Device interrupts would occasionally cause a HardFault. For example, if we plug in or unplug the USB. The data hpcd would occasionally be 0xFFFFFFFF. Sometimes it's the hpcd->pClass[0] We have enough size for the stack and heap. A "workaround" is to lower the system clock to 240MHz... What we don't understand is that the USB clock source is from the "RC48" 48MHz clock, independent from the system clock, which sources the HSE. How does lowering the system clock help resolve this issue? We also tried using HSE to generate the 48MHz for the USB, but the USB just doesn't run. Is there other settings or configurations that we might have set incorrectly? Another thing to mention is that we have a conflict with the RCC CRS SYNC. Attached is our clock configuration and .ioc file for your ref
Hello, my project is using all 4 SPI interfaces on the STM32G474. SPI1-3 all work flawlessly, but SPI4 never triggers the RXNE flag. All SPI buses are configured identically, with the only differences being the pinouts and APB1 vs 2 bus. I am polling the transactions directly.Initialization:if (hspi_.Instance == SPI1) LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_SPI1); else if (hspi_.Instance == SPI2) LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_SPI2); else if (hspi_.Instance == SPI3) LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_SPI3); else if (hspi_.Instance == SPI4) LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_SPI4); LL_SPI_SetMode(hspi_.Instance, LL_SPI_MODE_MASTER); LL_SPI_SetTransferDirection(hspi_.Instance, LL_SPI_FULL_DUPLEX); LL_SPI_SetDataWidth(hspi_.Instance, LL_SPI_DATAWIDTH_8BIT); LL_SPI_SetClockPolarity(hspi_.Instance, LL_SPI_POLARITY_LOW); LL_SPI_SetClockPhase(hspi_.Instance, LL_SPI_PHASE_1EDGE); LL_SPI_SetBaudRatePrescaler(hspi_.Instance, LL_SPI_BAUDRATEPRESCALE
Hi,I am new to STM32 and using DSI for the first time.I generated the simplest code for bringing up a custom DSI display board using CubeMX and TouchGFX. The code compiles successfully, but the CubeMX-generated function HAL_DSI_Init() within MX_DSIHOST_DSI_Init() (code snippet below) returns HAL_TIMEOUT at line 26.By default, HAL_TIMEOUT is set to 100ms, which is quite a long time... /* Get tick */ tickstart = HAL_GetTick(); if ((hdsi->Instance->PCONFR & DSI_PCONFR_NL) == DSI_ONE_DATA_LANE) { while ((hdsi->Instance->PSR & (DSI_PSR_PSS0 | DSI_PSR_PSSC)) != (DSI_PSR_PSS0 | DSI_PSR_PSSC)) { if ((HAL_GetTick() - tickstart) > DSI_TIMEOUT_VALUE) { /* Process Unlocked */ __HAL_UNLOCK(hdsi); return HAL_TIMEOUT; } } } else { while ((hdsi->Instance->PSR & (DSI_PSR_PSS0 | DSI_PSR_PSS1 | DSI_PSR_PSSC)) != (DSI_PSR_PSS0 | \ DSI_PSR_PSS1 | DSI_PSR_PSSC)) { if ((HAL_GetTick() - tickstart) > DSI_TIMEOUT_VALUE) { /*
Hi ST community// --- EDIT --- Missed preview and made some corrections / clarificationsI'm looking for a way to mount a SD card using the Azure RTOS UsbX MSC class, while the MCU is running. The code is mostly based on the ST examples, e.g.:https://github.com/STMicroelectronics/x-cube-azrtos-h7/tree/main/Projects/STM32H735G-DK/Applications/USBX/Ux_Device_MSC The example expects that the SD card is already inserted on power up - therefore the MX_SDMMC1_SD_Init() is called before the USBX device is registered. Therefore the LBA and Blocksize values are already available when the USBX device is registered.I want to have a more general case, where I can remove and insert a SD card while the application is running. A separate thread (SD_thread_entry) which handles this behaviour and is waiting for the SD card pin to be detected. The card is then power reset, the HAL is initialized and the CardInfo read:void SD_thread_entry(ULONG thread_input) { // Thread variables ULONG flags; bool
I have integrated lwip on my STM32H563RGT6 library and my requirement is to establish connection to my AWS endpoint from MCU to the cloud along with certificates. help me by providing the necessary stacks.Were my requirement is to send/publish some data into mqtt inside the IOT core AWS.
Hello, I've built a project with an STM32F767 and a USB HID connection. I also have a Visual Studio 2010 application to set PA0 to 1 for testing. My connection is established, and in Device Manager, the USB Custom HID device is recognized, but I can't set PA0 to 1. I built my USB HID code using Cube MX and the HidLibrary.dll driver for VB2010. I don't understand why I'm having this problem. Can anyone help? I am able to get a result, temperature acquisition and change of state of PA0 in CDC mode. Best regards. My code is attached. Sébastien.
Hi @FBL I am working on a similar project like This one (USB CDC ACM device with Power Delivery in Source mode using USBX in standalone mode, FreeRTOS and USBPD with a TCPP02). The STM32 used is the H573I.I have found some code to add in the function USBPD_DPM_Notification() in usbpd_dpm_user.c (solution you gave).But in my code, the functions called are undefined because the file usbpd_usb_if.c is not generated. What I am missing?
My goal is to use timers to follow the required timing steps for a module I’m working with. To achieve this, I decided to use two timers — TIM1 and TIM2.TIM2 is responsible for counting the T1 time step. For this, I’m using One-Pulse Mode, so TIM2 is configured to count a 2 µs delay.After TIM2 finishes, TIM1 should be triggered. TIM1 also operates in One-Pulse Mode, this time generating 25 pulses to imitate the PD_SCK signal (as shown in the datasheet timing diagram).Each pulse should stay HIGH for half of the full period (20 µs), so 10 µs HIGH and 10 µs LOW.During the generation of those 25 pulses, the DOUT pin (connected to TIM2_CH2) should be sampled. At that time, TIM2 should be disabled.Unfortunately, it is not working, this is my code:void start_measurement(void){ if (HAL_TIM_OnePulse_Start(&htim2, TIM_CHANNEL_2) != HAL_OK) { Error_Handler(); } if (HAL_TIM_Base_Start(&htim1) != HAL_OK) { Error_Handler(); } } } void HAL_TIM_PWM_PulseFinishedCallba
Hi everyone,I’m using the WS28XX library by NimaLTD from GitHub::backhand_index_pointing_right: https://github.com/nimaltd/ws28xxSetup:STM32F103TIM3 Channel 4 as PWM outputData pin on PB18×8 WS2812B LED matrixInitialization and pixel updates work perfectly:WS28XX_Init(&ws, &htim3, 72, TIM_CHANNEL_4, 64); WS28XX_SetPixel_RGB(&ws, 0, 100, 0, 0); WS28XX_Update(&ws);Issue:Immediately after power-up, some LEDs (LED 41 an 10-12 following) light up before WS28XX_Init() is even called.On the logic analyzer, I can see a valid WS2812B data burst right after startup,covering up to LED 40 with "0", followed by a ~100 ms gap,and only then my actual data frames appear. Once WS28XX_Update() runs, everything looks correct and stable.Questions:What generates this initial data burst on the PWM pin?Could TIM3 or DMA be triggered automatically during startup?Does CubeMX initialize the PWM channel before main() executes?Has anyone seen similar behaviour with WS2812B + DMA on STM32?Than
Hi,On the STM32N6570-DK board, I’m running an application that uses TouchGFX and FileX.Both the TouchGFX frame buffer and FileX temporary buffers are located in external memory (XSPI1).I’m observing intermittent write failures when SDMMC IDMA is used for direct transfers from external memory to the SD card. The issue appears as incorrect data being written — typically affecting the entire transfer block (a few kilobytes), as shown in the image below.External memory is attributed as non-cacheable all the time. Selecting various shareability options for the ext memory introduces very strange behavior, so it's been disabled finally.However, when the write operation is performed from internal SRAM (either via an intermediate buffer in SRAM or the FileX driver’s scratch buffer), the transfers are always successful.I’ve also found a very similar case involving the TouchGFX frame buffer and SD card buffer in external memory on the STM32F7 platform.https://community.st.com/t5/stm32-m
Not sure whether its me looking at the wrong places but I can't find the project that came with the Nucleo-FR401RE eval board? Looked under the STM32CubeF4 examples, nothing seems to match.Can somebody point me to the right place?Thanks-- Alex
Hi All, I am using ThreadX on an STM32H753. The version of ThreadX being used is 6.1. I use this older version because it is ISO-62304 certified. All is functioning as desired but each time I execute code generation from CubeMX the ThreadX files are overwritten with version 6.4 (not certified). Is there any way I can avoid the update of ThreadX when I regenerate the code from CubeMX? Thank You, Gil
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.