Ask questions and find answers on STM32Cube packages, including HAL, LL and middleware, and expansion software.
Most recent activity
Hi here. I am trying to get STM32H743iit as usb_audio_device with CubeMX latest version.No initialization of stm32 sound device in windows 10 device manager.Other projects from this link https://www.waveshare.com/wiki/OpenH743I-C especially USB_FS, USB_HS working good, but in windows devise manager no descriptors info in usb device properties windows for HID project. Could somebody help where i am got problem with usb_audio_device? I change VID, heap size but it is do not help. Please help.Regards
I'm trying to interface a TI ADC with an STM32U575ZI or STMU545RE (same issue on both Nucleo boards).The ADC has a "data ready" pin that needs to trigger a fixed-size transfer of 32bytes over SPI. Given the overall sampling rate, only a few microseconds are available for overhead. Seems like a natural fit for the autonomous mode + DMA features on the STM32U micros, but I can't seem to figure out how this is supposed to go together.I can get one transfer going no problem, sometimes two, but something always errors out. Currently getting a MODF flag, which makes no sense based on the documentation as the NSS system is set to "software" and always at 1.Is there a document describing how the DMA and SPI modules interact under autonomous mode? I'm clearly missing something important here. Handshaking, what causes the TSIZE to reload the CTSIZE register, recommended DMA configs + trigger setups, anything?Working on putting together an example for people to disse
Found a bug with RX_POOL buffers been permanently used. There are total of 12 buffers defined by default. Adding more buffers will prolong the operation, but eventually all of them will be permanently locked. Using the latest available from ST LWIP stack. Our configuration: enabled ARP, ICMP; TCP server with 5 available connections. As soon as a whole buffers are locked, the ethernet driver won't process any incoming packets. Soon after start the number of used buffers goes from 0 to 4 with no active TCP or UDP communication, just a normal network activity. Once TCP communication is started, and if there is no traffic congestion like opening several connections at the same time or sending too many packets, LWIP may function without a problem for days, which makes finding the issue with losing the ethernet communication difficult. The number of available buffers may go down one-by-one. Opening several connections simultaneously and starting the traffic on all of them locks the buffers i
Hi everyone,I’m building a coffee machine project using STM32C071 (C0) mainly because it has USB. I need USB Host MSC to:Mount a USB flash drive (FAT)Read/write files (params/logs)Firmware update from USB driveThe “official” ST stack seems to be ThreadX + USBX + FileX. Since there’s no USB Host MSC example for C0, I used an STM32L4R5 example (much larger RAM) as reference and adapted it.Issue: To pass ThreadX/USBX init, I kept increasing stacks/pools until I’m using ~20 kB of RAM. Then, when I plug the flash drive, enumeration fails with out-of-memory errors (e.g., UX_DEVICE_ENUMERATION_FAILURE / allocation failure).Questions:Is ~20 kB RAM just to init (and still fail at enumeration) expected for USBX Host MSC + FileX, or does it strongly suggest misconfiguration?Is there any official guideline/table (ST/Azure RTOS) for typical/minimum RAM for USBX Host + MSC + FileX (FAT)?Is there a practical RAM “floor” to enumerate + mount FAT + read/write files (single device, no HUB)? Like “below
I am working with a custom board that uses the STM32H7S38T chip. I am trying to use the SPI flash example from Zephyr to write to and read from the BY25Q16ES NOR flash. I am using the XSPI interface in normal SPI mode. I can read out the JEDEC ID (0x9F) as 0x684015, which matches the value given in the datasheet. When reading the SFDP (0x5A), the MISO is pulled high after the dummy cycles. Have I overlooked something? The flash datasheet clearly states that the SFDP is available. Zephyr Debug output: ------------------------------------- [00:00:00.000,000] <dbg> flash_stm32h7: stm32h7_flash_init: Flash initialized. BS: 32[00:00:00.000,000] <dbg> flash_stm32h7: stm32h7_flash_init: Block 0: bs: 8192 count: 8[00:00:00.000,000] <dbg> flash_stm32_xspi: flash_stm32_xspi_init: XSPI Init'd[00:00:00.100,000] <dbg> flash_stm32_xspi: flash_stm32_xspi_init: Reset Mem (SPI/STR)[00:00:00.100,000] <dbg> flash_stm32_xspi: HAL_XSPI_StatusMatchCallback: Status Matc
Hi all,I’m running into an issue with LPTIM1 when using LSE as the clock source. The exact same configuration works perfectly when I use LSI or PCLK, but with LSE the code gets stuck waiting for the ARROK flag after writing ARR.The code blocks forever at:while (!LL_LPTIM_IsActiveFlag_ARROK(LPTIM1)) {} So it looks like the ARR register update is never acknowledged when LSE is the clock.Important notesLSE is definitely running — it’s already used elsewhere in the system without issues.We are looking for low power applicationwe using STM32U073CBT6Clock configurationLL_RCC_SetLPTIMClockSource(LL_RCC_LPTIM1_CLKSOURCE_LSE); LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_LPTIM1); LL_IOP_GRP1_EnableClock(LL_IOP_GRP1_PERIPH_GPIOC); NVIC_SetPriority(TIM6_DAC_LPTIM1_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(), 3, 0)); NVIC_EnableIRQ(TIM6_DAC_LPTIM1_IRQn);LPTIM configuration/* Make sure timer is disabled before config */ LL_LPTIM_Disable(LPTIM1); /* Select clock & prescaler FIRST *
I referred to this article: “Bootloader jump to Application HardFault - STM32H563.”I am also using the STM32H563, and used the following function to jump to the application, but the jump does not succeed. My test program is very simple. After creating an STM32H563 project, I only configured the UART to print messages so I can identify which program is currently running./* Bootloader */ typedef void (*pFunction)(void); void relocate_exe(uint32_t app_addr) { uint32_t appStack; uint32_t appResetHandler; pFunction appEntry; appStack = *(volatile uint32_t *)app_addr; appResetHandler = *(volatile uint32_t *)(app_addr + 4); appEntry = (pFunction) appResetHandler; __disable_irq(); SysTick->CTRL = 0; SysTick->LOAD = 0; SysTick->VAL = 0; SCB->VTOR = (uint32_t) app_addr; __set_MSP(appStack); //__enable_irq(); appEntry(); } int main(void) { HAL_Init(); SystemClock_Config(); MX_GPIO_Init(); MX_USART3_UART_Init(); char msg[128]; sprintf(msg, "Bootloader!!!(%x)\
Hello everyone, I am facing a confusing behavior with USB SOF events on two identical STM32 boards and I would appreciate any insight. Hardware 2 × NUCLEO-H743ZI2 Same MCU revision (checked device ID, revision ID – identical) Same USB connection to the same PC (USB OTG FS, device mode) Software Exactly the same firmware binary programmed on both boards STM32 HAL + CubeMX generated project USB CDC device (USB OTG FS) No conditional compilation, no board-specific code What I want to measure I wanted to check: Whether USB SOF events are really occurring every 1 ms Whether SOF can be considered a reliable timing source So I implemented a very simple counter in the SOF callback: #if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U) static void PCD_SOFCallback(PCD_HandleTypeDef *hpcd) #else void HAL_PCD_SOFCallback(PCD_HandleTypeDef *hpcd) #endif { sof_eventc++; USBD_LL_SOF((USBD_HandleTypeDef*)hpcd->pData); } Additionally: TIM2 is configured as a 1 Hz timer In t
Hi team,I am working on the STM32U585I-IOT02A board and trying to implement USB dual-role functionality (Host + Device).My goal is:USB Host: MSC class (to read firmware from a USB flash drive)USB Device: CDC class (for communication with a PC)I have enabled both the USB Host stack and USB Device stack in CubeMX, but I am unable to get the dual-role setup working reliably.My main objective is to upgrade firmware using a USB flash drive (MSC Host) while still supporting CDC Device communication.I would like to know:Does STM32U5 support USB dual-role operation (Host + Device) simultaneously or via role switching?Is there any example project or reference implementation for USB dual-role on STM32U5?Are there recommended approaches for implementing firmware upgrade via USB MSC Host on this board?Any guidance or example projects would be very helpful.Thank you.
I have an STM32H7A3ZIT running at 280MHz with 4 SPI buses attempting to “simultaneously” communicate with external ADCs. All 4 SPI are set up as full-duplex masters, 16-bit data size, 8.75 MHz clock speed, and software chip select.I’m using the HAL function HAL_SPI_TransmitReceive_IT to sequentially initiate the data transfer for each SPI bus. I expected each transfer to start quickly one after another, but instead I’m finding large time gaps. The TransmitReceive_IT composite image below shows the chip select line (yellow) and the SPI clock signals (cyan) for each sequential SPI bus. You can see the first 2 buses start clocking quickly, but then there is a time gap before the third and fourth buses start clocking. The code functionally works as the received data is correct, but the end of the transfer for the fourth SPI bus is too close to the next CS transaction, not leaving a lot of time for data processing.TransmitReceive_ITOddly enough, if I change the function to just receivi
Hi,I want to fly the STM32F429I-DISC with the 8 MB SDRAM. I use CubeIDE and selected the right board. All units are set to default. I commented out everything that had to do with os.With help of ChatGPT I hacked together an initialization of the SDRAM and set up a SDRAM Test. That seems to work partly but with weird effects. In the following code: start/end 0x00/0xff or 0x100/0x1ff works fine, but start/end 0x00/0x101 reads out 0x100 at address 0x0. Maybe it is an timing issue with precharged lines.THXCheersDetlef #define SDRAM_BASE_ADDR ((uint32_t)0xD0000000) void SDRAM_Test(void) { volatile uint16_t *p = (volatile uint16_t *)SDRAM_BASE_ADDR; uint32_t i ; uint32_t start = 0x100 ; uint32_t end = 0x302 ; for (i=start; i<end; i++) p[i] = i; sprintf(buf,"start \r\n",i); HAL_UART_Transmit(&huart1, (uint8_t *) buf, strlen(buf), HAL_MAX_DELAY); while(1){ for (i=start; i<end;i++) if (p[i] != i){ sprintf(buf,"no 0x%x 0x%x\r\n",i,p[i]); HAL_UART_Transmit(&
..
Hello everyone,I am currently working on a project to develop drivers for STM32F4 microcontrollers, based on Reference Manual RM0090 (without HAL, only CMSIS and register access).The goal of the project is to design reusable low-level drivers for the following peripherals:USART / UARTSPII2CI am now in the code implementation phase.I would like the community's help with the following:Examples of source code or references (preferably bare-metal / register level) for:SPI : transmission et réceptionI2C : master transmit / master receiveUART : transmission et réceptionRecommendations on API structure and function naming, for example:SPI_Init(), SPI_Transmit(), SPI_Receive()I2C_MasterTransmit(), I2C_MasterReceive()USART_Transmit(), USART_Receive()Any help, code snippets, links to reference implementations, or feedback would be greatly appreciated.Thank you in advance for your help.Best regards, *This post has been translated from French to comply with the ST Community guidelines.
Hi! I am working with a stm32h743zit6 + ov5640 combo. I am using STM32CUBEMX + Makefile on Ubuntu.Currently I am at the state of:- Camera setup is successful- Code gets into HSYNC event callback- Code gets into VSYNC event callback- Code doesn't get into Frame event callback Currently I am unable to capture any images. I would really appreciate your help! Thank you in advance!
helloDescription:I'm currently working with the STM32U585 and encountered an issue related to USART3Most of the time the code works fine, but it occasionally gets trapped in HAL_UART_IRQHandlerI am using the DMA Receiver Timeout (RTO) and DMA TX, may code is:void uart_tx_complete_cb(UART_HandleTypeDef *huart) { if (...) HAL_UART_Transmit_DMA(huart, buf, len); } void uart_rx_error_cb(UART_HandleTypeDef *huart) { HAL_UART_AbortReceive(huart); if (huart->ErrorCode & HAL_UART_ERROR_RTO) { ... } HAL_UART_Receive_DMA(huart, rx_buf, rx_buf_len); } HAL_UART_RegisterCallback(&huart3, HAL_UART_ERROR_CB_ID, uart_rx_error_cb); HAL_UART_ReceiverTimeout_Config(&huart3, 100); HAL_UART_EnableReceiverTimeout(&huart3); HAL_UART_Receive_DMA(&TD_UART_HANDLE, rx_buf, rx_buf_len); HAL_UART_RegisterCallback(&huart3, HAL_UART_TX_COMPLETE_CB_ID, uart_tx_complete_cb); When the issue occurs, I found that the TC (Transmission Complete) flag is not being cleared:an
Hello!I am writing a program for STM32F769I-DISCO board that uses FreeRTOS and LwIP to communicate with the server and send data to it. It generally works, but unplugging and plugging Ethernet cable (especially doing it several times within a few seconds) usually causes Ethernet DMA errors which make program stop calling HAL_ETH_IRQHandler and thus board can't even try to reconnect to server. I don't know how I should handle those errors and where to look for information that could offer a solution to my problem.Any kind of help, whether a direct response or a link to helpful resources, is appreciated. Ethernet DMASR registerheth error codeMPU and Ethernet descriptors EDIT 1: Added ethernetif.c and lwip.c files to attachments and screenshot of MPU configuration.
Hello,I have filed an issue but thought I would post this here for reference, this bug took me quite a while to hunt down and hope to save others time possibly:I have found a memory-safety defect in EEPROM_Emul on STM32U5 128-bit flash-line config.Config:- FLASH_LINES_128B enabled- EE_ACCESS_32BITS enabledIssue:- EE_ReadVariable32bits() passes a single EE_DATA_TYPE buffer:Core/EEPROM_Emul/Core/eeprom_emul.c:758, :762- In FLASH_LINES_128B mode, ReadVariable() writes two words:Core/EEPROM_Emul/Core/eeprom_emul.c:1184, :1185- This writes beyond the caller’s single-word buffer and can corrupt stack/register state (we observed HardFault with corrupted stacked PC).Why “wrong API usage” is not a valid dismissal:1) The API is publicly exposed in this build mode (Core/EEPROM_Emul/Core/eeprom_emul.h:126 with FLASH_LINES_128B APIs also present at :130).2) An exported API must not corrupt memory under any call pattern; unsupported combinations must fail explicitly.3) This component already uses st
Hi,I am using the application core of the STM32WB55VGY6 (not the radio core). I created a CubeMX project and added a simple HAL_GPIO_TogglePin() call. Literally just 2 lines of code in the entire project.When I use a for loop as a delay, the code works as expected. However, when I use HAL_Delay(), it does not.For some reason the SysTick_Handler() is never called... I’ve attached the full project, including the .ioc file. The application code itself is minimal (only two lines).From the configuration:The timebase source is set to SysTickInterrupts are enabledThe SysTick_Handler() is generated, but it is never triggeredHas anyone encountered this on the STM32WB application core, or have any suggestions on what might be missing or misconfigured?Thanks.
Board: NUCLEO-N657X0-Q, revision CI'm trying to communicate with an I2C sensor (VL53L7CX) using the I3C1 peripheral. I have written small routines to try this out based on this tutorial (chapter 9.10.). The problem is: no signal appears on the data pins (measured by an oscilloscope). Not even the slave address. They seem completely dormant.I have tried the "I3C Direct Command DMA" example project on the board. I don't have I3C devices, but measurement yielded digital signal waveforms, as expected. This confirms that the peripheral is in fact operational.What have I missed in my code or hardware setup? Any help is appreciated! Thank you!(I attached the mixed bus code and the .ioc file)
Hi,I would appreciate any guidance or best practices for minimizing code size by eliminating unused functions when using the STM32 extension for VS Code with CubeMX generated code (bare metal) as some code I'm writing has become very large.What is the recommended way to configure the compile/build process so that unused functions are not compiled or linked into the final image flashed to the microcontroller, in order to save flash space?I am not familiar with CMake, so if this can be achieved without using CMake, that would be preferred.If custom configuration text is required (for example Makefile edits or similar), could you please outline them in detail and whether these changes are generally safe, or if they require careful consideration.Any clarification on the recommended approach would be greatly appreciated.Thank you
Hi,I am using a STM32C031G6U6 and I would appreciate some clarification regarding HAL timebase and SysTick timebase selection.I want to use SysTick as a 1ms interrupt so in CubeMX I selected SysTick as timebase (see screenshot): None of the other timers - including TIM3 - are not enabled as shown here: These are the other settings: I then generated the code. But there is no sign of any SysTick related functions/handlers in the interrupt file stm32c0xx_it.c as you can see here: /* USER CODE BEGIN Header */ /** ****************************************************************************** * @file stm32c0xx_it.c * @brief Interrupt Service Routines. ****************************************************************************** * @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. * I
I am using STM32G491RE - NUCLEO. connected to the ADM3055e CAN Transceiver Currently I am trying to send 12 Bytes of Data from IXXAT Terminal over to FDCAN1 which receives the message fine and then Output the Message on FDCAN2 though a buffer. So My logic is when a message pass the filter it gets called by the Fifo0Callback and push it to a buffer below. This works fine the buffer also get the full 12Bytes of data same FD format and everything checked out.But when I try to add the message to HAL_FDCAN_AddMessageToTxFifoQ(&hfdcan2, &TxHeader2, TxData2). Where TxData is the dequeued message from the buffer and copys the 12Bytes. The message somehow gets truncated to 8Bytes on output. Heck, when I add "if (HAL_FDCAN_GetTxFifoFreeLevel(&hfdcan2) > 0)", It somehow says it is full even when starting the code.I have been suspecting because I cant set the HAL_FDCAN_ConfigTxBufferElementSize and HAL_FDCAN_ConfigRxBufferElementSize or even the messageRam offset
Hi all,during testing a custom project with NETXDUO on NUCLEO-H563ZI I've noticed that sometimes web server response is rather slow.Wireshark shows rather frequent TCP retransmissions and other problems.To be sure, I've tried an example from ST (Nx_Iperf) with the same result.It seems that problem is in ETH_Prepare_Tx_Descriptors(), in check of Tx Descriptor: /* Current Tx Descriptor Owned by DMA: cannot be used by the application */ if ((READ_BIT(dmatxdesc->DESC3, ETH_DMATXNDESCWBF_OWN) == ETH_DMATXNDESCWBF_OWN) || (dmatxdesclist->PacketAddress[descidx] != NULL)) { return HAL_ETH_ERROR_BUSY; }I removed this check and TCP retransmissions became much less frequent.Is there a better solution?
Dear all, We are using the STM32N6570-DK to encode a video stream (800x600px) and store that at a reasonable data rate to an external sd-card.I have extended the VENC_SDCARD_ThreadX example to a certain extent to cover the obvious timing differences between the video capture loop and a disk write loop. The sample code is a great way to go forward, but at the moment we reach a data write rate of about 25kb/s when using FileX.We have initially used the HAL implementation but I have changed the fx_stm32_sd_driver_glue.c code slightly to use the BSP layer for card speed negotiation that is not present in the HAL layer; debug output shows that we're at least using 4-bit wide data transfers>:CardInfo type 1, version 1, class 1461, spd 0 Inst PWR 00000013 CLKCR 00004004 It seems that just before reaching down to the HAL layer, the single transaction (~200blocks at once, typically), is split into single sector writes in the sd_write_data function (fx_stm32_sd_driv
I need to create a UART driver that works reliably in all conditions.The driver must use DMA, and since the incoming messages are NOT fixed-length, I need to use idle line detection.My question is: how can I use a callback to store the received message when an idle line is detected and then restart the reception using the STM32 HAL idle-line API?
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.