Ask questions and find answers on STM32Cube packages, including HAL, LL and middleware, and expansion software.
Most recent activity
Hello everyone,I am using SPI2 of STM32F103RCT6 to communicate with an AT45DB641E DataFlash device. I am trying to understand why the effective SPI data rate is significantly lower than what I expect based on the configured SPI clock.Hardware setupMCU: STM32F103RCT6 (Cortex-M3)SPI instance: SPI2SPI clock: 9 MHzData frame: 8 bitsSPI mode: 2-line unidirectional (full-duplex hardware)NSS: Software-controlled GPIOCore clock: 72 MHzCustom PCB (STM32 + AT45 connected directly)Schematics attachedTest descriptionI am reading the status register of the AT45DB641E.Once the read command is sent and SS is held low, the flash continuously outputs two status bytes as long as clock pulses are provided.I measured the execution time of HAL_SPI_TransmitReceive() by placing timestamps before and after the function call, using the DWT cycle counter (DWT->CYCCNT) available on the Cortex-M3.Here is the code used for testing, the tx and rx buffer are globally defined of size 5000 and datatype uint8_t: /*
I would like to use the single USB internal PHY on the STM32H735 to connect to a 2 port hub chip (like the Microchip USB2422) so that I can connect to both a USB stick for firmware upgrades as well as a cellular module. I started connecting everything up and then I came across a multiple sources saying that you can't connect USB Hubs to the internal PHY and you have to use the ULPI interface to connect to an external PHY, but none of the sources really explain why other than saying the internal PHY isn't capable of High Speed operation, and the USB software from ST doesn't allow for hubs. I don't understand what this has to do with interfacing with a hub IC when I'm perfectly fine with operating at Full Speed. So I have a few quesitons:1) Can I use a USB Hub (like the USB2422) as long as I'm OK with it operating at Full Speed only? Is it technically possible to connect these devices and get them to work?2) Will the USB Host middleware provided through STM32CubeM
Hi, I got stuck in the HardFault_Handler every time after editing some code. I'm using FreeRTOS in c++ combination with classes. First I thought this would be a memory issue. After increasing configTOTAL_HEAP_SIZE and configMINIMAL_STACK_SIZE, I was still stuck in the HardFault_Handler. Even by jumping into a function, before I returned from this function the HardFault_Handler was tripped again. I really tried a number of things... I made a function (bool Controller::DefaultConfig()) to set the default configuration when nothing was available in the flash and I forgot the return true or false. When adding the return with a result, the problem with HardFault was solved. Is this a logical behavior? (A compiler error would make more sense) Greetings, ErX
Hi there !I use thi function and work perfectly . But if i try to read the HAL_StatusTypeDef i don't understand why return HAL_OK even if i wrote a wrong address why ???? if i use void HAL_I2C_ErrorCallback(I2C_HandleTypeDef *hi2c) this work with i wrote a wrong address please some one can tell me why ? Thank you Sergio
Hi, I am compiling the STM32U0 HAL library and I get errors like this one:/Users/kiwanda/techniek/swexternals/STM32/HAL/Libraries/STM32U0xx_HAL_Driver/Inc/stm32u0xx_ll_comp.h: In function 'uint32_t LL_COMP_GetCommonWindowMode(const COMP_Common_TypeDef*)': /Users/kiwanda/techniek/swexternals/STM32/HAL/Libraries/STM32U0xx_HAL_Driver/Inc/stm32u0xx_ll_comp.h:391:27: error: ISO C++17 does not allow 'register' storage class specifier [-Werror=register] 391 | register const uint32_t window_mode_comp_odd = (uint32_t)READ_BIT(COMPxy_COMMON->CSR_ODD, COMP_CSR_WINMODE);I am using a C++ compiler and since C++14 the keyword register has been declared obsolete and useless. I fully agree with this step, all the more since we are writing SW here on ARM Cortex:When writing software for ARM Cortex, which is a Load/Store architecture RISC processor, EVERYTHING goes through a register. The register keyword is therefore completely meaningless, useless and superfluous in this context.I would l
Hello everyone, I’m looking for some help getting an Ethernet TCP server running using LwIP with FreeRTOS on an STM32. Current status: Hardware: NUCLEO-H723ZG Stack: LwIP + FreeRTOS Development Environment: STM32CubeMX and STM32CubeIDE TCP client/monitor: Hercules v3.2.8 I can ping the board successfully every time (with Windows terminal and Hercules) However, I cannot establish a TCP connection when FreeRTOS is enabled What’s confusing me is that: If I disable FreeRTOS, I can successfully establish a TCP connection using the CubeMX example LwIP_TCP_Echo_Server Once FreeRTOS is enabled, the TCP connection attempt from Hercules fails (no connection established) What I’ve tried so far: Multiple CubeMX LwIP + FreeRTOS example configurations Both Netconn and Socket-style APIs Adjusting task priorities and stack sizes Verifying IP address, subnet, gateway, and port settings Confirmed Ethernet link is up and LwIP responds to ping At this point, it feels like I’m
I have designed a custom board based on the STM32F767ZI MCU. To enable Ethernet connectivity, I integrated the KSZ8081RND PHY, along with the necessary magnetics and an RJ45 connector. You can find the full schematics in the attached PDF.On the hardware side, everything appears to be functional. I can confirm the presence of the 50MHz clock signal feeding both the PHY and the MAC. I have trace-matched the signals to this clock, and the MDI signals also look correct (including route matching). I can observe the TX_EN line going high (3.3V) during activity, as well as movement on the other lines. Just to clarify, I am using the RMII interface.The MDIO and MDC signals seem fine, as I am able to successfully read the PHY registers. For instance, reading register 0x02 on the KSZ8081RND correctly returns the ID 0x0022. I also see activity blinking on the RJ45 LED.During debugging, it seems I can receive ping requests on the board; I can inspect the memory and see my Host's MAC address and th
Hi, HAL_LIN_SendBreak seems to be blocking CPU, is there a way to bring UART TX pin down then wait for timer and bring it up? I have done it making GPIO pin GPIO_MODE_OUTPUT_PP then back to GPIO_MODE_AF_PP but init after takes long time. I was wondering is it possible to do it within UART without changing pin mode? Or reducing the time pin mode init is required? void LIN_SendFrame_IT(void) { __HAL_UART_DISABLE(&huart2); GPIO_InitTypeDef g = {0}; g.Pin = LIN_TX_Pin; g.Mode = GPIO_MODE_OUTPUT_PP; g.Speed = GPIO_SPEED_FREQ_HIGH; HAL_GPIO_Init(LIN_TX_GPIO_Port, &g); HAL_GPIO_WritePin(LIN_TX_GPIO_Port, LIN_TX_Pin, GPIO_PIN_RESET); TIM2->ARR = 900; // 900us break TIM2->CNT = 0; TIM2->CR1 |= TIM_CR1_OPM; HAL_TIM_Base_Start_IT(&htim2); } void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim) { if (htim != &htim2) return; HAL_GPIO_WritePin(LIN_TX_GPIO_Port, LIN_TX_Pin, GPIO_PIN_SET); GPIO_InitTypeDef g = {0}; g.Pin = LIN_TX_
This thread is the follow-up to this thread Hi, is clear that uart pins are connected , the counter of received bytes is a real value. I try this one: 1. Stop RTOEN interrupt 2. And get interrupt from DMA when buffer is HALF and FULL : and I have data in DMA buffer: huart2.Instance->RTOR = 100; // __HAL_UART_ENABLE_IT(&huart2, UART_IT_RTO); // huart2.Instance->CR2 |= USART_CR2_RTOEN; HAL_NVIC_SetPriority(USART2_IRQn, 0, 0); HAL_NVIC_EnableIRQ(USART2_IRQn); this is in : static void MX_USART2_UART_Init(void) and : void DMA1_Stream0_IRQHandler(void) { /* USER CODE BEGIN DMA1_Stream0_IRQn 0 */ HAL_UART_Transmit( &huart1, dma_buf ,DMA_BUFFER_SIZE , HAL_MAX_DELAY); /* USER CODE END DMA1_Stream0_IRQn 0 */ HAL_DMA_IRQHandler(&hdma_usart2_rx); /* USER CODE BEGIN DMA1_Stream0_IRQn 1 */ HAL_UART_Receive_DMA(&huart2, dma_buf, DMA_BUFFER_SIZE); /* USER CODE END DMA1_Stream0_IRQn 1 */ } this is on DMA interrupt. Then we have data:
Hi everyone! I'm using an Arduino Portenta H7 (STM32H747) board mounted on a custom carrier board. I'm using STM32CubeIDE as a development environment, with HAL libraries for peripheral initialization.I'm only using the Portenta's M7 core. Portenta interfaces via GPIO to a parallel bus that drives both a display and other peripherals. I'm also using the RTC module for the system clock only, initialized at startup via HAL. Everything works fine until I try to set the RTC datetime using this function: void tm_wr(struct tm *_tm) { RTC_DateTypeDef sDate; RTC_TimeTypeDef sTime; if (_tm->tm_wday == 0) { sDate.WeekDay = 7; } else { sDate.WeekDay = _tm->tm_wday; } sDate.Month = (uint8_t)_tm->tm_mon + 1; sDate.Date = (uint8_t)_tm->tm_mday; sDate.Year = (uint16_t)(_tm->tm_year-100); HAL_RTC_SetDate(&hrtc, &sDate, RTC_FORMAT_BIN); sTime.Hours = (uint8_t)_tm->tm_hour; sTime.Minutes = (uint8_t)_tm->tm_min; sTime.Seconds = (uint8_t)_tm->tm_sec; HAL_RTC_SetTime(&
So here is the outline of my code. I'm getting data every 5 seconds (example data: "vref:2975.12, voltage_max:30.00, voltage_min:-1219.00,avg_error: 4136.04") via UART and i transmit it again to view it in putty via ST Link (USART3). Problem is some of the data is getting corrupted, i'm attaching the Putty terminal output. I have verified the input, using logic analyzer and it's correct.Here is the code, can you help me identify what i might be doing wrong/* USER CODE BEGIN Header */ /** ****************************************************************************** * @file : main.c * @brief : Main program body ****************************************************************************** * @attention * * Copyright (c) 2026 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. * **
Hello,I am currently working on a project with an HTTP server, successfully implemented using FreeRTOS. In this setup, I handle client requests for opening and collecting data from the client side. However, since I need to display real-time data on a web page (for an IoT application), it has become necessary to implement the WebSocket protocol.I am looking to implement a WebSocket server on my STM32f746G-DISCO. Unfortunately, I have not been able to find any working examples of WebSocket implementation on STM32.Could you kindly point me in the direction of any relevant examples or provide some guidance on how to get started with this? Also, I would appreciate any insights regarding whether I need to modify my CubeMX configuration when implementing WebSocket, or if the standard initialization is sufficient — enabling ETH, activating lwIP (httpd) without DHCP, and activating FreeRTOS with the default task where the following initialization is done:MX_LWIP_Init();http_server_init();Any he
Hi,I have implemented CDC USB device on my custom board using STM32C071CBT6. When i connect USB cable to host PC then I can see Virtual COM Port on PC as 'USB Serial Device (COMxx)' However, I tried transmitting some data which I could not receive on PC side. After debugging I noticed that function USBD_CDC_ACM_Activate() is never getting called. In file, app_usbx_device.c, function MX_USBX_Device_Init() has following code:UINT MX_USBX_Device_Init(VOID){UINT ret = UX_SUCCESS;UCHAR *device_framework_high_speed;UCHAR *device_framework_full_speed;ULONG device_framework_hs_length;ULONG device_framework_fs_length;ULONG string_framework_length;ULONG language_id_framework_length;UCHAR *string_framework;UCHAR *language_id_framework; UCHAR *pointer; /* USER CODE BEGIN MX_USBX_Device_Init0 */ /* USER CODE END MX_USBX_Device_Init0 */pointer = ux_device_byte_pool_buffer; /* Initialize USBX Memory */if (ux_system_initialize(pointer, USBX_DEVICE_MEMORY_STACK_SIZE,
I've seen that, trying to download the STM32CubeH7RS Firmware Package from CubeMX, I'm seeing the latest version is 1.3.0.On the actual documentation and GitHub repository https://github.com/STMicroelectronics/stm32h7rsxx-hal-driver I'm seeing that the version is 1.2.1Dates are the same, so I think the version is the same, just with different numbering; is it correct?
Dear allI am relatively new to STM32, using STM32H563 as an SPI slave to receive data and send some feedback data as same time, The SPI master is a Tiva MCU form Ti, as data is relatively long, I need to use DMA, I tried to find an example for it, but there is none with DMA, could some one please provide some starting point for me? Thanks in advance.Ping
Hi you all,as a breef summary; I set up a timer to trigger an adc that should than use the DMA to transfer the data to memory, i need 111 samples at a time. Sadly for some reason this only works for one sample so if i check __HAL_DMA_GET_COUNTER(g_hadc1->DMA_Handle) it will get stuck at 110.and subsequently my HAL_ADC_RegisterCallback(g_hadc1, HAL_ADC_CONVERSION_COMPLETE_CB_ID, ADC_LineScanComplete_Callback); is never called.Though the timer and ADC for sure triggeres as i can the see the DR register updating its value.And as far as the reference manual goes (Page 961 DMA One-shot) it should be possible to use HAL_ADC_Start_DMA(g_hadc1, (uint32_t*)dest, 111); to get like 111 sequential timer triggered samples, that are transfered to memory via DMA I tried various combinations of all possible adc settings, and all of them keep beeing stuck on 110 remaining DMA cycles. As well as trying to look up the resgisters for any errors that might have been accured, but
Dear @YutinhLin , Post Edited by ST moderator to apply source code formatting and translate from Chinese to English to comply with the community rule: Best regards, Gyessine 晶片型號 : STM32H723VGTx RX 與 TX Buffer 都已配置到 D2 區塊 使用狀況 : 第一次執行 HAL_UART_Transmit_DMA 正常 執行 HAL_UART_AbortReceive() -> HAL_UARTEx_ReceiveToIdle_DMA() 後 再執行 HAL_UART_Transmit_DMA 無法正常工作 請問這樣的使用方式是否正確 或是需要另外的設定動作才能再正常使用 Chip model: STM32H723VGTx Both the RX and TX buffers are allocated in the D2 domain. Usage scenario: The first execution of HAL_UART_Transmit_DMA operates correctly. After executing HAL_UART_AbortReceive() followed by HAL_UARTEx_ReceiveToIdle_DMA(), subsequent execution of HAL_UART_Transmit_DMA does not function as expected.
I’m attempting to learn BLE and IoT and have purchased the following boards to get started.NUCLEO-F401RE MCU brdX-NUCLEO-IDB05A2 BLE Expansion brdDownloaded:STM32CubeIDE Version: 2.0.0 Build: 26820_20251114_1348 (UTC)STM32CubeMX Version: 6.16.1x-cube-ble1 BLE DemoThe main program calls HAL-Init() which goes directly to the HardFault_Handler()My preliminary conclusion is that Version 20.0.0 is not compatible with the demo program based on help I sought on ChatGPT. It recommends Version 1.19.0. Is this correct?May need to back up and start from scratch and would appreciate a point in the right direction to avoid going down any unnecessary rabbit holes.Thank you, BareMetaler
Hi ST team,I am using STM32U5G9 MCU. After modifying option bytes, HAL_FLASH_OB_Launch() would be called to apply the changes.But in the launch function, it states that "Option byte launch generates Option byte reset". I have other tasks need to be done after calling HAL_FLASH_OB_Launch(). I don't want device to be reset after calling HAL_FLASH_OB_Launch() immedately.Is there a way to trigger reset manually after modifying option bytes?1. Modify option bytes2. Call HAL_FLASH_OB_Launch()3. Reset device manually Thank you.
Hello,I'm wondering if Cube's generated code for is thread safe. In particular, whether malloc can be safely used in a multi-threaded FreeRTOS setup.The broken malloc behavior was first described by Dave Nadler in 2019 here. He has also written about it on his webpage.In 2021, ST seems to have introduced some "fixes" to this problem, by adding a thread-safe code generation option in CubeMX and implementing the various __retarget_lock* newlib functions to make sure that newlib can behave correctly in a multi-threaded environment.However, it seems like that these implementations are buggy. One such issue is reported here, where the lock's nesting level is (incorrectly) modified before entering the critical section. I've just reproduced this exact issue today, with Cube version 6.11.1.I'm quite confused about the current state of this issue. Are the things described by Dave Nadler still relevant or applicable? Is ST going to fix the bugs in the __retarget_lock* implementations? For people
I'm using STM32N6 with stm32-mw-camera to communicate to CAM-66GY sensor. I also have CAM-16GZ sensor, but looks like this sensor is not supported (because of VD6G_BAYER_NONE when I use vd6g driver). What are my options to integrate CAM-16GZ into the same project?Thank you
Hi,I made a custom bootloader to upload my application using the virtual com port by the USB interface.This works nicely, but my application also has a part in flash to store its configuration. When I flash my user program, I do not want to overwrite the configuration. Therefore, this is a special part in the flash memory.Is it possible in the STM32CubeIDE to generate a bin-file for this configuration to have a default configuration?Is it also possible to generate a bin-file using my bootloader, by reading the flash memory where the configuration starts? Because it would be great to backup a configuration.Greetings,ErX
Hello ST team,I am developing a camera application on STM32N6570-DK + IMX335.The entire capture/display pipeline follows the official DCMIPP_ContinuousMode example: IMX335 RAW10 → CSI → ISP → PixelPacker RGB565 → LTDC However, the LCD output shows a corrupted pattern like in the attached video:The image reacts to hand movement (so the sensor is streaming), but the content becomes color-shifted, diagonal, and distorted. The pattern matches the behavior when:RAW10 is fed directly into the PixelPacker interpreted as RGB565,meaning the ISP output is never routed to Pipe1. What currently works1. IMX335 is clearly streaming (image brightness changes when covering the lens).2. CSI + Pipe1 receive real frames.3. LTDC and framebuffer work correctly (solid-color test OK).4. All registers after DCMIPP init match the official demo.5. ISP_Init() and ISP_Start() both return OK (0).6. ISP_BackgroundProcess() also returns OK. What is incorrectAfter ISP_Start()
I am just curious about information in the flash. #ifndef DEVICE_VERSIONING_INFORMATION_H #define DEVICE_VERSIONING_INFORMATION_H typedef struct { uint32_t magic; // 0x46575652 = 'FWVR' uint8_t major; uint8_t minor; uint8_t patch; uint8_t build; } fw_version_t; __attribute__((used, section(".fw_version"))) const fw_version_t fw_version = { .magic = 0x46575652, .major = 1, .minor = 3, .patch = 2, .build = 7, }; #endif // DEVICE_VERSIONING_INFORMATION_H I wrote in the linked script file (.ld) some versioning information. I guess it is the best way to store the device versioning information because that way allows the swd to get directly from the flash the version, although, I can get it too by request and response by uart. However, why there is more data after the version information in the flash memory?Is this normal? Should the user defined constants in the flash be followed by other information?/* ******************************************************
Hi everyone,I am working on a project with the NUCLEO-H7S3L8 and trying to read 2 ADCs simultaneously in Continuous Conversion mode using HPDMA.The Goal:ADC1 & ADC2: Reading 7 channels each (14 channels total).Mode: Continuous Conversion, Circular Mode.Transfer: HPDMA to SRAM (AHB SRAM).The Problem: I am receiving data, but the values are extremely unstable/fluctuating.When running a smaller example from a ST-Employee, values were stable (around 400).With the full 7-channel scan, the data fluctuates significantly, at a level where data should be wrong.Can someone take a look at it? They both use the same bootloader. I honestly cant see any issues with my custom config.Thanks in advance. This is also my linker if relevant:/* ****************************************************************************** ** ** @file : LinkerScript.ld ** ** @author : STM32CubeIDE ** ** Abstract : Linker script for STM32H7Sxx Device ** 128KBytes FLASH ** 456KBytes RAM ** ** Set heap size, sta
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.