Ask questions and find answers on STM32Cube packages, including HAL, LL and middleware, and expansion software.
Most recent activity
Issue SummaryOn STM32N6570-DK, enabling ANY peripheral together with ThreadX or FreeRTOS causes an immediate HardFault, even in a minimal CubeMX-generated project with no user code.This includes peripherals such as:DCMIPPLTDCSDMMCUSBUARTI2CSPIGPIO with interruptsDMAAnything beyond simple GPIO outputThe issue is NOT limited to the camera/display pipeline.EnvironmentBoard: STM32N6570-DKIDE: STM32CubeIDE (latest)CubeMX: latest versionFirmware: STM32N6 HAL/BSP (latest)Security Modes Tested:FSBL + Application (secure/non-secure)Non-secure Application only (no FSBL)Both show the same problem.What Works✔ RTOS disabled → All peripherals work✔ Camera + display pipeline works bare-metal✔ GPIO output works with RTOS (LED blink, simple logic)What Fails:cross_mark:ThreadX + ANY peripheral init → HardFault:cross_mark:FreeRTOS + ANY peripheral init → HardFault:cross_mark:Even minimal projects with zero user code crash before scheduler start:cross_mark:Commenting a peripheral moves the crash to
Dear experts,I'm reading RMs for STM32 models with dual flash banks (F4, H7...) and don't quite understand how to use bank switching.Take the firmware update scenario when old firmware is in bank1 and new is programmed to bank2. So it programs some option byte to switch banks and next time should boot from bank2.If the new version is bad, I'd like to boot automatically from bank1. But how? the option byte is written. Is there a way to control bank switch by external pin? On some systems that I've seen before we did it in the following way: we made a simple watchdog (CPLD or whatever) that automatically toggles the boot selector pin. If the CPU does not touch the watchdog in defined time since reset, it will switch the selector pin and reset again.So if the new firmware fails to boot, the system will reboot to the old firmware.I'd like to implement the same on STM32, with external widget if needed, but better without it.On the other hand, for H7 you can define alternative start addresse
Hello Forum,I'm trying to get a simple application, running on a NUCLEO-U5A5ZJ-Q dev board, to jump to the system bootloader from FreeRTOS. I've also got AN2606 to hand (application note for the STM bootloader) and RM0456 (STM32 U5 reference manual). I have been following this guide. How to jump to system bootloader from application ... - STMicroelectronics CommunityAccording to the guide and reference manuals the bootloader base address on my MCU (STM32U5A5) is at 0x0BF90000. The 32 bit word at that address is the stack location, and the 32bit work at 0x0BF90004 is the entry point for the bootloader. In my setup values are read as:0x200034E8 - this is valid memory (stack)0x0BF98C39 - this is unexpected as lots of the internet says this should be 0x0BF99EFE but I'm guessing this is actually OK.I currently have this code:#define BOOTLOADER_BASE 0x0BF90000 typedef struct boot_vectable { uint32_t Initial_SP; void (*Reset_Handler)(void); } boot_vectable_t; void Ju
Hi, I'm having really a hard time setting up my ADCs to work with DMA using the STM32F429I-DISC1. My objective: have a clock source from a Timer at a given frequency as trigger to the ADCs, each ADC would then read a specific pin (let's say ADC1-> pin_x; ADC2->pin_y and ADC3->pin_z). Since nothing is working regardless of the configuration I set, I'm trying with very big time intervals to avoid busy bus and so on. So I've set the TIMER8 to have a period of 5s and tested it individually with the interrupt enabled to make sure it is triggering and having the correct interval. Now the idea is to trigger the ADCs to perform a few conversions of the pins in order to do some oversampling. Here is my ADCs configurations: The ADC3 is identical to ADC2. Timer8 Trigger Event Selection is set to "Update Event". Here is my main function: int main(void) { /* USER CODE BEGIN 1 */ /* USER CODE END 1 */ /* MCU Configurati
Hi everyone,I was exploring the VENC_SDCard example from STM32CubeN6 v1.2.0, and I was successfully able to record and store video to the SD card after making a few necessary changes mentioned here.Now, I want to record and store the video in grayscale format. After modifying the MX_DCMIPP_Init() function in main.c and the BSP_LCD_InitEx() function in stm32n6570_discovery_led.c, I can correctly see the grayscale video output on the display.However, when I try to record this grayscale stream, the resulting video is distorted.(Attached it)Upon debugging, I suspect the issue originates from the following line in encoder_prepare():preproc_cfg.inputType = H264ENC_RGB565;The inputType is still set to RGB, and after checking the h264encapi.h header file, I found the following enum for H264EncPictureType on line 159: typedef enum { H264ENC_YUV420_PLANAR = 0, /**< YYYY... UUUU... VVVV... */ H264ENC_YUV420_SEMIPLANAR, /**< YYYY... UVUVUV... */ H264ENC_YUV420_SEMIPLANAR_VU, /
Reply to you How to fix SDIO error HAL_SD_ERROR_RX_OVERRUN? - STMicroelectronics Community SDIO data region should be AXI SRAM.
Hi everyone!I'm trying to figure out what's wrong with my SPI Peripheral continous transmitting/receiving via DMA in Circular Mode. I think I have coded a pretty basic "Hello, World" for working with DMA, I've just generated code from .ioc file and then added a simple logic. This is my main.c: /* 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 CODE END Header */ /* Includes -------------------------------------------
Using Ux_Device_Audio2.0_PlayBack as an example for STM32H753, I enabled in the .ioc file, but it doesn't seem to be affected in the project. Any idea why? In the .ioc, I have this `UX_DEVICE_CLASS_AUDIO_FEEDBACK_SUPPORT` enabled... should be affecting ux_user.h But ux_user.h is not being used in the project, so I don't think it's actually being built into the .elf file. I also can't find the file in the STM32CubeIDE project as well, although it is under `USBX/App/ux_user.h` in the system explorer... Here's the Project explorer in the IDE: and even opening each of those *.c files doesn't reveal ux_user.h. Lastly, I do have UX_INCLUDE_USER_DEFINE_FILE in the preprocessor: Am I missing something?
Post edited by ST moderator to be inline with the community rules for the code sharing. In next time please use </> button to paste your code. Please read this post: How to insert source code.Hallo,I am trying to measure the frequency of rectangular signals. the borad I am using is stm32f411-discoI used the timer 2 channel 1 for input capture. at every capture the timer value will be sent to memery by uing DMA. The DMA seems working, because I printed the captured value periodically. the DMA-Buffer is two, and it is working in a circular mode.I try to do some calculation in the interruption-function: "void HAL_DMA_XferCpltCallback(DMA_HandleTypeDef *hdma)" like this: void HAL_DMA_XferCpltCallback(DMA_HandleTypeDef *hdma) { if (hdma->Instance == DMA1_Stream5) // MCU-abhängig! { uint32_t first = IC_Values[0]; uint32_t second = IC_Values[1]; if (second >= first) diff = second - first; else diff = (0xFFFFFFFF - first + second); /* Timer läuft mit 1 MHz → 1 µs
The above image represents logic analyzer output when HAL_SPI_Receive_DMA is executed. My doubt is regarding the single high pulse at MOSI line. During HAL_SPI_Transmit_DMA , no issues. Is this normal behaviour? STM as Full duplex master, i have disconnected the slave to check if it was responsible for the high pulse.
I’m using HAL_UART_Receive_IT() on an STM32F103 to receive serial data asynchronously. The UART initialization appears correct, and I can send data successfully, but the HAL_UART_RxCpltCallback() function never gets triggered. I’ve confirmed the interrupt is enabled in NVIC and the buffer size is correct.Is there something I might be missing in configuration or code structure that prevents the callback from firing?Any sample code or debugging steps would be greatly appreciated. Thanks!
I am currently working with the MT25QL128 flash memory using the Quad-SPI interface on an STM32H7 MCU. I have a technical question regarding the Extended Quad Input Page Program command.In my code, the following command is used: #define EXT_QUAD_IN_FAST_PROG_CMD 0x12The flash write operation works correctly with this command.However, according to the MT25QL128 datasheet, the correct command for Extended Quad Input Page Program appears to be 0x38.My questions are:Is using 0x12 officially supported on MT25QL128, or is it just backward-compatible?Are there any scenarios where using 0x12 might lead to incorrect behavior or compatibility issues?Should I update my code to use 0x38 to be fully datasheet-compliant, even though 0x12 seems to work in practice?I want to ensure that my Quad-SPI write operations are fully compliant with the datasheet and avoid potential issues in programming.Thank you very much for your guidance.
ADF_AudioRecorder call HAL_DMAEx_List_BuildNode() without initializing pNodeConfig.Init.Mode. So with USE_FULL_ASSERT, it can assert because of assert_param(IS_DMA_MODE(pNodeConfig->Init.Mode));
Hi everyone, I am trying to run VENC_JPEG_Encoding project using STM32CubeIDE on STM32N6570-DK board, but it is not saving .bmp as stated in README file. Upon further debugging I can see in main.c in function save_file() that it is only supported on IAR system. int8_t save_file(char *pName,uint8_t *pStream,uint32_t szOut) { int8_t ret = 0; #if defined ( __ICCARM__ ) /* stdio FILE works only on IAR system */ FILE *pFile; pFile = fopen(pName,"wb"); if(pFile) { while(szOut) { uint32_t blk = 1024; if(szOut < blk ) blk = szOut; uint32_t written = fwrite(pStream,1,blk,pFile); szOut-= written; pStream+=written; } fclose(pFile); ret = 1; printf("the file %s is in the current folder",pName); } #endif return ret; }so how do i test it in CubeIDE as I am on Ubuntu and IAR doesnt supports Ubuntu till now.Kindly help
Hi everyone, I am working on collecting video using a modified VENC_RSTP_server example for my project with the VD56G3 camera, but I am encountering an error while encoding the frames.Here is what I have done so far:Verified that the VD56G3 camera works with the board and is displayed on the LTDC screen. I am able to change its resolution and FPS.Verified that the original code works with the MB1854B camera (the one originally provided with the board).Made the necessary changes in the VENC_RSTP_server code to support the VD56G3 camera.However, while encoding the frames, I am receiving this error in the UART terminal when trying to record via ffplay . I am attaching the error log for reference.I have tried modifying the VENC parameters, but to no avail. The error code -11 means H264ENC_HW_TIMEOUT, as shown in h264encapi.h.I am also attaching my venc_app.c file for your reference.Kindly help.
Hi everyone, I'm using an STM32H743 MCU with an LTDC display and lvgl for management.I'm using the graphics accelerator correctly to decode an mjpeg video in YCbCr, but I can't convert it to RGB565 with DMA2D.If I try to convert without DMA2D, I get times of about 350 ms per frame (792*408). Decoding is successful in DMA. static void video_playback_task(lv_timer_t * t) { if (!MJPEG_GetNextFrame(Video_Buffer, Video_Size, &offset, &frame)) { lv_timer_del(video_timer); video_timer = NULL; printf("Fine video\n"); return; } JPEG_Decode_DMA(&hjpeg, frame.start, frame.size, Frame_Buffer); DMA2D_CopyBuffer((uint32_t*)Frame_Buffer, uint32_t*)Frame_Buffer_Rgb, IMAGE_WIDTH, IMAGE_HEIGHT); img_dsc.data = Frame_Buffer_Rgb; lv_img_set_src(img, &img_dsc); lv_obj_invalidate(img); HAL_GPIO_TogglePin(Check_ADAS_GPIO_Port, Check_ADAS_Pin); } static void JPEG_Decode_DMA(JPEG_HandleTypeDef *hjpeg, uint8_t *FrameSrc, uint32_t FrameSize, uint8_t *YCbCr_Dst) { JPEGSourceAdd
I am having trouble understanding the behavior of the Timers on the STM32F429I-DISC board. I have an application using TouchGFX with FreeRTOS, which is kind of working as expected but the timer-based activity seems to be too slow, so I am trying to debug and verify the clock frequency (which is triggering my ADC conversions), but nothing is matching or giving anything as expected. I commented out everything else on the code (including FreeRTOS, TouchGFX etc) and leaving just the timer and ADC initialization. Main system clock is set to PLL with a frequency of 144MHz and I am using Timer8 to trigger ADC on triple simultaneous regular mode and Timer11 to try to measure this interval. At first I've set Timer8 also to trigger an output event (pin toggle), and measuring it with the oscilloscope gave me exactly the expected frequency (Timer frequency / 2). But debugging is not showing anything useful at all. Here is the initialization of the timers:void MX_TIM8_Init(void) { /* U
I have been trying for a while now to do something simular to this with threadxhttps://community.st.com/t5/stm32-mcus/how-to-use-stm32u5-with-freertos-in-tickless-mode/tac-p/857701#M1715I want to be able to put the MCU into STOP and wake from uart traffic, I am using threadx not freertos. I should note here that I have written a lot of code on the STM32U575 in the last couple years and have used threadx successfully quite a few times. Ultimately I want to add this to FW that is already running on a product so I would rather not change to freertos. For the purposes of figuring this out I am working on the nucleo board.The problem I am encountering is that the MCU never enters Stop at all unless I kill SRAM3. As a sanity check I also tried doing this without an RTOS:https://community.st.com/t5/stm32-mcus/how-to-wake-up-the-stm32u5-from-stop2-using-lpuart/ta-p/49436Its the same thing as the first link just without freertos or my threadx adaptation. It w
DMA stops working when I enable IWDG in .ioc on my STM32, even when commenting out the IWDG initialization for testing. DMA stops working when I enable IWDG in .ioc on my STM32, even when commenting out the IWDG initialization for testing. Before enabling IWDG, DMA is functioning normally.If anyone can help me, I don't have much experience with stm32, I'm just starting out. /* USER CODE END Header */ /* Includes ------------------------------------------------------------------*/ #include "main.h" /* Private includes ----------------------------------------------------------*/ /* USER CODE BEGIN Includes */ #include <stdio.h> #include <string.h> #include "microwave_sensor.h" /* USER CODE END Includes */ /* Private define ------------------------------------------------------------*/ /* USER CODE BEGIN PD */ #define ADC_CHANNELS 2 /* USER CODE END PD */ /* Private variables ---------------------------------------------------------*/ ADC_HandleTy
Hello,I'm working on a low power project using STM32U073 with FreeRTOS, LPUART2 and LPTIM1.To achieve the lowest system power possible I am trying to use STOP2 for when the system is idle.Currently I have LPTIM1 releasing a semaphore every 1 second which then controls an I2C ASIC by grabbing the latest data then setting it going again for the next measurement.This part of the project works perfectly and will allow the MCU to fall into STOP2, wait for the LPTIM1 compare interrupt, wake the MCU and control the I2C device before then falling back into STOP2.While the MCU is in RUN mode, caused by LPTIM1, I can successfully service LPUART2 in that it will respond to a 'request for data' Modbus message.If a message is sent to the MCU while it is in STOP2 the request for data is missed.For testing I have disabled LPTIM1 IT and am trying to wake the MCU using LPUART RX alone and force the MCU to hold RUN for 100 ms so that I can see it on my power profiler, but all I am seeing is ~2ms activit
Hello I have custom board with STM32N657. I have set timer 2 to output PWM pulse on channel3 and output compare pulse on channel 1 as trigger to another timer. The timer starts when external trigger - TIMER4_ETR (mapped to timer 2) detects rising edge. All works good, there are continuous pulses as expected. I want timer2 to run once per trigger so enabling One Pulse Mode. static void MX_TIM2_Init(void) { /* USER CODE BEGIN TIM2_Init 0 */ /* USER CODE END TIM2_Init 0 */ TIM_ClockConfigTypeDef sClockSourceConfig = {0}; TIM_SlaveConfigTypeDef sSlaveConfig = {0}; TIM_MasterConfigTypeDef sMasterConfig = {0}; TIM_OC_InitTypeDef sConfigOC = {0}; /* USER CODE BEGIN TIM2_Init 1 */ /* USER CODE END TIM2_Init 1 */ htim2.Instance = TIM2; htim2.Init.Prescaler = TIM2_PRESCALER; htim2.Init.CounterMode = TIM_COUNTERMODE_UP; htim2.Init.Period = TIM2_PERIOD; htim2.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1; htim2.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_ENABLE; if (HAL
Hello, i created a custom external loader for a STM32F429 board.The problem is now, my code needs HAL_Delay() for generating short delays between flash device accesses. And the code freezes when executing HAL_Delay(). So i have read that interrupts are no longer allowed at newer versions of CubeMXProgrammer.But HAL_Delay() seems to need a working SysTick interrupt.I used this tutorial for my custom EL:https://community.st.com/t5/stm32-mcus/how-to-add-your-spi-flash-into-the-stm32cubeprogrammer-s/ta-p/49392 IsSCB->VTOR = 0x20000000 | 0x200;the right value for my F429? Further i tried uncommenting#define USER_VECT_TAB_ADDRESSand#define VECT_TAB_SRAM But still no success. Does someone know what else has to be fixed? Thank you.
I'm using STM32G474 with dual ADC injected simultaneous mode. İndividual ADC injected mode works ok. ADC1 is triggered by TIM1 Channel 4 and the interrupt is firing correctly, but ADC2 always returns zero. Questions: Why does ADC2->JDR1 always return 0 in dual injected simultaneous mode? Is it correct that HAL_ADCEx_InjectedStart_IT(&hadc2) returns HAL_ERROR in dual mode? You can see my ADC1 and ADC2 configuration. void HAL_ADCEx_InjectedConvCpltCallback(ADC_HandleTypeDef* hadc) { if (hadc->Instance == ADC1) { HAL_GPIO_WritePin(GPIOA, GPIO_PIN_4, GPIO_PIN_SET); HAL_GPIO_WritePin(GPIOA, GPIO_PIN_4, GPIO_PIN_RESET); adc1 = ADC1->JDR1; adc2 = ADC2->JDR1; } } static void MX_ADC1_Init(void) { /* USER CODE BEGIN ADC1_Init 0 */ /* USER CODE END ADC1_Init 0 */ ADC_MultiModeTypeDef multimode = {0}; ADC_InjectionConfTypeDef sConfigInjected = {0}; ADC_ChannelConfTypeDef sConfig = {0}; /* USER CODE BEGIN ADC1_Init 1 */ /* USER CODE END ADC1_I
Hello,I would like to know if there is a planned release date for STM32H7 support with MbedTLS v3.Thank you.
Hello everyone,For a while now, I have been writing my hardware jpeg driver for the STM3U5G9, I am near the end but a last (last?) major problem remains.With a grayscale 8-bit image (on the left), the output encoded image (on the right) is totally different from the input. (the output screenshot is decoded by an external jpeg decoder). I also observe the same behavior with HAL/MX configuration, so I only share the HAL/MX code for simplicity matter.MX_JPEG_Init(); JPEG_ConfTypeDef cfg = {0}; cfg.ChromaSubsampling = JPEG_444_SUBSAMPLING; cfg.ColorSpace = JPEG_GRAYSCALE_COLORSPACE; cfg.ImageHeight = 480; cfg.ImageWidth = 640; cfg.ImageQuality = 75; int length = cfg.ImageHeight * cfg.ImageWidth; HAL_JPEG_ConfigEncoding(&hjpeg, &cfg); HAL_JPEG_Encode(&hjpeg, img, length, img_jpeg, length, HAL_MAX_DELAY);For grayscale only image, do I need to do extra steps to make it work ?I saw (A)RGB image conversion to YCbCr functions (expensives to perform as a whole), do I need to per
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.