Ask questions and find answers on STM32Cube packages, including HAL, LL and middleware, and expansion software.
Most recent activity
Hi guys,I'm coming from Arduino and recently started working on a project where I need a protocol that supports bidirectional communication between MCUs and Hot-Join.I decided to give I3C with the STM32H5 a shot and got myself some Nucleo-H503RB boards.Based on the example projects from ST on GitHub:https://github.com/STMicroelectronics/STM32CubeH5/tree/main/Projects/NUCLEO-H503RBI got these things working:Target sends a Hot-JoinController detects it and assigns a dynamic addressIBI from the target is received on the controllerWhat doesn’t workI can’t get regular data communication working.For example, I want the controller to send a string on a button input like "ping" to the target, and the target should respond with "pong".From my understanding, communication in I3C works something like this:Target to Controller:Target sends IBIController receives IBI and starts listening using HAL_I3C_Ctrl_Receive_IT()Target sends data using HAL_I3C_Tgt_Transmit_IT()Controller receives data in HAL_
Could you please explain why global interrupts are disabled (using __disable_irq()) at the beginning of the LPTIM_Disable() function, and re-enabled at the end?Does this relate to ensuring atomicity during the timer's register save/restore process, preventing potential race conditions during clock source reconfiguration, or avoiding unintended interrupt triggers during the reset sequence?"void LPTIM_Disable(LPTIM_HandleTypeDef *hlptim) { uint32_t tmpclksource = 0; uint32_t tmpIER; uint32_t tmpCFGR; uint32_t tmpCMP; uint32_t tmpARR; uint32_t tmpOR; #if defined(LPTIM_RCR_REP) uint32_t tmpRCR; #endif __disable_irq(); /*********** Save LPTIM Config ***********/ /* Save LPTIM source clock */ switch ((uint32_t)hlptim->Instance) { case LPTIM1_BASE: tmpclksource = __HAL_RCC_GET_LPTIM1_SOURCE(); break; #if defined(LPTIM2) case LPTIM2_BASE: tmpclksource = __HAL_RCC_GET_LPTIM2_SOURCE(); break; #endif /* LPTIM2 */ default: break; } /* Save LPTIM configuration registers */ tmpIER = hlptim->
On STM32F4, when you choose PLLCLK as the MCO1 source, does the HAL actually routes the PLL output going into SYSCLK, i.e. after the PLLP division?#include <Arduino.h> #include <RCC.h> void SystemClock_Config(void) { RCC_OscInitTypeDef RCC_OscInitStruct = {0}; RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; __HAL_RCC_PWR_CLK_ENABLE(); RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; RCC_OscInitStruct.HSEState = RCC_HSE_ON; RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE; RCC_OscInitStruct.PLL.PLLM = 25; RCC_OscInitStruct.PLL.PLLN = 336; RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV4; RCC_OscInitStruct.PLL.PLLQ = 7; if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) { Error_Handler(); } RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2; RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; RCC_ClkInitStruct.AHBCLKDivider = RCC_
Hello there,I cant find full working example about ram initializations and relevant RISAF settings,I need to get at least 2.5MB region for camera data capture, I found clk and power enable functions, but it does not working, when I increase memory size in .ld file the code does not run...I guess I use correct clk and power registers:__HAL_RCC_AXISRAMx_MEM_CLK_ENABLE();RAMCFG_SRAMx_AXI_NS->CR &= ~RAMCFG_CR_SRAMSD;I use FSBL and my code will fit there not reaching 512KB limit.CubeMX do not have a lot of settings there, RISAF do not have default values or some help hints which there can help, and there is no memory map window like let say for H7 and other mcu's...How to correctly initialize and use all the RAM ?Thanks.
Hello everyone, I'm currently working on Ethernet communication between my STM32H563ZI and a TP-Link router. They are connected by Ethernet, and I'm trying to ping the router with my STM32. All is going on, except the DHCP who don't want to connect (I keep the code because my be it can be a solution) But, when I see the status of icmp_ping, it tells me 0x29 (NX_NOT_SUCCESSFUL). I'v tried a lot of things, changed the Ethernet cable, nothing changed. Do you have any idea form where it comes ? Here is my app_threadx, app_netxduo and my main code. /* USER CODE BEGIN Header */ /** ****************************************************************************** * @file app_threadx.c * @author MCD Application Team * @brief ThreadX applicative file ****************************************************************************** * @attention * * Copyright (c) 2025 STMicroelectronics. * All rights reserved. * * This software is licensed under terms that
I have USB2 OTG high speed port1 working in "device mode" on the STM32N6570-DK board. I need to transfer an image file (around 10 MBytes in size) from the external PSRAM IC (APS256XXN-OBR-BG Hexadeca‑SPI PSRAM) to external PC via a bulk CDC IN endpoint. I am able to do this currently without DMA enabled by repeatedly calling CDC_Transmit_HS( ) and waiting for the transmit done interrupt before sending the next segment. I now want to do this with DMA enabled so that I get one transmit done interrupt instead of one per segment. I only have 3 endpoints (in end point 0, out end point 0 and one bulk in end point). Note that I am not using USBX. When I try enabling DMA in USBD_LL_Init( ) by setting " hpcd_USB_HS.Init.dma_enable" to "ENABLE", the board does not enumerate. What am I missing ?Thx
Hello STM32 Community,I am working on the STM32F769I-DISCO board and would like to implement UDP communication using LwIP with FreeRTOS.I have already downloaded the STM32F7 series example projects, and I see that the LwIP_HTTP_Server_Socket_RTOS example is available. This project uses FreeRTOS and a TCP socket for HTTP communication. I would like to know how I can modify or use this example project to implement UDP-based communication (sending and receiving UDP packets). or any different way I should use.Could anyone guide me on the steps required to convert or extend this example to support UDP communication over LwIP in FreeRTOS?Any code examples or suggestions would be highly appreciated.Thank you!
Hi. I have a problem while using lwip and freertos. The board is based on stm32h743vih. The mpu configuration is done correctly i think. My problem is after i start udp server and start to send data with udp, everything is ok, but after a while i will enter a loop in xQueueSemaphoreTake an in the configASSERT( pxQueue->uxItemSize == 0 ). I searched a lot and i saw this: https://community.st.com/t5/stm32cubemx-mcus/cubemx-lwip-ethernet-link-thread-bug/m-p/126556 I did what it said but this time when it happens im not in the loop but the other tasks get very slow and actually a task with osdelay(1) is executing every 1 second. What should i do?
Hi, I'm not able to find any DMA available with CAN peripheral in STM32G4. After going deep search I found there's no such native DMA request available for CAN peripherals. So, I want to know is it true that STM32 controllers don't come with DMA with FDCAN/CAN. If available, then kindly share me the reference for making it work. Since, I want to have fast data transfer, and if I use the FDCAN with interrupt based, it will overload my CPU cycles. Thanks in advance.
Hi,I would like to consult the USB HID GetReport feature.The issue is that the printout data from MCU log is different from bus hound displayed result.Bus hound is trial version, the data length indeed is 16.This is the log I set to printout from USBD_HID_Keyboard_SetReport#define UX_DEVICE_CLASS_HID_EVENT_BUFFER_LENGTH 32 static uint8_t g_last_input_report[17]; // adjust size to match your report static UINT g_last_input_report_len = 0; /** * @brief USBD_HID_Keyboard_GetReport * This function is invoked when host is requesting event through * control GET_REPORT request. * hid_instance: Pointer to the hid class instance. * hid_event: Pointer to structure of the hid event. * @retval status */ UINT USBD_HID_Keyboard_GetReport(UX_SLAVE_CLASS_HID *hid_instance, UX_SLAVE_CLASS_HID_EVENT *hid_event) { printf(">>> USBD_HID_Keyboard_GetReport invoked\r\n"); static uint32_t get_report_counter = 0; printf("=== GET_REPORT #%lu at %lu ms ===\r\n", ++get_report_counter, HAL_G
Hello,I would like to use the X-CUBE-CRYPTOLIB to calculate a SHA256 with a key, i'm using STM32CubeIDE 1.18.0 for an STM32u083 microcontroller, STM32CubeExpansion_Crypto_V4.2.0.The issue I have is the first time I call cmox_mac_compute the wrong result is returned. cmox_init_arg_t init_target = {CMOX_INIT_TARGET_AUTO, NULL}; if (cmox_initialize(&init_target) != CMOX_INIT_SUCCESS) { Error_Handler(); } uint8_t tResult[32] = {0}; uint8_t tMessage[63] = {153,234,98,104,200,115,43,208,16,24,124,106,63,66,15,0,0,0,0,0,250,191,113,33,0,0,0,0,0,0,0,53,231,216,222,211,203,112,30,58,145,125,101,150,57,215,149,108,50,229,247,80,239,35,157,119,19,121,218,120,231,50,70}; uint8_t tKey[32] = {173,182,187,187,244,184,224,88,49,224,82,119,184,125,189,202,255,179,154,153,213,5,120,138,162,120,25,250,40,96,170,122}; //Test 1 retval = cmox_mac_compute(CMOX_HMAC_SHA256_ALGO, // Use HMAC SHA256 algorithm tMessage, sizeof(tMessage), // Message to authenticate tKey,sizeof(tKey)
Hi, I am developing firmware for an STM32H747 with Ethernet connected via RMII to a LAN8742 PHY. The project uses lwIP and FreeRTOS. UDP communication works fine when sending data, but when receiving UDP packets, the system crashes after some rundom time, even just when pinging the device. Has anyone encountered a similar issue or can suggest what might cause UDP receive-related crashes in this setup? Thank you
Hi, I recently started a project using the STM32H747BIT MCU and I’m configuring ThreadX v6.4.2 as the RTOS. I followed the usual steps to integrate ThreadX into my system. I decided to use the ThreadX source from the GitHub repository instead of the version provided by CubeMX because ST’s CubeMX package does not include the latest ThreadX updates. During the project configuration, I ran into some issues. I added the tx_api.h, tx_port.h, and libthreadx.a files to the M7 core’s makefile. However, I noticed that the _tx_initialize_low_level.S file is missing. Although the repository provides an example of _tx_initialize_low_level.S, it is not tailored for my MCU. Therefore, I copied the _tx_initialize_low_level.Sfile generated by CubeMX for an older version of ThreadX. After including all these files, when I compile and try to call the functions _tx_initialize_kernel_setup and _tx_initialize_kernel_enter, I get the following error:threadx/common/src/tx_initialize_kernel_ent
I am using the STM32H523 microcontroller with I3C function and a system clock of 250MHz. I am configuring LL-I3C_SetPeriodClockHighI3C (I3C1,0x0D) based on the LL library;LL_I3C_SetPeriodClockLowPP(I3C1,0x0D);LL_I3C_SetPeriodClockLowOD(I3C1,0x0D);At this time, the clock is about 8.9MHz, and the oscilloscope waveform is outputting normally, but when configured asLL_I3C_SetPeriodClockHighI3C(I3C1,0x09);LL_I3C_SetPeriodClockLowPP(I3C1,0x09);LL_I3C_SetPeriodClockLowOD(I3C1,0x09);At this time, the clock is about 12.5MHz. The oscilloscope sees that before sending the normal waveform, the microcontroller will send a byte of 0x3F, which is not what I want. I want to know where the problem lies.
Hello Microsoft Community,I’m currently working on implementing a file system using FileX and LevelX on external NOR Flash (IS25LP064D) connected to the STM32U585AII6Q board.Flash Memory Specifications:Sector Size: 4 KBBlock Size: 32 KB / 64 KBTotal Flash Size: 64 Mbit / 8 MBPage Size: 256 bytesRequirement:I need to create a .txt log file using FileX and once the file reaches 100 KB, it should be deleted and a new file created in its place.Media Initialization Parameters Used:Total clusters: 300Bytes per sector: 512Sectors per cluster: 8Hidden sectors: 0Heads and sectors per track: 1Number of FATs: 1Issue:When writing logs using FileX, I receive a FX_IO_ERROR after a few logs are written—even though there is still available space on the flash.My Questions: What are the correct parameters to pass to fx_media_format() for this NOR flash setup (e.g., sector size, cluster size, number of FATs)?Is there a formula or guideline for determining these parameters when using NOR flash
Platform: STM32 Nucleo-H7A3ZI-QGoal: Read audio from four microphones in stereo mode (two mics per I²S interface) via DMA, then enqueue complete stereo frames for processing.1. Hardware & DMA SetupI2S1 handles Mic 1 (left) and Mic 2 (right).I2S2 handles Mic 3 (left) and Mic 4 (right).Each I2S interface uses DMA to fill its receive buffer (data_i2s[] and data_i2s_2[]).2. Current Callback Codevoid HAL_I2S_RxCpltCallback(I2S_HandleTypeDef *hi2s){ if(hi2s==&hi2s1){ if(x1Flag == 0){ valX1 = 0; valX1 = sample_left = ((int32_t)data_i2s[0]) >> 8; x1Flag = 1; }else if(x2Flag == 0){ valX2 = 0; valX2 = sample_right = ((int32_t)data_i2s[1]) >> 8; x2Flag = 1; /*if(x1Flag != 0 && x2Flag != 0){ enqueueData(); }*/ } }else if (hi2s == &hi2s2){ if(y1Flag == 0){ valY1 = 0; valY1 = sample_left_2 = ((int32_t)data_i2s_2[0]) >> 8; y1Flag = 1; }else if (y2Flag == 0){ valY2 = 0; valY2 = sample_right_2 = ((int32_
I'm able to generate a simple PWM signal but I wasn't able to generate arbitrary waveform with DMA (HAL_TIM_DMABurst_MultiWriteStart).How should be configured the DMA ?Is there an example that use PWM with DMA on STM32U5 ?
Question:I’m using an STM32H7A3ZI-Q with four INMP441 MEMS microphones. Each INMP441 outputs PCM (not PDM), and all four share the same BCLK (bit clock) and LRCLK/WS (word select). I’ve split the data lines into two stereo pairs:SAI_A (master) → Microphones 1 & 2SAI_B (synchronous slave) → Microphones 3 & 4Both SAI blocks run in I²S/PCM mode, each with its own DMA stream.Only one stereo pair connected → perfectly clean audioAll four microphones connected → one stereo pair becomes very noisy and distorted hsai_BlockA1.Instance = SAI1_Block_A; hsai_BlockA1.Init.AudioMode = SAI_MODEMASTER_RX; hsai_BlockA1.Init.Synchro = SAI_ASYNCHRONOUS; hsai_BlockA1.Init.OutputDrive = SAI_OUTPUTDRIVE_ENABLE; hsai_BlockA1.Init.NoDivider = SAI_MASTERDIVIDER_ENABLE; hsai_BlockA1.Init.FIFOThreshold = SAI_FIFOTHRESHOLD_3QF; hsai_BlockA1.Init.AudioFrequency = SAI_AUDIO_FREQUENCY_16K; hsai_BlockA1.Init.SynchroExt = SAI_SYNCEXT_DISABLE; hsai_BlockA1.Init.MonoStereoMode = SAI_STEREOMODE; hs
Hello community,I have been working towards getting a prototype ThreadX modules project on my board (Nucleo U545RE-Q) using CMake from a generated STM32CubeMX project. I have been loosely following the documentation https://github.com/eclipse-threadx/rtos-docs/blob/main/rtos-docs/threadx-modules/I have been able to build a ThreadX Module as a library, and a ThreadX Module Manager as a library - CMake samples below:# Interface library for includes and symbols add_library(module_1 INTERFACE) target_include_directories(module_1 INTERFACE ${MX_Include_Dirs}) target_compile_definitions(module_1 INTERFACE ${MX_Defines_Syms}) # Create STM32_Drivers static library target_link_libraries(STM32_Drivers PUBLIC module_1) # Create ThreadX static library add_library(ThreadXModules OBJECT) target_sources(ThreadXModules PRIVATE ${Module_sources}) target_link_libraries(ThreadXModules PUBLIC module_1)# Interface library for includes and symbols add_library(module_manager INTERFACE) target_i
Hi everyone,I am trying to send the firmware to the MCU via webpage. I want to send chunks of the file (4096 bytes) to the mcu, so it can store in ram, do some checks and then store it in an external memory. The firmware size can be maximum of 1.7MB (all the web pages and content are embedded in the firmware). The webserver is running, and I have the request notify callback function#define fwBufferSize 5000 CHAR fwBuffer[fwBufferSize]; UINT webserver_request_notify_callback(NX_WEB_HTTP_SERVER *server_ptr, UINT request_type, CHAR *resource, NX_PACKET *packet_ptr) { CHAR temp_string[30] = {'\0'}; CHAR data[512] = {'\0'}; UINT string_length; NX_PACKET *resp_packet_ptr; NX_PACKET *currentPacket; UINT status; ULONG total_bytes_sent; ULONG total_bytes_received; ULONG connections; ULONG disconnections; ULONG length; ULONG aOffset, aLength; UINT actualSize; ULONG bytes_read; ULONG packetLength; CHAR *destination_ptr; UINT destination_size; UINT *actual_size; CHAR *serv
Board: NUCLEO-144 STM32H723ZGI'm using ADC_3 with 8-bit resolution, trying to measure an analog sine wave of 1 kHz as a stimulus.I'm trying to use the ADC with DMA. However, I am unable to get any values other than zero. I have tested it in polling mode and have successfully gotten correct values. I have been looking at multiple code examples. It seems like HAL_ADC_START_DMA should be enough to start sampling; however, my buffer isn't being updated. Where have I gone wrong? DMA settingsADC DMA settingsADC_settings ADC_regular_conversionMode CODE:/* 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
Hello ST Community,I recently purchased the STM32N6570-DK development board. However, I accidentally erased the default factory firmware by programming it with my own application, without saving the original files.As a result, I am no longer able to access the default UI features such as Edge AI live video, and other demos that originally came with the board.If anyone has a copy of the original default firmware (.hex or .bin files) that comes preloaded with the STM32N6570-DK, I would greatly appreciate it if you could share it with me.Thank you in advance for your support.
Hello,I am looking for the MCU for my project. I need the Ethernet and Can bus, so STM32F429 was in my mind first, but as I don't need the display function, I tried to find more affordable option.But I couldn't find the right one in STM32F4 series, and instead, I found STM32H5 series (STM32H563). When I did some research, STM32H563 doesn't seem to work with FreeRTOS or some special configuration to add the FreeRTOS. But I want to use RTOS as I need the firmware update via Ethernet.My question is1. Is the firmware update via Ethernet for STM32H563 with FreeRTOS available? 2. If not, is it better to use Zephyr OS even though STM32CubeIDD doesn't support Zephyr OS directly?I want to get the opinions before I order the dev kit.
Hi to everybody.I can't get spi to work with linked lists. I followed the procedures in the documentation but it still doesn't work. Maybe someone can tell me why.This is my configuration: STM32U575, cubeMX 6.12.0, cubeIDE 1.9.0The linked list has two nodes. The first one writes 4 bytes on SPI2 and the second one reads 4 bytes on SPI2.I don't see the clock strokes on the SPI2 bus.Thanks a lot in advance.main.cint main(void) { /* USER CODE BEGIN 1 */ /* USER CODE END 1 */ /* MCU Configuration--------------------------------------------------------*/ /* Reset of all peripherals, Initializes the Flash interface and the Systick. */ HAL_Init(); /* USER CODE BEGIN Init */ /* USER CODE END Init */ /* Configure the system clock */ SystemClock_Config(); /* Configure the System Power */ SystemPower_Config(); /* USER CODE BEGIN SysInit */ /* USER CODE END SysInit */ /* Initialize all configured peripherals */ MX_GPIO_Init(); MX_GPDMA1_Init(); MX_ADC1_Init(); MX_DAC1_I
Hey everyone,I’m working on a USB audio project using TinyUSB on my STM32H7S78-DK Discovery board, and I’ve hit a wall with UAC2.0 on the High-Speed port. I’m hoping someone here has experience with this setup and can point me in the right direction!What I’ve Achieved So FarBoard: STM32H7S78-DK (three USB-C ports)ProgrammerFull-Speed (USB FS)High-Speed (USB HS)TinyUSB ported successfully to the boardCDC example works perfectly on the Full-Speed portAttempted UAC2.0 on Full-Speed port, but Windows rejects itWindows insists on at least a High-Speed device for USB Audio Class 2.0What I’m Trying to DoI want to stream multi-channel audio (UAC2.0) over the High-Speed USB-C port. Unfortunately, I can’t get TinyUSB’s UAC2.0 example to enumerate or work on HS. The descriptors seem correct, but Windows doesn’t recognize the device as a valid UAC2.0 HS audio interface.What I’ve CheckedClock configuration – HS PHY clock is enabled, and I’ve verified 480 MHz operation.Pin mapping – USB1 HS D+/D– pi
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.