Ask questions and find answers on STM32Cube packages, including HAL, LL and middleware, and expansion software.
Most recent activity
Dear STM32 Community, We believe that the example projects provided for the STM32Cube embedded software are a valuable resource when developing projects. We would like to better understand how developers use these examples in their workflow and explore ways to improve them. Therefore, we have a few questions we would like to ask: From where do you obtain the examples, and why? Are you working with the examples through the STM32Cube MCU packages, the STM32CubeMX Example Selector, or through GitHub? Is there a particular reason you prefer one channel over the others? How do you use the examples in your work with STM32 embedded software? Do you use the examples to learn how to use a driver or a feature, as reference code for implementation, and/or for debugging? What is working well, and what can we do to improve the examples and/or your experience working with them? You can either reply directly in this thread or feel free to send me a private message. &nb
Hello everyone,I am having an issue with EEPROM Emulation initialization in my STM32 project.I am currently trying to implement the EEPROM Emulation utility using STM32CubeMX2 v1.1.0.The program starts with mx_system_init(), which initializes the peripherals and other required modules such as FLASH, RCC, etc. After that, I call mx_eeprom_emulation_init(). During this initialization, the MCU enters a HardFault.Detailed informationThe call hierarchy is:main() → mx_eeprom_emulation_init() → EE_Init() → EE_FLITF_Init() → Page_GetState() → EE_ITF_FLASH_ReadData()Inside EE_ITF_FLASH_ReadData(), the code tries to access address:0x09000018and immediately enters a HardFault.I also analyzed the fault using the Fault Analyzer in STM32CubeProgrammer. The results are:SCB_BFAR: 0x09000018 BusFault: Precise data access error (PRECISERR) The BusFault is escalated to a HardFault (FORCED)I also checked the EDATA_EN option bit in STM32CubeProgrammer, and it appears to be enabled correctly.At this point,
I have a custom board using STM32H735ZGT6 and the LAN8742 Ethernet PHY using RMII. During the execution of CubeMX generated Ethernet initialization code, the MAC software reset bit is not cleared triggering an error. I have read a lot of forum posts about this issue and have verified the following:The RMII reference clock is supplied by the PHY using a 25MHz crystal as in the H723 nucleo board. The 50MHz clock generated by the PHY is present at PA1 pin and verified with an oscilloscope. (see osci image below) VDDCR voltage is 1.2V generated by internal regulator on PHY The PHY hardware reset is supplied by a MCU GPIO, and the resistor straps seem to function properly during reset (probed all with oscilloscope). I also have a pulldown resistor on the LED2 pin so that REFCLKO is generated by PHY. I can communicate through MDIO with the PHY to read out and write to registers, confirming that straps work ok. The output side of the PHY works, a link is established in both 10 and 100Mbps mo
I was trying to configure ethernet on my android phone via using usb cdc ncm on stm32 nucleo U5A5 and i was unable to see the ethernet option in the network settings of the phone.It was completely greyed out. I tried the same on ios and i was able to connect via ethernet. What am i supposed to do to resolve this ?im using ncm of tiny usb for this connectivity.
Hi, everyone. I have been doing some courses bout stmf411 programming, it is quite good course. However a question comes up in my mind all the time. How would i learn if i wouldn’t have nobody to teach me all the microcontoller stuff ? or in other way how have the stm32 programmer master learnt to program? is there a special course that is given by STM company?What is the main source for becoming a master in st microcontroller master? I would really appreciate any answer to this that blow my mind … Thanks a lot
SDMMC HAL driver implementation is full of timeouts like this:uint32_t count = SDMMC_CMDTIMEOUT * (SystemCoreClock / 8U / 1000U); do { if (count-- == 0U) { return SDMMC_ERROR_TIMEOUT; } sta_reg = SDMMCx->STA; } while (SOME_FLAG_NOT_SET);It may work in a single-threaded application on some basic CPU which runs fixed clocks per cycle, but it's not accurate on CPUs with dual-issue pipeline. All preempting interrupts and in case RTOS is used, all higher priority tasks, prolong this timeout. And vice versa - the longer this timeout gets the more it blocks lower priority tasks and interrupts. And the timeout isn't even in microseconds to justify it. SDMMC_CMDTIMEOUT value is 5000 milliseconds (by the comment). It's bad implementation by any standard.It's been so for a long time in many STM32 series (F4, H7, H7RS, N6, etc.). It's reported at least 6 years ago: I may have encountered a bug in SDMMC_GetCmdResp1 ... - STMicroelectronics CommunityI didn't check all the post
Hello,I am using an STM32F207VC custom board with Ethernet and LwIP. I am facing an issue related to Ethernet cable connection during power-up.I performed the following tests:Test A: Ethernet cable connected before power ONConnect the Ethernet cable.Power ON the STM32 board.Result:Ping: WorkingTCP server connection: WorkingTest B: Ethernet cable disconnected during power ONDisconnect the Ethernet cable.Power ON the STM32 board.Wait until all STM32, Ethernet, and LwIP initialization is completed.Connect the Ethernet cable.Result:PHY Link Up: DetectedPing: WorkingTCP server connection: Not workingTest C: Cable disconnect and reconnect after normal startupStart the board with the Ethernet cable connected.TCP server works normally.Disconnect the Ethernet cable.Reconnect the Ethernet cable.Result:Ping: WorkingTCP server connection: WorkingThe issue occurs only when the STM32 board is powered ON while the Ethernet cable is disconnected and the cable is connected later.Since ping works and th
Hi,On STM32U575CGU3, calling MX_ADC1_Init() once increases the device current by about +200 µA. After that, even if I run HAL_ADC_DeInit(), reset ADC1, and disable VddA, the extra +200 µA current does not disappear.Here is the minimal code:cint main(void){ HAL_Init(); SystemClock_Config(); MX_GPIO_Init(); MX_GPDMA1_Init(); MX_ADC1_Init(); // <-- Base +200uA increase MX_OCTOSPI1_Init(); MX_SPI1_Init(); MX_USB_OTG_FS_PCD_Init(); MX_USART1_UART_Init(); MX_ICACHE_Init(); // ADC Disable HAL_ADC_DeInit(&hadc1); // <-- This does NOT reduce the +200uA __HAL_RCC_ADC1_FORCE_RESET(); __HAL_RCC_ADC1_RELEASE_RESET(); HAL_PWREx_DisableVddA(); while (1) { __NOP(); }}QuestionDoes ADC_Init enable an internal analog bias that cannot be fully disabled by ADC_DeInit, ADC reset, or VddA OFF? Is there any complete shutdown procedure to fully power down ADC/VREFBUF after initialization?Thanks.
Hello everyone,Actually I am making a data acquisition system in which my mcu takes analog data from a sensor and stores it in a buffer, and then into a 2nd buffer with the help of DMA in double buffer mode. Now i want to transfer this data via UART to my screen with the help of PuTTY with the same ping-pong architecture. For this i need to convert 12 bit adc value to data suitable for uart (8 bit). which i do with the help of a function without any issue and then store them in different two buffers. now the thing is that i want a system in which when buffer 1 is being filled by adc, buffer two will be transferred by uart and vice versa, now the main problem is that there is no sync between the buffers and the ownership. and it is mostly due to the conversion and size of buffers (uart buffers are twice the size of adc buffers) as i am using double buffer transmission mode in DMA controllers of both adc and uart.So do you think i should use single buffer transmission with circular buffe
Hello ST Community,I’m developing a custom external loader for a GD25Q64E flash device and cannot get STM32CubeProgrammer to read/write/erase the external flash. I’ve attached a screenshot of the error reported by the programmer.What I’ve doneFollowed the ST tutorial “External QSPI loader how to” External QSPI loader how to - STMicroelectronics. Verified read/write/erase work when exercised from main.c — no errors there. When running the loader, I see a hardfault reported in the CubeProgrammer “HardFault” tab. There is a hardfault at the end of loader_src.c in init(); I’m not sure whether that is expected. Project uses SPI3 with DMA and interrupts to talk to the external flash. I have also tested this with just polling and verified read/writing/erase work when exercised from main.c Device and external flash infoFlash: GD25Q64E SPI instance: SPI3 (Polling)Questions: Any troubleshooting tips for getting the custom loader working with STM32CubeProgrammer (and diagnosing the hardfault sho
MCU / setupSTM32F746IGK, VDD = 3.3 V HSE 16 MHz, PLL: M=8, N=200, P=/2 → SYSCLK = 200 MHz (AHB=200, APB1=/4, APB2=/2) Scale 1 + Over-drive, FLASH_LATENCY_6 Already below the 216 MHz maximum Application executes from the ITCM Flash alias (0x002xxxxx; AXI alias 0x080xxxxx) Cortex I-Cache and D-Cache disabled at startup ART accelerator / prefetch enabled in HAL (ART_ACCELERATOR_ENABLE, PREFETCH_ENABLE) Bare metal, 1 ms cyclic scheduler, no RTOS X-CUBE-STL Flash TM every 1 ms: 1 KB window, HW CRC-32 (poly 0x04C11DB7, init 0xFFFFFFFF, word reverse in / reverse out). Expected CRC is a table built offline from the same image (zlib.crc32 / IEEE 802.3).What we see After several hours in RUN (typically ~11–19 h, not at POST), Flash TM returns STL_FAILED (0xD32D) on a 1 KB window. A software CRC of the same window also mismatches, so this is not only the CRC peripheral.On fail we dumped the 1 KB window from the CPU. The dump CRC always equals the TM computed CRC and differs from the programmed im
Hii All,I am working on a custom PCB based on the STM32H747IITX MCU, and I am facing an issue with the Ethernet interface.The Ethernet connection is currently not working on my custom board. I have checked the basic hardware connections, but I am unable to identify the root cause.I have attached the Ethernet schematic of my custom PCB for reference.Could someone please help me review the schematic and suggest what I should check?In particular, I would appreciate guidance on:STM32H747IITX Ethernet RMII configuration and pin assignments PHY hardware connections and required configuration PHY reset and power-supply requirements 25 MHz/50 MHz Ethernet clock configuration PHY address and MDIO/MDC communication Required Ethernet termination/bias components STM32 Ethernet GPIO alternate-function configuration Any hardware-specific requirements or common mistakes when designing Ethernet on a custom STM32H747 board Recommended steps to debug whether the issue is on the MCU, PHY, clock, or PCB s
I want progrma the STM32C071RBT6 for to get a virtual COM port.I’m using NUCLEO-C071RB board and this are the settings with Cube MX: I add some instructions into the main like this:int 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(); /* USER CODE BEGIN SysInit */ /* USER CODE END SysInit */ /* Initialize all configured peripherals */ MX_GPIO_Init(); MX_CRC_Init(); MX_USB_PCD_Init(); MX_USBX_Device_Init(); _ux_dcd_stm32_initialize(0, (ULONG)&hpcd_USB_DRD_FS); if (HAL_PCD_Start(&hpcd_USB_DRD_FS) != HAL_OK) { Error_Handler(); } /* USER CODE BEGIN 2 */ /* USER CODE END 2 */ /* Infinite loop */ /* USER CODE BEGIN WHILE */ while (1) { /* USER CODE END WHILE *
Hello, I have an ST Nucleo U5A5ZJ-Q board. I am powering the board through the CN1 connector and using the ST-LINK at the same time.In the project I am working on, I would like to connect a USB device to the hardware. For this purpose, I want to use the USB Type-C connector.When I connect the sensor to the Type-C connector, it does not receive any power. My assumption is that I cannot power the device through the USB Type-C connector. Also, LD7 does not light up.I wanted to consult you about this before doing anything that might damage the board.In addition I use usb standalone(STM32Cube FW_U5 V1.8.0).Thank you in advance for your support. Best Regards,Faruk
so this is my data acquisition system, i want you to suggest some improvements in it. as the adc + dma ping pong buffer is working fine, but after that the conversion and its transmission via dma+uart ping-pong buffer is so much miserable. there is no synch between these buffers.here is my project:Vishwas1523/dataAcquisitionSystemPS: i am using stm32 nucleo f446re
Hi,I am using my own board based on an STM32F207ZG with STM32F2 HAL v1.9.4. I implemented a USB HID Host using STM32CubeIDE (v1.19.0), simply enabling USB Host and HID Class support in CubeMX and generating the code.I was able to read keys correctly from a standard USB desktop keyboard. However, I was not able to read from a USB HID RF reader. While debugging the problem, I noticed the following code in `usbh_hid.c`, inside `USBH_HID_Process()`:case HID_IDLE: status = USBH_HID_GetReport(phost, 0x01U, 0U, HID_Handle->pData, (uint8_t)HID_Handle->length); if (status == USBH_OK) { HID_Handle->state = HID_SYNC; }This initial `USBH_HID_GetReport()` therefore has to complete successfully before the state machine proceeds to `HID_SYNC` and eventually reaches `HID_GET_DATA`, where `USBH_InterruptReceiveData()` starts polling the HID interrupt IN endpoint EP1. My question is: What is the intended purpose of this initial `G
Introduction:Hello ST Team and Community, Following a recent architectural discussion on the Zephyr RTOS project (recommended by @erwango to be shared here), I would like to submit feedback and a feature proposal regarding how the Flexible Memory Controller (FMC) master controller enable gate is handled in the STM32Cube HAL/LL drivers.Background: On newer STM32 architectures (STM32H7, STM32U5, STM32H5, STM32H7RS, STM32N6, STM32MP1/2), the FMC block contains a master peripheral gate bit (FMC_BCR1_FMCEN or FMC_CFGR_FMCEN) which must be asserted for external bus transactions to occur. Currently in the STM32Cube firmware:There is no standalone HAL_FMC_Init() or public LL_FMC_Enable() API.The master gate is only asserted via the private macro __FMC_ENABLE() inside: HAL_SRAM_Init() HAL_SDRAM_Init() HAL_NOR_Init() Inversion of responsibility: While this chip-centric approach works seamlessly in standard STM32CubeMX bare-metal projects with discrete SRAM/SDRAM chips, it creates architectu
Hello,I ran into a bug in fx_stm32_sd_driver function.Our firmware was calling fx_media_volume_set on a partitioned card and we found it was corrupting the disk. The issue is that the FX_DRIVER_BOOT_WRITE case statement hardcodes the boot sector to be at sector number 0. This works for unpartitioned (superfloppy) layouts, but does not work on partitioned SD cards with a master boot record. Calling fx_media_volume_set on a partitioned drive overwrites the MBR instead of the boot sector and corrupts the disk.Note that the FX_DRIVER_BOOT_READ, which also has to manage this problem correctly calculates the offset using the _fx_partition_offset_calculate function.Regards,Mike
Hello @ST Community @ST MICROCONTOLLER I have purchase NUCELO-H563ZI board.Purpose: I need to read and write pendrive sector using only pure HAL HCD driver (Baremetal Code only) (No FILEX, USBx, ThreadX, FreeRTOS)Following is my Hardware Connection: I am using external USB Type A Female Breakout board. Not using internal CN13 TypeC USB connector.PA11 : D-MinusPA12 : D-PLUSVCC : 5VGND : Board GroundI have attached file which can read and write the sector.While submitting request for “Get Descriptor” command. Code is stuck during USB_EnumerateMSC » USB_GetDescriptor » “USB_ControlTransfer” » “USB_SubmitTransfer” >> “HAL_HCD_HC_SubmitRequest” stuck in “USB_WaitForURB>>HAL_HCD_HC_GetURBState” function.I can observe that while submitting “HAL_HCD_HC_SubmitRequest” request on channel 0 HAL Drive respond on channel 1 instead of channel 0. ch[0].urbState = USB_IDEL while ch[1].urbState = USB_DONE.Also i have also observe that “HCD_HC_OUT_IRQHandler(hhcd, (uint8_t)i);” API “uint8
Hi,I am using my own board based on an STM32F207ZG and STM32F2 HAL v1.9.4.I implemented an HID Host using STM32CubeIDE (v1.19.0), simply selecting USB Host and HID class support in CubeMX and generating the code.I was able to read key events from a standard USB desktop keyboard. However, I was not able to read any key events from a USB HID RF tag reader.While debugging usbh_hid.c, I noticed the following: USBH_HID_SetProtocol(phost, 0U); generates a SET_PROTOCOL request with wValue = 0x0001 (Report Protocol)whereas: USBH_HID_SetProtocol(phost, 1U); generates wValue = 0x0000 (Boot Protocol).because this implementation:if (protocol){ phost->Control.setup.b.wValue.w = 0U;}else{ phost->Control.setup.b.wValue.w = 1U;}In other words, the protocol parameter passed to USBH_HID_SetProtocol() is inverted with respect to the value actually transmitted in the USB SET_PROTOCOL request URB.I noticed that the same implementation is still present in STM32F2 HAL v1.9.6.I am not sayi
Part: STM32U375CE (Cortex-M33 r0p4), ChibiOS, system clock MSIS 4 MHz, FLASH_ACR = 0x100 (0 WS, prefetch on), ICACHE enabled, LDO. Firmware enters Standby from a small function: PWR_CR1.LPMS = 100b, SCB_SCR.SLEEPDEEP = 1, DSB, ISB, WFI. Standby exit is by reset, as documented. Symptom. With identical source, whether the part enters Standby depends on where code lands in the image. Inserting n nops into a function that is not even on the idle path flips idle current between 4.4 uA and 1040 uA (0/2 nops sleep; 4/8/16/32 stall; three trials each). Two builds with a byte-identical 77-instruction arming function, same WFI offset within its flash line, same call list, differing only in two literal-pool data words, behave differently. Whole-tree -O0 always sleeps. Disabling ICACHE, or running the arming sequence from SRAM (.ramtext), makes every build stall. What the stalled state is. Plain stores into retained SRAM2 (PWR_CR1.RRSB3) read back over SWD after connect-under-reset show the firmwa
I am developing a custom embedded device that uses PIMA with USBX in order to access the SD card contents of my PCB from a PC through USB.When UX_PIMA_WITH_MTP_SUPPORT is enabled, the device is correctly detected by Windows and communication works properly.However, in order to correctly represent a hierarchical folder structure in Windows Explorer using MTP, I would need support for command 0x9805 (GetObjPropList, CMD 00000043). As far as I can see, USBX does not implement this command.To avoid implementing the full MTP property system myself, I wanted to use the more generic PIMA behavior instead, where the host requests ObjectHandles each time the user enters a folder, similar to how old digital cameras behaved.The issue is that when I disable UX_PIMA_WITH_MTP_SUPPORT, the PC no longer even recognizes that a USB device is connected. If I enable the macro again, everything works correctly.So my question is:Is disabling UX_PIMA_WITH_MTP_SUPPORT expected to completely break USB enumerat
Hi everyone, I am facing an long-standing issue with a STM32L476RE-powered device loosing UART frames when waking up from UART3 from Stop Mode (will be analyzed on another issue).Prompted by this, I have a generic question for clock configuration after Stop1-2 mode.The device uses HSI & LSE for all of its peripherals, in a bare-metal CubeMX project.Q1: The function __HAL_RCC_WAKEUPSTOP_CLK_CONFIG(RCC_STOP_WAKEUPCLOCK_HSI);is called 1 time before while(1){} loop. Should it be called just once or should it be called every time before calling HAL_SuspendTick();HAL_PWREx_EnterSTOP1Mode(PWR_STOPENTRY_WFI);?Q2: Should we call SystemClock_Config();every time after waking up from Stop mode, despite the fact that the clock selection ( HSI & LSE ) remains the same and no PLL or MSI is used ?Q3: Could calling SystemClock_Config();HAL_ResumeTick();disrupt an ongoing UART-RX ( running on Idle-line callback ) , despite the fact that clock selection is not changing ? Thank you in advance
I was finding non-deterministic behavior entering standby -- small code changes unrelated to the standby code or devices seemed to prevent standby. Many hours of debugging later using a joulescope and claude automation, the following fixed the problem -- declare the standby code as noinline (by default, my builds inline small funcitons) void __attribute__((noinline)) enter_standby_mode(void) Also, an attribute to not optimize works as well. It did not appear that the generated assembly for the standby code changed, but what did change, due to inlining, is the code alignment. This suggests, but doesn’t confirm, that the fetch pipeline can impact the ability to enter standby on this part. This was never an issue on the stm32l432.
Hello, I am using an STM32H750I-DK Discovery board with LAN8742 PHY, MII mode, FreeRTOS and LwIP.Ethernet works initially: the STM32 IP appears in arp -a and I can ping it. After some time, the ARP entry disappears and ping gives Request timed out or Destination host unreachable.I have already checked the IP configuration, MII configuration, PHY link, DMA, MPU/cache, and tried disabling RTP traffic, but the issue still occurs.What could cause the STM32H750 Ethernet connection to stop responding to ARP and ping after working normally for some time? What should I check next?
ST Community highlights – April to June 2026
Already have an account? Login
No account yet? Create an account
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.