Ask questions and find answers on STM32Cube packages, including HAL, LL and middleware, and expansion software.
Most recent activity
Hi Community,Today you will provide the answers, and I will ask the questions!Looking at the statistics gathered by our tools (assuming customer consent given), we can see the huge popularity of designing software relying on an RTOS. FreeRTOS is widely used, and we assume that the adoption Azure ThreadX will also spread quickly.As CubeIDE tools guys, we have invested some effort in RTOS debug features. To quickly summarize the RTOS debug offer, let's make a list:Window > Show > View > Other > FreeRTOS / ThreadXProvides views to visualize kernel objects for the 2 RTOSesDebug config > Debugger > Enable RTOS ProxyWill allow the debugger to unwind and display the full call stack for ALL threads in the RTOS, not only the one currently in context!For Azure ThreadX CubeIDE 1.8.0 can also conveniently export trace logs to be visualized "offline" in Microsoft TraceX toolIn our view the RTOS support is now quite decent! ;)What is puzzling is the lack of feedback and bug reports
Hi,Having successfully installed SW4STM32 I recently tried to build the example project detailed on the RIP Tutorial web page entitled "First time setup with blink LED example using SW4STM32 and HAL library". This "threw up" four errors. The first was classed as a fatal error whilst the other three errors involved "make" which I believe are due to the first error.Within the IDE, on the "Problems" tab, the first error is listed as follows.Description: fatal error: usbh_conf.h: No such file or directoryResource: usbh_conf.hPath: /STM32F4_Discovery_Blinky/Middlewares/ST/STM32_USB_Host_Library/Core/Inc line 28 C/C++ ProblemWithin the ".../Inc/" directory is a further subdirectory called "usbh_core.h" within which is the "offending" (non-existent?!) usbh_conf.h This header file is clearly listed on both the Project Explorer and Outline tabs within the IDE. Opening this file shows the following. (How could this be done if the file did not exist ?!) /** **********************************
The integrated ST-Link debugger/programmer on STMicroelectronics NUCLEO boards is widely appreciated for its ability to output messages to a serial port, enabling easy debugging and communication with host PCs. However, setting up the board to not only send but also receive commands from PC-based applications such as Tera Term requires additional programming effort. This guide will walk you through the steps to implement bidirectional serial communications, allowing your NUCLEO board to interact dynamically with your computer.
Hello Community,I tried with different boards (073, 093, 533, 401) to work with the SPI1 or SPI2.I used the examples, but there is no clock on an SPIx clock pin.e.g. HAL_SPI_Transmit(&hspi1, SpiData, 2, 100); Has anybody a working STM32Cube porject to load in the STM32CubeIdefor an SPI only master (no slave no DMA) in the send modus via MOSI pin.Thank youMichael
Hello everyone!I am currently working on a speaker project that gets audio data from a microsd card over spi and sends it over i2s with DMA.I noticed that the main issue is the latency from the sd card so i got the adivce to use a triple pointer ring buffer.I searched for implementations on triple buffering with i2s but couldn't find a single one.I tried implementing it but it didn't work.(i added the code file to the post)Does anybody have good resources to learn this?
Hello, I am working with STM32H750 and encountered an issue related to SPI communication in low-speed mode. Issue description When operating SPI in low-speed (e.g. prescaler /128, ~195 kHz), I observed that: The last SCLK high pulse becomes shorter than the others This may affect correct sampling of the last bit on the slave side This behavior seems consistent with Errata 2.22.6: "Truncation of SPI output signals after EOT event" Root cause understanding From the errata description and signal observation, it appears that: The SPI peripheral is disabled too quickly after the EOT event Since the CPU (PCLK domain) is much faster than SCK,the last SCLK high period is truncated Implemented workaround To address this, I modified the HAL driver (stm32h7xx_hal_spi.c::SPI_CloseTransfer()) to introduce a short delay between EOT and SPI disable, only in low-speed conditions. Instead of using a fixed delay, I implemented a minimal delay proportional to SCK period, to avoid unnecessa
I'm trying to get a basic example of USB comms working on an STM32U575 chip working. I've looked into several bits of example code, but they all just say "it should just work" and don't. STM32CubeU5 Example. This seems like a logical choice, as it's packaged in the FW pack that I'm currently using. But I can't get the VSCode STM32Cube extension to recognize that it's a project and build. I've tried moving the STM32CubeIDE directory contents (.cproject, .project, etc.) to the root of the application directory, but it's still not being recognized. Also, looking into Core directory, I don't see any code that demonstrates USB data transfer. It looks like a template for starting with AzureRTOS, but nothing beyond that. What am I missing?USB_Device Middleware. This is one example that describes using a middleware called USB_DEVICE, and then calls to a function CDC_Transmit_FS(). There are several other examples floating around with this. H
Hi all, X-CUBE-AUDIO-KIT has a project for STM32H573I-DK but this discovery kit has a very small LCD screen. I see the soon to be available STM32H5F5J-DK with a larger screen. Both of these kits have an M33 core MCU so technically the example for one could be ported to the other but that's not something I'll like to do. Will there be an upgrade to X-CUBE-AUDIO-KIT anytime soon and will it include any examples for STM32H5F5J-DK? Thanks
Hi everyone, I’m working on an STM32N6 project configured with: ThreadX running in Non-Secure SAU configured RISAF configured External Memory Manager enabled(Load and Run mode) The project is very simple. However, when debugging the Non-Secure application, as soon as tx_thread_schedule() is called, execution jumps to HardFault.The Fault Analyzer reports: “Attempt to do exception with bad value in EXEC_RETURN number (INVPC)”. The code is loaded in external flash memory using Load and Run mode, the signed bin files are uploaded in the external flash using STM32CubeProg and then debugged using STM32CubeIDE.Has anyone experienced INVPC errors on STM32N6 with ThreadX in Non-Secure?Any suggestions would be greatly appreciated.
Hello everyone,we have a setup where the STM32U375 MCU is the slave in I2C communication.We want to NACK the host request on certain conditions. Basic description of our firmwareWe are internally using a register structure in the MCU and the host can send a read/write request via I2C to access the contents of the registers.The current register address is handled internally by the firmware and automatically incremented on each byte written / read.For example, if the requested register address is 0x0001, the host should not be allowed to write to the register but only to read it.First we receive the one-byte device address, then the 2-byte register address.After receiving the 2-byte register address, we can check if the host is allowed to read/write on this register and want to either ACK or NACK the communication on I2C1. Solution tried but not successfullIt seems when HAL_I2C_AddrCallback is called then it is already too late to NACK the current byte and the hardware has alre
Hello, I'm trying to do a quick test with the STM32F412G-Discovery kit and the analogue microphone input.I use this example https://github.com/STMicroelectronics/STM32CubeF4/tree/master/Projects/STM32F412G-Discovery/Examples/BSPwith the menu #### AUDIO REC ANALOG ####.The problem is that the firmware crashes at the line BSP_AUDIO_IN_Record(internal_buffer, AUDIO_BLOCK_SIZE); void AudioRecAnalog_demo (void) { AudioRec_SetHint(); /* Initialize Audio Recorder */ if (BSP_AUDIO_IN_InitEx(INPUT_DEVICE_ANALOG_MIC, DEFAULT_AUDIO_IN_FREQ, DEFAULT_AUDIO_IN_BIT_RESOLUTION, DEFAULT_AUDIO_IN_CHANNEL_NBR) == AUDIO_OK) { BSP_LCD_SetBackColor(LCD_COLOR_WHITE); BSP_LCD_SetTextColor(LCD_COLOR_GREEN); BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize() - 95, (uint8_t *)" AUDIO RECORD INIT OK ", CENTER_MODE); } else { BSP_LCD_SetBackColor(LCD_COLOR_WHITE); BSP_LCD_SetTextColor(LCD_COLOR_RED); BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize() - 95, (uint8_t *)" AUDIO RECORD INIT FAIL", C
Hello, a while ago I ran into a problem with my system consuming to much power.After searching this forum, I came across this post: https://community.st.com/t5/stm32-mcus-wireless/using-stm32wb55-freertos-osthreadflagswait-can-return/td-p/767777 It describes how osThreadFlagsWait adjusts the timeout and explains that this can cause problems.In the thread i described my problem with this function (see below), but I was asked to post that question in a new thread.No problem, of course, so I did :) I discovered another annoying problem with osThreadFlagsWait.I was measuring the current consumption to check if it was sufficiently low in case the system goes into stop2.To my surprise, I discovered that it wasn't (draining 6mA instead of 30uA).After a long search, I discovered that the high-consuming task state wasn't "suspended", but "blocked"!A little later, I realized this would happen when I called osThreadFlagsWait.I assumed the timout value could be osWaitForever, so the task wo
Hello everybodyI'm working with USB PD sink on my own board with STM32G071KBT6 microcontroller ad development software: STM32CubeIDE 2.1.1 and STMCubeMX 6.17 (freeRTOS, without TCPP, with my own protection of VBUS and CC lines).I want to set sink to APDO 24 V (if the charger accept it) or otherwise 20 V PDO.Unfortunatelly if the charger, which I use, not accept APDO 24 V, it send hardreset and cut off the Vbus, so I can't use the flag to inform about the status (APDO or PDO).Is there any way to read the PDOs from the source and on based on this choose APDO or PDO?I have no structure DPM_Ports, and USBPD_DPM_GetDataInfo(PortNum, USBPD_CORE_DATATYPE_RCV_SRC_PDO, buffer, &size);returns size = 0;Best regards
Hi everyone,I have developed a custom USB DFU HOST class, which I use to update other stm over the usb.I was first on the F4 series, but now switched to the G0 series because of this issuehttps://community.st.com/t5/stm32-mcus-embedded-software/usb-writepacket-stuck-in-infinite-loop/td-p/870532I am using external bypass clock, but the update worked also on HSI just fine.These are all the bootloader versions and the chips I was able to update without any issues:14.4 H573I-DK9.2 L562RET69.0 F446ZE-NUCLEO3.3 F207ZG-NUCLEOBut when I try to update the H745I-DISCO or the H743, the update does not work.I checked the bootloader version on the H745I-DISCO and it's 9.0, which is the same version as F446ZE-NUCLEO which I update without any issues.The update process to update H745I-DISCO worked one in 100 or 200 tries.I have tried messing with timings, clocks, adding prints in the interrupt to slow things down (I know that it's a bad practice), an
Hello,after setup SPI1 and setting CSTART=1, I expected that SPI is send immidiatly on bus.(I toogled PE00 with CSTART=1)I couldn't find some that explains that behaviour. It behave the same, if I use DMA or writing directly to TXDR.Do you have an idea ?My testcode. SPI1->IFCR = 0xFFFF; // Clear all flags MODIFY_REG(SPI1->CR2, SPI_CR2_TSIZE, BufferSize); SPI1->CR1 |= (SPI_CR1_SPE); SPI1->CR1 |= SPI_CR1_CSTART; GPIOE->ODR &= ~(1 << 0); for (u32 i = 0; i < BufferSize; i++) { LL_SPI_TransmitData8(SPI1, pBuffer[i]); }CPU is set to 160Mhz and SPI Prescaler is 256
Setup: STM32F411RE + STM32CubeIDE + X-CUBE-AZRTOS-F4 v1.1.0 + TIM4 as HALtimebase Problem: Thread runs once, toggles LED, then hangs inside tx_thread_sleep(50) and never wakes up. Debugger shows:System Timer thread → State: SUSPENDED, Run Count: 0Thread 1 → State: SLEEP, Run Count: 1 System Timer never runs, so sleeping threads never wake up.Question: Why is the System Timer thread never getting scheduled? Any known issues with X-CUBE-AZRTOS-F4 v1.1.0?
Hi,We are running a crypto key generation library on both an STM32G474 (170MHz) and an STM32H563 (240MHz).Over about 80 runs, the average generation time is around 12 seconds for the H5 and 38 seconds for the G4.These times are fine for our application (although faster would be better) but I am curious why the G4 is over 3 times slower as I would have expected something more like 40% longer generation times.The arithmetic part of the library uses some assembler functions for long multiplications and, for both processors, these seem to have picked a section for "Armv6-M (or later) with DSP Instruction Set Extensions."The compiler flags being used are listed here. The repeated sections are because I still haven't really figured out how cmake is generating them but I believe the relevant differences are:-mcpu= cortex-m4 or cortex-m33-mfpu= fpv4-sp-d16 or fpv5-sp-d16compile C with /usr/bin/arm-none-eabi-gcc__VERSION__ "14.2.1 20241119"G4 Flags:C_FLAGS = -mcpu=cortex-m4 -mfloat-abi=hard -mf
Hi,I am using a STM32WB5MMGH6 BLE module and for some reason HAL_IncTick() is not being called. It is baffling because it was working perfectly well when I was recently working on it before switching to another project for a week.I stripped the project down to almost nothing and placed a HAL_Delay() right after the CubeMX-generated initialization code in main(). So no custom code could do anything to affect that behavior (like turning off interrupts etc). However, the delay never completes.The code is stuck inside the while loop in HAL_Delay() because HAL_IncTick() is never being called (i.e. the system tick is not incrementing) so the HAL_GetTick() always returns 0. __weak void HAL_Delay(uint32_t Delay) { uint32_t tickstart = HAL_GetTick(); uint32_t wait = Delay; /* Add a freq to guarantee minimum wait */ if (wait < HAL_MAX_DELAY) { wait += (uint32_t)(uwTickFreq); } while ((HAL_GetTick() - tickstart) < wait) { } } The Timebase Source is set to SysTick
Hi,Observed ProblemHAL_ADC_Start_DMA() returns HAL_OK, TIM2 starts, ADC begins converting (confirmed via ADC_ISR in debugger), but HPDMA1 Channel 0 immediately raises a DTE (Data Transfer Error), triggering the error callback. EnvironmentMCU: STM32N657X0HXQBoot mode: Two-stage boot — FSBL + XIP Application (external flash via XSPI2, mapped at 0x70100400)Toolchain: STM32CubeIDE / GCCHAL: STM32CubeN6 (latest)Security mode: Full Secure — all code runs in Secure Privileged mode, no NonSecure worldProject DescriptionThis is a minimal reproduction project containing only:ADC1 — single channel (PA8 / INP5), triggered by TIM2 TRGO, DMA circular modeHPDMA1 Channel 0 — linked-list circular mode, PERIPH_TO_MEMORY, ADC1 → AXISRAM2TIM2 — provides ADC trigger at fixed rate (Period=799, no prescaler)No ETH, no LwIP, no NPU — deliberately stripped down to isolate the DMA issue.Memory Layout (Linker Script) ROM (XIP) : 0x70100400, 511K — code in external flashRAM (FLEXRAM) : 0x34000000,
Hi Support,I am unfamiliar with this project structure where the generated project contains separate boot/ and appli/ directories. I created the project using STM32CubeMX with the CMake toolchain selected, and noticed that two separate .elf files are produced after building.I am unsure which of these should be used when flashing the board using STM32CubeProgrammer. Currently, I am able to successfully flash the device using the .elf located in the /boot/ build directory, but I cannot flash the .elf located in /appli/.Could you clarify the purpose of the boot/ and appli/ directories and which firmware image is intended to be flashed? Additionally, is there a way to generate a more traditional single-application project structure (i.e., without separate boot and application directories) when targeting the STM32H7S3L8?Any guidance or suggestions would be greatly appreciated.
Post updated by a ST moderator: 1- Title translated from Chinese to English. 2- Used </> button for the code. I am attempting to transplant the latest FreeRTOS kernel program on the basis of the project generated by CubeMX. When FreeRTOS uses HSI, there is no problem and it runs normally. However, when using HSE, an initialization timeout occurs. Without transplanting FreeRTOS, HSE can pass the initialization normally.My approach was to incorporate the xPortSysTickHandler, xPortPendSVHandler, and vPortSVCHandler required by FreeRTOS into the three functions in the it file. Then, I found that it was the xPortSysTickHandler() within the systick_handler() that was causing the issue. After commenting it out, the HSE could be initialized normally. So, I'm asking on the forum what the reason is and if there's a way to solve it. AI is not reliable. void SysTick_Handler(void) { /* USER CODE BEGIN SysTick_IRQn 0 */ /* USER CODE END SysTick_IRQn 0 */ HAL_IncTick(); /* USER CODE BEGIN
So, when I was actually trying to work on the STM32F103CBT6TR MCU which is placed onto the custom board while I tried to toggle PA1 in it which only gave floating values then in debug, I found out it is going into Hard Fault Handler so then again I replaced them with new IC but again it is coming as same Hard Fault Handler. I also tried for pin 0 too. What can we do to solve this?
What is recommended way to change or override the 'SYSTEM_CLOCK' symbol defined in 'tx_initialize_low_level.S' , that feeds into the threadX systick period calculation? I could change the SysTick after threadX is started -- that is probably the easist fix. I dont want to modify the threadX submodule in my project, as its pulled from the internet at some pinned version. I've currently made a local copy of 'tx_initialize_low_level.S', and then I use CMake to select that particular S file - so that solves the problem, but I dont like having a personal copy of a file from the submodule. After experimenting for some time, and then scouring the web, I cant find any suggestions on this issue, there are some changes that can be imported via having your own 'tx_user.h' -- but I cant see anything that can override the SYSTEM_CLOCK. Cheers, Nick
HI, I'm capturing image as RGB565 using camera over DCMI on DMA. Capturing is complete and data is available. Now I need it to convert into JPEG format. But, the JPEG in/out DMA is not working. Any help will be appreciated. snippet: MX_DCMIQueue_Config(); HAL_DMAEx_List_LinkQ(&handle_GPDMA1_Channel12, &DCMIQueue); __HAL_LINKDMA(&hdcmi, DMA_Handle, handle_GPDMA1_Channel12); MX_JPEGInQueue_Config(); HAL_DMAEx_List_LinkQ(&handle_GPDMA1_Channel13, &JPEGInQueue); __HAL_LINKDMA(&hjpeg, hdmain, handle_GPDMA1_Channel13); MX_JPEGOutQueue_Config(); HAL_DMAEx_List_LinkQ(&handle_GPDMA1_Channel14, &JPEGOutQueue); __HAL_LINKDMA(&hjpeg, hdmaout, handle_GPDMA1_Channel14); Thatnks-Shubhendu Using following:1. STM32CubeIDE, Version: 1.16.12. MCU: STM32U5G9BJYXQ3. Camera: OV7725 @devjeet-adben
I am trying to develop a GUI application with the STM32H7S78-DK. I want to send uart data from the board over wires to a raspberry pi. To simplify the process without graphics I'm just trying to send a simple "Hello" string over UART7. From what I can see from the data sheet, UART7 is connected to pins PE7 and PE8, which correspond to D0 and D1 on CN14 on the arduino headers by default. Please correct me if I am wrong. So I first am just initializing those pins with uart on STM32CubeMX then I was just sending a simple HAL_UART_Transmit() with a 2 second HAL_Delay(). However, I see no data coming through when putting a logic analyzer on those pins. What am I doing wrong? Here is the very simple basic uart code in main. /* USER CODE BEGIN Header */ /** ****************************************************************************** * @file : main.c * @brief : Main program body ****************************************************
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.