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
Hi,I'm working with an STM32N6570-DK and need the microSD slot (CN13, SDMMC2) to run at 1.8V signaling instead of the 3.3V default. The device I'm connecting only supports 1.8V, and the target speed is modest, around 25 MHz.What's the correct procedure to make this switch on this board?So far I've driven SD_SEL (PO5) high to flip U32, but CN13 pin 3 still measures 3.3V. AN5967 (Getting started with hardware development for STM32N6) section 12.4 points to PWR_SVMCR2.VDDIO5VRSEL together with OTP124 bit 13 (HSLV_VDDIO5), which currently reads 0 on my board.Two things I'm unsure about: Is burning HSLV_VDDIO5 actually required for 1.8V operation, or only to reach the datasheet frequencies? Does burning it permanently prevent the slot from working with ordinary 3.3V SD cards?
In RM0490 Rev 6, Reference Manual for the STM32C0, the ADC Software Calibration Process is specified as follows: Software calibration procedure1. Ensure that ADEN = 0, AUTOFF = 0, ADVREGEN = 1, and DMAEN = 0.2. Set ADCAL = 1.3. Wait until ADCAL = 0 (or until EOCAL = 1). This can be handled by interrupt if theinterrupt is enabled by setting the EOCALIE bit in the ADC_IER register.4. The calibration factor minus one can then be read from bits 6:0 of the ADC_DR orADC_CALFACT registers. The resulting calibration factor must be incremented by oneand written back to the ADC_CALFACT register.5. To reduce the noise effect of the calibration factor extraction, the software can makethe average of eight calibration factor values. This step is optional but recommendedfor better accuracy.The averaging procedure is as followsa) Obtain eight incremented calibration factor values (perform eight times step 2 tostep 4).b) Calculate the average of these eight values and round it up to the nearest integer
Hello everyone,I'm developing an application using the STM32H563 with TrustZone enabled. Online tutorials first show configuring the fuse bits using the STMCubeProgrammer software:TZENSECWM1_STRTSECWM1_ENDSECWM2_STRTSECWM2_ENDThen, the application is installed in the STMCubeIDE, where it is saved and executed correctly.However, if the developer tries to install the application without going through the first step, the code is unable to exit the safe zone, resulting in a hard fault error. This is because the IDE, when TrustZone is enabled, assumes that all FLASH memory is in the safe zone.I would like to change these fuse bits without using STMCubeProgrammer. I believe it's possible, but I haven't found any information where the result is satisfactory. Could someone help me?
Here is my main and jump to bootloader :int main(void){ HAL_Init(); SystemPower_Config(); SystemClock_Config(); HAL_Delay(500); // Catch bootloader constantly resetting jump_to_bootloader(); while (1) { HAL_Delay(50); }}#define BOOTLOADER_ADDR (0x0BF90000UL)HAL_StatusTypeDef jump_to_bootloader(void){ __disable_irq(); HAL_RCC_DeInit(); // Must be run before disabling systick because it depends on it HAL_DeInit(); SysTick->CTRL = 0U; // Disable systick SysTick->LOAD = 0U; SysTick->VAL = 0U; int count = sizeof(NVIC->ICER)/sizeof(NVIC->ICER[0]); for (int i = 0; i < count; i++) { // Clear pending interrupts NVIC->ICER[i]=0xFFFFFFFFUL; NVIC->ICPR[i]=0xFFFFFFFFUL; } void (*jump_to_bootloader_fptr)(void); jump_to_bootloader_fptr = (void (*)(void)) (*((uint32_t *) ((BOOTLOADER_ADDR + 4)))); __enable_irq(); __set_MSP(*(uint32_t *)BOOTLOADER_ADDR); jump_to_bootloader_fptr(); return HAL_ERROR; // Should never get there because of jump}
Hi, I am wondering if anyone has had any experience using the STM32N6 onboard H264 encoder? I am trying to write a business case for using this MCU, which claims it can broadcast H264 video at 720p & Audio at a stable 30fps over LAN without any noticeable drops in performance? The only solutions I have found so far have been dedicated SoC.
Hi all,I'm recording 16 kHz mono audio from the on-board digital MEMS mic (MP23DB01HP) of the STM32N6570-DK using the BSP's MDF path (MDF1, filter 0, PE2 MDF1_CCK0, PE8 MDF1_DATIN0, GPDMA1 channel 0, SPI mode, falling edge). The recording runs next to a camera/ISP pipeline, an NPU model and an H.264 encoder, so I want the audio path to cost as little CPU as possible and sound clean.Current setup (BSP defaults for 16 kHz)Kernel clock: IC8 from PLL4 = 50 MHz (HSI-based), PROCDIV = 2, CCKDIV = 12, so the PDM clock is about 2.08 MHz CIC: Sinc4, R = 32; reshape filter on, ÷4 (total decimation 128) Gain +2 (about +6 dB); HPF 0.000625 × fPCM (about 10 Hz) Async continuous acquisition, circular DMA into a 16 KB bufferWhat I triedI built a test firmware that records one clip per MDF configuration (5 s each, one config per boot) and compared them offline. Configs: Sinc4 vs Sinc5 R = 32 (gain steps −7, −8, −9), HPF at 10, 20, 40 and 152 Hz, a PLL4 retune to 81.92 MHz with IC8 ÷ 10 for an exact 2.
Hello ST Community,I am working with the STM32U535RET6 and need clarification on the interaction between the IWDG Window feature and Early Wake-up Interrupt (EWI).I tested the following configurations:1. Window enabled, EWI disabledThe Window feature works as expected:Early refresh → IWDG reset Late/no refresh → IWDG reset2. EWI enabled, Window disabledWhen only EWI is enabled, the EWI interrupt occurs when the counter reaches the configured EWIT value.In the ISR, the HAL code acknowledges the EWI by setting EWIC.According to RM0456, writing EWIC = 1 clears EWIF and also reloads the IWDG counter with RL[11:0].However, in my observation, the EWI ISR is called only once, and I do not observe the expected counter reload after the EWI acknowledgement.3. EWI and Window enabled togetherWhen both features are enabled, I observe different behavior.For example, with EWI configured for approximately 2 seconds, the EWI occurs repeatedly at approximately every 2 seconds. The IWDG counter appears t
This post is in response to the following post which has been closed so I am unable to reply... Update – root cause found: STM32CubeProgrammer flash loader / FLASH_SR.PEMPTYI have finally found the cause of this issue and a reproducible workaround.The problem is related to the PEMPTY bit (bit 17) in FLASH_SR.On a failed debug/programming attempt I measured:FLASH_SR = 0x00020000 (PEMPTY = 1)SYSCFG->MEMRMP = 0x1SCB->VTOR = 0x1FFFF000PC = 0x1FFFxxxxThe MCU had therefore booted into System Memory rather than the application.On the next, successful attempt:FLASH_SR = 0x00000000 (PEMPTY = 0)SYSCFG->MEMRMP = 0x0PC = 0x0800xxxxThe option bytes were identical in both cases:FLASH->OPTR = 0xFFFF98AAI could reproduce this indefinitely: one programming attempt failed, the next worked, then failed, then worked.As a test, on a failed attempt I manually executed:set *(int*)0x40022010 = *(int*)0x40022010This changed FLASH_SR from:0x00020000to:0x00000000After subsequently resetting the
Dear forum,I am trying to setup a simple application to sample an ADC channel with DMA and stream it via UDP to a Windows PC, so here’s what I did:I started from the sample project “Nx_UDP_Echo_Client”, provided by ST in FW pack; I configured the ADC peripheral to sample pin PA1 as in the sample project “ADC_SingleConversion_TriggerTimer_DMA”, and this is ok; I configured the GPDMA channel 0 in circular mode to copy ADC.DR into a buffer, following this and this; I put the DMA buffer in a dedicated memory region (AHBSRAM1), as suggested here; I configured the buffer memory region as NON CACHEABLE in MPU configuration, as suggested here; Finally I configured the RISAF in order to let the GPDMA have access to the buffer, as suggested here.But still, when I try to activate the transfer with the HAL command HAL_ADC_Start_DMA, I get a “User setting error” (USEF bit in GPDMA_C0SR register) and the GPDMA channel is deactivated. Can you please help me in the debug?The project, which is attached
Environment- Board: B-U585I-IOT02A (STM32U585AIIXQ)- STM32CubeIDE, FreeRTOS (CubeMX-generated), CMSIS-RTOS v2- Driver: ST vendored HTS221 component driver (`hts221.c` / `hts221_reg.c`), untouched, accessed through the public `stmdev_ctx_t` of the object layer- I2C2 @ standard mode, internal pull-ups, 1 Hz sampling in one-shot modeHi, application on the **B-U585I-IOT02A** discovery kit (STM32U585, FreeRTOS, STM32CubeIDE). The onboard HTS221 humidity/temperature sensor is driven by ST's vendored driver from BSP.Symptoms that i am experiencing: Right after reset (cold boot), the HTS221 reports **~20 °C, then over the following minutes of operation the reading rises steadily and settles at **~30 °C**, while the actual room temperature stays ~20 °C.The drift is smooth and monotonic (thermal-looking), not noisy or jumpy.I have already verified that BSP driver conversion formula is correct. Also HTS221 internal heater is disabled.My sensor configuration:HTS221_Set_One_Shot(&hts_obj);hts2
Hi forum,I’m tasked to implement firmware update ability for an STM32-based application. Basically, I’m using this tutorial and change it to work on a NUCLEO G431RB board. In the end, we’ll have a bootloader and two application slots in the STM’s flash.The situation now is this: Bootloader starts up, waits for a moment, checks for a condition (button pressed or not) and then transfers control to either application 0 or application 1. Both applications don’t do anything useful yet, they just differ in how they blink the one LED I’m able to manipulate easily.Startup works, transfer works but application 1 doesn’t blink at all. Reason is that its HAL_GetTick() value doesn’t change. In bootloader, it does. In application 0, it does also. And if I flash application 1 onto flash address 0x08000000 all alone without the other two, it works.And it also works if I change the marked line to initialize variable to zero.#define NumberOfFlashes 3static int _millisecondsUntilToggle = 5; // marked
Hi everyone, I have developed a custom pcb board and I want to use the usb and a uSD card. I am not really familiar with pcb designing. My guidance was some youtube videos in general, like the Phil’s Lab for the USB + SD MSC (The link, so there is some understanding on the code I have added to the usb app). The USB works. The SD only worked once somehow, while I was stepping the code in the debugging process. I could not do it again. I have tried every possible configuration. The only thing I get is the following from the terminal: [28067.786253] usb 3-4: new full-speed USB device number 86 using xhci_hcd[28067.913272] usb 3-4: New USB device found, idVendor=0483, idProduct=572a, bcdDevice= 2.00[28067.913281] usb 3-4: New USB device strings: Mfr=1, Product=2, SerialNumber=3[28067.913283] usb 3-4: Product: STM32 Mass Storage[28067.913286] usb 3-4: Manufacturer: STMicroelectronics[28067.913288] usb 3-4: SerialNumber: 395834673434[28067.916167] usb-storage 3-4:1.0: USB Mass Storage device
Board / softwareSTM32N6570-DK (MB1939), STM32N657X0H3Q STM32Cube FW_N6 V1.4.1, ThreadX + USBX from the package (not X-CUBE) STM32CubeIDE, load-and-run development flow (ELF downloaded into internal SRAM by the debugger; no FSBL, no XIP, no external loader) USB2_OTG_HS configured as Host_HS on CN17, internal HS PHY OTGPHY2 clock = RCC_USBPHY2CLKSOURCE_HSE_DIRECT, 24 MHz HSE crystal CPU 600 MHz, AHB 200 MHz USBX: UX_MAX_DEVICES 8, UX_APP_MEM_POOL_SIZE 98304, USBX_MEMORY_STACK_SIZE 65536, only the CDC-ACM class registeredWhat worksA USB 2.0 mass-storage device (HP, VID 0x03F0 / PID 0x2003) enumerates reliably and repeatedly:[usb] idVendor : 0x03F0[usb] idProduct : 0x2003[usb] bcdUSB : 0x0210[usb] bMaxPacketSize0 : 64[usb] speed : HIGH[usb] state : ADDRESSED[usb] -- interface 0 class 0x08 (mass storage) 0x06/0x50[usb] ep 0x81 BULK IN mps 512[usb] ep 0x02 BULK OUT mps 512UX_DEVICE_ENUMERATION_FAILURE here is e
Hi everyone,I'm using UART Receive-to-IDLE with circular linked-list GPDMA on an STM32H7RS and ran into a problem where reception stopped with HAL_DMA_ERROR_DTE.The DMA node and RX buffer are both in DMA-accessible, non-cacheable RAM and aligned to 32 bytes.The DMA handle and queue structure are in normal BSS. Everything is global/static and zero-initialized.I checked the queue/node connection and the source address in LinkRegisters[3], which correctly pointed to UART RDR. The node address reconstructed from CLBAR and CLLR was also correct when checked.However, these were the actual DMA register values in the working and failing cases: Working FailingCBR1 0x00000080 0x0000049BCSAR 0x40007824 0x00000005CDAR 0x24001960 0x200065A0After the DMA error, UART error handling stopped reception and disabled the IDLE interrupt, so I stopped getting HAL_UARTEx_RxEventCallback() calls.What fixed it was adding __DSB() inside HAL_DMAEx_List_Start_IT(), after the CLB
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,
This is the follow-up to my 2023 thread, which is now closed for replies:https://community.st.com/stm32cubeide-mcus-28/azurertos-netxduo-unable-to-download-16k-or-larger-image-using-web-http-client-secure-124990Short version: the stall is in the ST NetX Ethernet glue driver (`nx_stm32_eth_driver.c`), not in NetX Duo, and not a packet-pool sizing problem. The fix is about 40 lines and still applies to the current `STMicroelectronics/stm32-mw-netxduo` main branch, which has the same driver code. I have filed it with ST as a bug with the full write-up and patch: https://github.com/STMicroelectronics/stm32-mw-netxduo/issues/1 **Symptom (from the original thread)**HTTPS downloads of 16 KB or more via `nx_web_http_client` + NetX Secure stalled on every attempt on F417, F429 and H723. Plain HTTP downloaded multi-MB files fine with the same pool. After a stall the socket stayed ESTABLISHED and the pool showed fewer free packets than expected, which I wrongly reported as "free_packets corrupted
Background info:I am looking at ditching Microchip and moving to STM32 H5 or H7.My application requires networking and support for HTTP server, SNTP client, SNMP V2 & V3 agent and SMTP client with TLS etcI am looking at H5/H7 primarily because of the larger RAM to support a TFT display of 320x240 or possibly 480x320. I only need 16 bit color. Now the question:I am evaluating my choices for a TCP/IP stack. The “free” contenders appear to be LWIP and Azure (NetX) and I have seen some not free offerings such as CyloneTCP and Mongoose.I suspect that any of them can be made to work with enough effort but in the interest of not wasting company resources I thought it prudent to see who has had successes and frustrations with the offerings that I have been exploring.Yes. I am the guy who asks how deep the water is before I jump in….
Hello everyone, I have the following use case: I want to receive raw data via Ethernet, which works fine, but I have a problem: When I send 100 bytes, I only receive 14 bytes in my software on the MCU (STM32H7S3L8). I was able to fix this by settingAutomaticPadCRCStrip to DISABLE. Now I receive 104 bytes, which is also not the desired behavior. After a little research, I found out that the 4 bytes are CRC, so I continued searching. After some searching, I found the CRCStripTypePacket property and set it to ENABLE, but unfortunately this property has no effect. What do I need to do to get my 100 bytes but not the CRC? Do I need to set something else? Is this a bug? Please help me, I'm stuck.Thanksstm32h7rsxx-hal-driver 1.2.1Best regards,Paul B
My board does not have the default firmware anymore and I do not have a backup of it either. I have the source code and the HAL driver and have tried for hours to get the code to compile. I get many errors for various HAL header files and the source does not include a HAL config file. Is it possible to get the compiled default firmware as it is for various other Discovery boards?
Hello everyone,I am working on Ethernet communication using the STM32H750B-DK with STM32CubeIDE and LwIP. I am using the onboard LAN8742 Ethernet PHY and a direct Ethernet connection between the PC and the board. LwIP is configured with NO_SYS = 1, and I am continuously calling MX_LWIP_Process() in the main loop. When I check the Ethernet traffic in Wireshark, the PC continuously sends ARP requests asking for the STM32 MAC address, but the STM32 does not send an ARP reply. While debugging the gnetif structure, I see PHYLinkState = 0, speed = 0, and duplex = 0. I also checked the STM32H750B-DK documentation and found that the onboard Ethernet PHY is connected through MII. My CubeMX project was initially configured for RMII, so I changed the Ethernet configuration to MII. I am also checking the Ethernet DMA/LwIP memory configuration and moved the Ethernet descriptor and RX buffer sections to D2 SRAM using the linker script. However, I still cannot get a ping response from the board.Curre
I’m having an issue where I get no output when trying to do PWM with DMA using Timer 3, Channel 1 on an STM32F401RET6.I am using PB4 for my Timer 3, Channel 1 pin.Regular PWM output works perfectly on this channel and pin.But if I try and do DMA transfers, there is no PWM output (voltage stays at 0).I’ve confirmed that I can do PWM DMA on another timer, Timer 2 Channel 1; this works perfectly. But when I switch to Timer 3, Channel 1, there is no output.My timer setup:/* TIM2 init function */void MX_TIM2_Init(void){ /* USER CODE BEGIN TIM2_Init 0 */ /* USER CODE END TIM2_Init 0 */ TIM_ClockConfigTypeDef sClockSourceConfig = {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 = 0; htim2.Init.CounterMode = TIM_COUNTERMODE_UP; htim2.Init.Period = 90-1; htim2.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1; htim2.Init.AutoReloadPreload = TI
I’m trying to set up flashing firmware and initializing the RTC clock on a blank or chip erased STM32H747Xi using the STM32Cube CLT package that contains the STM32_Programmer_CLI.exe command line tool. I can’t seem to write to the critical registers for RTC. Is there a procedure to set the RTC? If so, can you list the steps needed to do so?Thanks,Johnas
Hi there, I tried to build NetXDuo stack with IPV6 and SLAAC version on H563ZI Nucleo boardHowever compilation of system libraries failed due to not linked symbols, it happened in all 3 ways of generations form CubeMX (copy all files, copy only required files, reference libraries).I.e. linker complained about lack of symbol _nx_nd_cache_add_entry and I noted filed is nx_nd_cache_add_entry.c is not compiled nor copied to project sources.
Hello,We are currently working on STM32C542CCT6 from the STM32C5 series and developing custom Flash and Data Flash drivers.Issue 1 – Hard Fault when accessing FLASH_SIZEWhile executing code generated by STM32Cube, the following check causes the system to enter the Hard Fault handler:if (FLASH_ADDR < (FLASH_BASE + FLASH_SIZE)) /* Main User Flash */The FLASH_SIZE macro reads the value from the device information area. However, when the code attempts to access FLASH_SIZE, the system immediately enters the Hard Fault handler.If we manually hardcode the flash size value, the code works correctly.Our questions are:Is there any specific register configuration or initialization required before accessing FLASH_SIZE on this device?Is this region restricted due to Trust Zone or privileged access on STM32C5 devices?Issue 2 – NMI when reading Data FlashWe have enabled Data Flash by setting: EDATA_EN = 1We are trying to read from the Data Flash base address:0x09000000using a pointer-bas
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.