Ask questions and find answers on STM32Cube packages, including HAL, LL and middleware, and expansion software.
Most recent activity
Hi everyone,I’m working with an STM32H7S3 microcontroller and an external Octo-SPI NOR flash IS25WX064 from ISSI (datasheet: https://www.issi.com/WW/pdf/25LX-WX032-064.pdf)My goal is to get this memory working with ExtMemLoader (including XIP support). I’ve gone through all the available tutorials and many of the forum threads related to ISSI 25LX/WX devices, but after many hours I still haven’t been able to generate even a single .stldr that doesn’t crash in the STM32CubeProgrammer.A few important points:This does not seem to be a hardware issue. I can successfully communicate with the flash and read the manufacturer configuration/registers via the XSPI peripheral.I have been following the ST tutorials for this MCU family (the ones that use the Macronix flash on the official demo board).In my case, when I try to adapt the code for the IS25WX064, the driver fails in the last check of step 9 of the EXTMEM_NOR_SFDP driver (the final verification step):After a lot of iterations,
Hello ST Community, I am working on an STM32N6-based board and trying to expose an onboard SD card (SDMMC2) as a USB Mass Storage (MSC) device using FileX and ThreadX. The intended behavior is:When a USB Type-C cable is connected to a Windows PC, the SD card should appear as a USB removable drive with full read/write access. Hardware / Software Setup MCU: STM32N6 SD interface: SDMMC2 (4-bit, polling mode) USB: USB OTG HS (Device mode, MSC class) RTOS: Azure RTOS ThreadX File system: FileX Toolchain: STM32CubeIDE OS on host: Windows 10/11#if (FX_STM32_SD_DMA_API == 1) /* the SD DMA requires a 4-byte aligned buffers */unaligned_buffer = (UINT)(media_ptr->fx_media_driver_buffer) & 0x3;#endif unaligned_buffer always evaluates to 0 because the buffer is aligned, but this does not resolve the issue. Specific Debug Observation (FX_DRIVER_BOOT_READ)During debugging, I observed that FileX always enters FX_DRIVER_BOOT_READ, and the following code path is always executed: c
In function LL_RTC_ALMB_SetDay of file stm32u0xx_ll_rtc.h line 2198 Original:__STATIC_INLINE void LL_RTC_ALMB_SetDay(RTC_TypeDef *RTCx, uint32_t Day){MODIFY_REG(RTC->ALRMBR, (RTC_ALRMBR_DT | RTC_ALRMBR_DU),(((Day & 0xF0U) << (RTC_ALRMBR_DT_Pos - 4U)) | ((Day & 0x0FU) << RTC_ALRMBR_DU_Pos)));} Missing x in RTC->ALRMBR __STATIC_INLINE void LL_RTC_ALMB_SetDay(RTC_TypeDef *RTCx, uint32_t Day){MODIFY_REG(RTCx->ALRMBR, (RTC_ALRMBR_DT | RTC_ALRMBR_DU),(((Day & 0xF0U) << (RTC_ALRMBR_DT_Pos - 4U)) | ((Day & 0x0FU) << RTC_ALRMBR_DU_Pos)));} Personal opinion: I would recommend compiling code with the -Wall, -Wextra, and -pedantic compiler flags.From my point of view, confidence in the quality of code that contains such easily detectable errors is greatly limited. For this reason, I prefer not to use HAL drivers.
Hi,I'm currently working on a project using an SMT32G474RET6. We have the X-Cube-STL with us and trying to integrate it into our project. We have followed all the steps as mentioned in the document and we are able to run the test for our software, but it kept failing for CPU in Multiple test and for Flash in Single test. We also tested the example codes on the Nucleo -G474RE, it works there but not with our project.Any idea what could be wrong? what thing should we check to resolve this issue. I have tested the Artificial failing example within our project, and it seem working fine, but the single test and multiple tests are not working.
Hi! I am trying to do a simple communication between nucleo-f411re and nucleo-h753zi board using uart communication. but i am unable to set it up. Is it possible? If yes, what is the easy way to do that. How the connections and wiring look like?
Hi,In the GPIO interrupt configuration, the port information is ignored and only the pin number is used for identification. As a result, pins with the same pin number on different ports cannot be enabled as interrupt sources at the same time. stm32_gpio_irq_line_t stm32_gpio_intc_get_pin_irq_line(uint32_t port, gpio_pin_t pin){ ARG_UNUSED(port); return linenum_to_ll_exti_line(pin);} int stm32_gpio_intc_set_irq_callback(stm32_gpio_irq_line_t line, stm32_gpio_irq_cb_t cb, void *user){ const struct device *const dev = DEVICE_DT_GET(EXTI_NODE); struct stm32_exti_data *data = dev->data; uint32_t line_num = ll_exti_line_to_linenum(line); if ((data->cb[line_num].cb == cb) && (data->cb[line_num].data == user)) { return 0; } /* if callback already exists/maybe-running return busy */ if (data->cb[line_num].cb != NULL) { 
Hi, I want to start a new project with a STM32H503 (might be), and I read many threat talking about USBX FILEX now on this kind of microcontroller.As it is a bootloader, I do not want to use any RTOS.I use to do bootloader with USB host interface to update the firmware with STM32H7 or STM32F7, but with old stack. Can you please confirm I will be able to develop a bootloader (usb host) to get a binary file on a USB stick storage using USBX and FILEX, WITHOUT any RTOS on a STM32H5 ? Every exemple I found is for device standalone, not host USB.Is there any up to date example with USB host MSC flash stick using USBX and FILEX to start ? Sébastien
Due to more performance requirement, i wanted to change the ThreadX timebase to 1ms. To what i have researched till now i need to make the following #define TX_TIMER_TICKS_PER_SECOND to 1000 which is usually set at 100 which is 10ms. Any idea what else need to be done to make the ThreadX timebase to 1ms other than this or is this enough already?Thanks a lot for guidance.
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 and a linker script content. Please read this post: How to insert source code. Hi,I was trying to use multiple ADCs in stm32f103c8t6. I have configured seven channels in ADC1 using DMA and ADC2 as single channel without DMA. Both trigger interrupts where ADC2 has the highest priority. The sampling time for the seven channels of ADC1 and single channel of ADC2 is 41.5 cycles and 239.5 cycles respectively. The ADC clock frequency is 10.667MHz. I calculate that ADC1 interrupt is triggered every 35.4us and ADC2 interrupt is triggered every 23.6us. System clock is 64Mhz. I have a third Interrupt which is a timer interrupt which is triggered every 560us. So the problem now is that when the sampling time of ADC2 is reduced 71.5 cycles (approx 8 us) or below, only the ADC2 is getting triggered. The code is not triggering the ADC1 interrup
I am working on an STM32 + Azure RTOS project where I need to access the same SD card in two different modes: When the microcontroller accesses the SD card directly, I use FileX with an SDIO/SPI driver. When the SD card is connected to a PC via USB, I use USB MSC (Mass Storage Class) so that the PC can read/write the card. Individually, both functions work perfectly: FileX can read/write SD card when MCU is accessing itUSB MSC works when PC is connected However, when I try to support both modes simultaneously, the SD card fails to work correctly.There is no reference example from ST or Microsoft showing how to share the SD card between FileX and USB MSC at runtime. My main question: How can I properly share the same SD card between FileX (MCU access) and USB MSC (PC access) in Azure RTOS, ensuring that both do not access the file system at the same time? Is there an official method, mutex mechanism, media lock, or recommended design pattern for this scenario?
Hi,I'm using STM32H7 dual core, where the data has to be shared between the cores, so im having totally 21 variables totally 76 bytes, thought of do it like a structure, so where to place the structure exactly for this data sharing. so, this structure should be placed in any linker file of one of the cores or where?if so, thus we have to keep the structure in both the core or whatwhich method is a fastest wat to share the data, like a ring buffer, HSEM.if we use HSEM, we can use that structure or access outside, before calling the HSEM TAKE, or structure values should be assigned only inside after the HSEM TAKEOVER. regards,srinath
Hi!EDIT: WARNING! This is no real fix... The bug remains...With STM32Cube_FW_F2_V1.9.0 and CDC's /dev/ttyACM0 I had funny glitches on VoidLinux, when i tried full duplex communication (host<>device):some packets never arrived at the USB hostsome short packets had their first 4 byte twiceDeepSeek suggested to choose different endpoints for data in and out... like this:#define CDC_IN_EP 0x81U /* EP1 for data IN */ #define CDC_OUT_EP 0x02U /* EP2 for data OUT */ #define CDC_CMD_EP 0x83U /* EP3 for CDC commands */it seems like those glitches disappeared now... Or i did not dare to test it hard enough...Why is CDC_OUT_EP 0x01U by default, although DeepSeek thinks, that the STM32F207 hardware cannot cope with that, because IN&OUT stream share somehow the same hardware elements, if they are configured for the same endpoint?It was easy to fix, after i found Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc/usbd_cdc.h , but i wonder now, if i really found the bug...Seems like
Hi everyone,I tried implementing tickless idle on my STM32H7 CM7 core following a tutorial I found: https://www.youtube.com/watch?v=hVlpf1Rm4QoI suspended the tick (TIM6) and set up LPTIM as the wakeup source.However, I noticed that my core wakes up every 41 ticks, even though my ONLY task is delayed by 2000 ticks. It seems like the core is being woken up prematurely, and ulExpectedIdleTime is only 41 instead of 2000.Does anyone know why tickless idle is not sleeping for the full expected duration, or what could be causing these frequent wakeups despite SysTick being disabled?Pre Sleep fuction:__weak void PreSleepProcessing(uint32_t ulExpectedIdleTime) { /* place for user code */ HAL_GPIO_WritePin(LED_1_GPIO_Port, LED_1_Pin, GPIO_PIN_SET); //printf("[CM7][PreSleepProcessing]entered PreSleepProcessing!\r\n"); HAL_SuspendTick(); //suspend SysTick Timer HAL_LPTIM_TimeOut_Start_IT(&hlptim1, 0xFFFF, ulExpectedIdleTime); // enable interrupt from low power timer }And Post funct
Hello ST Community,I’m currently testing an SGTL5000 audio codec with the STM32WB55 Nucleo board, and I’ve run into an issue where audio only works when analog test mode is enabled. I’m using the Hathor SGTL5000 audio breakout board from PCBWay (project link).System ConfigurationSTM32WB55 Nucleo-BoardSTM32CubeIDE Version: 1.18.1STM32CubeMX Version: 6.14.1SGTL5000 Board: Hathor Breakout (PCBWay project)Connections to SGTL5000:VDDIO, VDDA, VDDD = 1.8V (external LDO)I²C only, pulled up with 4.7 kΩMCLK = 12 MHz from STM32WB55 via SAINo SCLK, LRCLK, or I²S DIN/DOUT connectedMic connected to MIC_L; HP_L/R used for headphone outputGoalTo establish an internal audio path on the SGTL5000:MIC → ADC → DAP (optional) → DAC → Headphoneswithout using I²S (just internal routing).ProblemSGTL5000 only outputs audio when analog test mode is enabled CHIP_ANA_TEST1.TESTMODE = 1; CHIP_ANA_TEST1.TM_SELECT_MIC = 1; CHIP_ANA_TEST1.TM_ADCIN_TOHP = 1; CHIP_ANA_TEST1.HP_HOLD_GND = 0; CHIP_ANA_TEST1.HP_HOLD_G
Hello,I am using the STM32H747IIT6 microcontroller along with the LAN8742A Ethernet PHY, configured in RMII mode. However, I am facing issues where the Ethernet interface is not working at all in my circuit. It appears there may be multiple bugs or configuration issues affecting the RMII driver.I suspect there are underlying bugs in the RMII driver implementation. I would appreciate any advice or suggestions on how to resolve these issues and get the Ethernet interface up and running as soon as possible.
Good morning, if possible, I would like more details about the following PDM2PCM(HP version) library used for converting PDM data to PCM. typedef struct{ uint16_t bit_order// MSB / LSB uint16_t endianness;// big endian / little endian uint32_t high_pass_tap;// hig_pass_tap = alpha*(231-1) #alpha[0:1] uint16_t in_ptr_channels;// number of input PDM channels uint16_t out_ptr_channels;// number of output PCM channels uint32_t pInternalMemory[PDM2PCM_INTERNAL_MEMORY_SIZE];// [default 23] I don't know, I need help here }PDM_Filter_Handler_t; typedef struct{ uint16_t decimation_factor;// decimation factor [16/24/32/48/64/80/96/128] HI_PERF[64/96] do the latter have faster execution times? uint16_t output_samples_number;// I don't know, I need help here... could it be the number of PCM samples or the number of PCM bytes in output? int16_t mic_gain;// gain [-12 dB: +51 dB] int16_t bit_depth;// PCM
Hello, I am using an STM32H723ZG6U and want to output a limited number of phase-shifted pulses on two pins. To do so I currently use TIM1 and TIM8 with PWM generation.TIM1 acts as the master timer having channel 1 in 'PWM Generation CH1' as the first output and channel 2 in 'Output Compare No Output' for the phase-shift. TRGO is configured as 'Output Compare (OC2REF)'. 'One Pulse Mode' is checked for this timer.TIM8 is the slave timer in 'Trigger Mode' with Trigger Source 'ITR0' which connects to TIM1. Channel 1 is configured as 'PWM Generation CH1' for the system's second output. This timer is also in 'One Pulse Mode'.Apart from that both Counter Settings and PWM Generation channels are configured identically to fit my needs. When starting both PWMs for the first time after controller startup everything works as expected (i.e. PWM on TIM1 sends a number of pulses and then stays quiet, same with a phase-shift to TIM1 with PWM on TIM8). Pictures of the configurations are attached.M
Hello everyone. How are you?I created a test program based on https://community.st.com/t5/stm32-mcus/how-to-calibrate-the-stm32-s-real-time-clock-rtc/ta-p/744958 I calibrated and compared the signal (512Hz @ PB2) with an oscilloscope, resulting in an error of less than 20 ppm. The RTC worked for 24 hours, and the seconds were the same as my base source (Windows). To me, this indicates that the hardware, crystal, and capacitors are OK.After that, when I entered my application code, the RTC always showed a delay (error > 5000 ppm). My code never use HAL_RTC_SetTime or HAL_RTC_SetDate. Reading from the RTC->CALR register is the same as the calibration value.Regardless of whether the calibration is at -488 or +488 (maximum value), the RTC always lags. I have the feeling that the processor gets busy doing something, and ends up losing some RTC pulse.Unfortunately, I can't post the complete code here, but I can provide some other information:- 1 ISR timer every 1 ms- X-Cube F
Hello everyone, I have a NUCLEO-H723ZG board and I would like to establish Ethernet communication with it. The board already includes a LAN8742 chip as the physical layer. However, in my system there is an external LAN8720 magnetic Ethernet module. At the moment, I can successfully ping the board using the on-board LAN8742 with the LwIP_UDP_Echo_Server application example. What I want to do is disable the on-board LAN8742 and instead use the external LAN8720 for Ethernet communication. I could not find any example where an external PHY is used together with an STM32 board that already has an on-board PHY. First of all, is such a setup actually possible? If it is, can I connect the external LAN8720 to the ETH header pins in RMII mode and make it work by adding the LAN8720 PHY driver? I have seen some discussions stating that this cannot be done without physically removing the LAN8742 chip, possibly due to pin conflicts. Could you please clarify this for me? Is it possible to achieve Eth
Hi, I’m trying to get SDMMC + FileX + ThreadX working on an STM32H5 (NUCLEO-H563ZI) and I can’t find any complete example. SDMMC works on its own, but once I enable FileX, fx_media_open fails and no files get created. I’ve tried the H573 FileX examples, aligning buffers, using 1-bit mode, and adapting the fx_stm32_sd_driver_template, but nothing has worked so far. Does anyone have a minimal working example project that shows FileX mounting the SD card through SDMMC and writing a simple text file? Even a small CubeIDE project or code snippet would be extremely helpful.
i'm trying to receive some data by uart and send by spi, both dma normal mode, i've done comunication separately but when i join them get stuck on spi busy, i tried a lot rtos(queues and semaphores), i changed almost all the code, but i just can't do this alone, i need some help. I am starting now at this level of embedding sistem and i'll be greatfull if anyone cold help me. this is my code for: RTOS: /* USER CODE BEGIN Header */ /** ****************************************************************************** * File Name : freertos.c * Description : Code for freertos applications ****************************************************************************** * @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. * **********************
Split from STM32G431CBU: section `.bss' will not fit in region `RAM' as that issue is solved, and this is a new question.One more question. If you can help.BSP_TS_Init e BSP_TS_GetState is not recognized in IDE versions 1.19 and 1.20.Therefore, TOUCH doesn't work.BSP_TS_Init(ILI9488_TFTHEIGHT, ILI9488_TFTWIDTH);BSP_TS_GetState(& osc->touchScreen);What did I forget to port?
Im looking to use the STM32G0B1KBU processor including the USB-C interface.I only want to use it as a UPF with VCP and update the firmware, no advanced PD or role switching. The issue is that UCPD1_CC2 is not routed to a pin on the processor.Is it possible to substitute the UCPD1_CC2 function with the "Dead battery pulldowns" UCPD1_DBCC2?Will it work with the bootloader after the "dead battery" has been programmed/configured? I could place the CC1 & CC2 pulldowns discreetly on the board but i am space constrained.I could also switch to the N variant of the processor that seems to have the UCPD1_CC2 pin broken out. I Already have several of the GP variants laying around from a previous project and want to reuse them if possible.Thanks for any input!
* board - STM32N6570-DK* using STM Cube 1.19.0* Example - USBPD_SNK Goal - to enable Display port Problem - is i'm getting stuck with the current example. It gets stuck at SVDM_deiscovery_identity part. Which in that packet i should be able to start to tell the host that i have display port capability, but i what is currently set it that the message is unsupported. How would i go about enabling this. Thoughts - In usbpd_vdm_user.c it seems like it has all the stuff that i need to start sending back these kind of messages but they don't seem to be called anywhere. There's a function called* USBPD_VDM_DiscoverSVIDs()But it doesn't seem to be called. Capture from a STM32 PD G0 - with STM32CubeMonitor app
Hello,I'm trying to detect a USB stick insertion event to write a text file in the stick. I'm working on a NUCLEO-H563ZI with a jumper connected to JP2 USB USER line and a USB TYPE-C TYPE-A connector attacched in CN13. I started the code from an ST Example but without the USB-PD because I need only two lines (USB_FS_P and USB_FS_N).I saw others example with USB_OTG but my .ioc doesn't have this option. The problem is that I can't catch the USB stick insertion event. I put a breakpoint on "_ux_host_class_storage_activate" and on the "ux_host_event_callback" functions but I never reach these points.Where the event is cathced in the ST functions? What I'm missing / I'm doing wrong?I have attached the project. Thanks for the support
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.