Ask questions and find answers on STM32Cube packages, including HAL, LL and middleware, and expansion software.
Most recent activity
Hi everyone,I am trying to implement Micro-ROS over UDP transport on an STM32F7, with custom msg type According to this article,https://micro.ros.org/docs/tutorials/advanced/create_new_type/but when building the firmware using ros2 run micro_ros_setup build_firmware.sh script, microxrcedds_client package fails to build./microros_ws/firmware/mcu_ws/eProsima/Micro-XRCE-DDS-Client/src/c/profile/transport/ip/ip_posix.c:18:10: fatal error: lwip/inet.h: No such file or directory #include <arpa/inet.h> ^~~~~~~~~~~~~ compilation terminated. gmake[3]: *** [CMakeFiles/microxrcedds_client.dir/build.make:429: CMakeFiles/microxrcedds_client.dir/src/c/profile/transport/ip/ip_posix.c.obj] Error 1 gmake[3]: *** Waiting for unfinished jobs.... /microros_ws/firmware/mcu_ws/eProsima/Micro-XRCE-DDS-Client/src/c/profile/transport/ip/udp/udp_transport_posix_nopoll.c:5:10: fatal error: sys/socket.h: No such file or directory #include <sys/socket.h> ^~~~~~~~~~~~~~ compilation termina
Hi,I have a Nucleo-L476RG development board that I am evaluating for my application. One of my basic requirement is to read data from an IMU sensor ICM20948 (https://www.sparkfun.com/products/15335) using I2C and write those data to a SD card.I am using an interrupt based I2C read method ( HAL_I2C_Mem_Read_IT + HAL_I2C_MemRxCpltCallback ) to read data at 300Hz from the sensor. I need to save 12 float variables and I am planning to hookup a SD card to the development board to save sensor data, something like https://www.amazon.com/gp/product/B09K6XVS9R/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&psc=1 which supports both SPI and SDIO interface. Since STM32-F476 also supports SDIO I figured I will give it a try since everywhere it says SDIO is faster than SPI.So far from what I gathered from searching online is that STM32CubeIDE uses a middleware FatFs to interact with the SD card. There is f_write function which writes to SD card but that is a blocking function, I would much pre
On STM32H753, is it possible to disable Ethernet MAC source address replacement?I am working on a project that requires packet bridging, and I am stuck by the MAC altering the source address of bridged packets!Reference manual section 58.5.2 discusses source address insertion/replacement. It refers to register MACCR, bits SARC. But the definition for these bits does not have an option to disable the MAC from overwriting the source address in my packets. Edit: I tried setting SARC bits to all zero and it seems to disable address replacement. But this is not documented. It appears bit 28 selects insert/replace, bit 30 selects address 0/1 and bit 29 enables/disables address insertion. Does anybody have arms into ST to confirm if this is indeed the case? Edit: STM32H7 HAL driver for Ethernet seems to offer a disable option for source MAC replacement, so maybe it is a thing. /** @defgroup ETH_Source_Addr_Control ETH Source
Hello everyone, and thank you in advance for chiming in on this topic ! I'm having trouble getting an STM32H743VI pass a 32GB uSD-Card to my computer through USB_OTG_FS. Please consider me a noob at embedded system.I'm following Phil's Lab video (https://www.youtube.com/watch?v=aEwwQMdKd-c) which uses the same family of microcontrollers and manages to get his SD card recognized by his computer, with write and read working. I'm following the same steps, but when I connect the board to my computer, no available space is shown and double clicking on the listed USB device prompt me to format it (even though trying to format it doesn't work that way).The project I'm working need wave file transfer between a computer and the STM32 so that the STM can read it later on and use them for real-time audio processing. In order to achieve that, I have enabled FatFS, SDMMC1, USB_OTG_FS and USB_DEVICE. I already have some code running the real-time audio processing part, but I disabled it just fo
hi i have a system with two flash memories, one nor and one nand. i need a filesystem supported especially for the nand. which one can i use? are there any examples of support?
Hi, after flashing the MCU, it jumps to an incorrect system memory address instead of my application code. I looked into the issue and found that the vector table isn't properly set in flash. I'm trying to understand how to set it correctly, but I'm still not getting it.
Split from old thread: https://community.st.com/t5/stm32-mcus-security/information-about-mcuboot-and-illustrative-examples/td-p/689154 Hello @Jocelyn RICARD ,I'm looking for guidance on integrating Mcuboot into my project. I am using a NUCLEO-U5A5ZJ-QSTM32CubeIDE 1.17First of all some notes about the experience:When using the example selector in CubeIDE and, for example the SBSFU_Boot project, it has several problems related to paths in the shell scripts. It cannot find the env.sh file, since it's in the root SBSFU directory. It shows only the content of the STM32CubeIDE directory, while it also has related content in the top directory?How should I use this example correctly? Download the whole SBSFU project and not use CubeIDE, but use make/cmake and a manually installed compiler?Are the provided examples by ST for Mcuboot in the SBSFU project using the modified Mcuboot middleware?When writing my own bootloader is that the recommended way or is it only for dem
Hello. I bought Riverdi board and start to develop my code. I found in FREERTOS_M7 Config parameters RTOS CHECK_FOR_STACK_OVERFLOW. Documentation says CHECK_FOR_STACK_OVERFLOWParameter Description:FreeRTOS provides two optional mechanisms that can be used to assist in stack overflow detection and debugging.- when CHECK_FOR_STACK_OVERFLOW is set to 1 (option1), one mechanism is used- when CHECK_FOR_STACK_OVERFLOW is set to 2 (option2), both mechanisms are used.If CHECK_FOR_STACK_OVERFLOW is not set to 0 (Disabled), the application must provide a stack overflow hook (or callback) function: void vApplicationStackOverflowHook( xTaskHandle xTask, signed char *pcTaskName );The kernel will call that stack overflow hook whenever a stack overflow is detectedNote: when set to 1 or 2, a function with an empty body is generated in the freertos.c file (to be completed by the user) So I set CHECK_FOR_STACK_OVERFLOW = 1, trigger a stack overflow by an infinite re
I am working with the NUCLEO-C031C6 board and tried to to make the user push button toggle the user LED but it stays stuck with no change to the buttonStatus variable, always high (1).I added the counter variable to see if it is continuously incrementing, however, it appears that the code does not loop and gets stuck somewhere, and thus when I press the push button, it is not updating the buttonStatus variable.Can you please see where the issue is:#include "stm32c0xx_hal.h" //Blue button = PC13, BUS AHB1 EN bit 0 #define BLUBTN_Port GPIOC #define BLUBTN_Pin GPIO_PIN_13 //Green LED = PA5, BUS AHB1 EN bit 2 #define GRNLED_Port GPIOA #define GRNLED_Pin GPIO_PIN_5 void PA5_LED_init(void) { __HAL_RCC_GPIOA_CLK_ENABLE(); GPIO_InitTypeDef GPIO_InitStruct = {0}; GPIO_InitStruct.Pin = GRNLED_Pin; GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; HAL_GPIO_Init(GRNLED_Port, &GPIO_InitStruct); } void PC13_
Dear All,I am testing the demo project for the NUCLEO-C071 to implement the USB HOST CDC_ACM (USBX). Below are some doubts that arose after the initial tests:After using the wizard to create the demo project 'Ux_Host-CDC_ACM', opening the .ioc file shows an error in the USBX configuration. In the 'Platform Settings' tab, the pin 'Drive VBUS_FS' is not defined. From what I understand, this should be the pin used by the library to enable the 5V power supply on the USB connector when in HOST mode. However, looking at the electrical schematic of the NUCLEO-C071, there is no pin available for this functionality! To supply 5V to the connector, there is the JP1 jumper (pin 7/8). The only way to avoid the error is to assign an unused pin! Isn't there a smarter way to avoid sacrificing a pin?After resolving the error, without adding anything to the demo project, and having compiled and downloaded the program onto the NUCLEO board, any device I connect always results in the error "USB Device Enu
Hi team What is the correct procedure to initialize FATFS for SDMMC in M4? Kindly provide the application note of the procedure. We need to run eMMC in M4 core EVK used : STM32H745I-DISCO References code: STM32CubeH7/Projects/STM32H745I-DISCO/Applications/FatFs/FatFs_Shared_Device at master · STMicroelectronics/STM32CubeH7 Please find the information below for your reference. Test Case 1:------------In M4, SDMMC configurations:1. SDMMC peripheral selected for M4.2. SDMMC Clock configuration: 100 MHz3. SDMMC Clock divide factor: 44. Mode: MMC 4 bits Wide Bus5. Clock Edge: Rising Edge6. Clock Power Save: Disable 7. Hardware Flow Control: Disable FATFS configurations:- FATFS Package used from FatFs_Shared_Device project of GitHub. - Replaced the FATFS package from the reference project with the one in STM32Cube_FW_H7_V1.11.2 repository. Conclusion:- Una
Hi,I am trying to interface Stm32h745 controller with a 240x320 TFT LCD over FMC. Interesting thing is, when I manually control lcd control and data pins(Set them as GPIO_OUTPUT_PP), Lcd works, but when I switched to FMC it does not. Tried lots of timing configuration but it did not help.Here is the init for FMC .Instance = FMC_NORSRAM_DEVICE; .Extended = FMC_NORSRAM_EXTENDED_DEVICE; .Init.NSBank = FMC_NORSRAM_BANK1; .Init.DataAddressMux = FMC_DATA_ADDRESS_MUX_DISABLE; .Init.MemoryType = FMC_MEMORY_TYPE_SRAM; .Init.MemoryDataWidth = FMC_NORSRAM_MEM_BUS_WIDTH_8; .Init.BurstAccessMode = FMC_BURST_ACCESS_MODE_DISABLE; .Init.WaitSignalPolarity = FMC_WAIT_SIGNAL_POLARITY_LOW; .Init.WaitSignalActive = FMC_WAIT_TIMING_BEFORE_WS; .Init.WriteOperation = FMC_WRITE_OPERATION_ENABLE; .Init.WaitSignal = FMC_WAIT_SIGNAL_DISABLE; .Init.ExtendedMode = FMC_EXTENDED_MODE_DISABLE; .Init.AsynchronousWait = FMC_ASYNCHRONOUS_WAIT_DISABLE; .Init.WriteBurst = FMC_WRITE_BURST_DISABLE; .Init.Conti
Hi,I would like to know why when I sent the 202 bytes from pc to dev-board via USB HID, the buffer size would only get 32 byte each time, (byte[0]-byte[31])*several times until finished print out all 202 bytes?Couldn't it recieved whole 202 bytes then print out continuously from byte[0] to byte[201]?ux_device_keyboard.c /** * @brief USBD_HID_Keyboard_SetReport * This function is invoked when the host sends a HID SET_REPORT * to the application over Endpoint 0. * @PAram hid_instance: Pointer to the hid class instance. * @PAram hid_event: Pointer to structure of the hid event. * @retval status */ UINT USBD_HID_Keyboard_SetReport(UX_SLAVE_CLASS_HID *hid_instance, UX_SLAVE_CLASS_HID_EVENT *hid_event) { UINT status = UX_SUCCESS; /* USER CODE BEGIN USBD_HID_Keyboard_SetReport */ UX_PARAMETER_NOT_USED(hid_instance); UX_PARAMETER_NOT_USED(hid_event); //Receive Output report from PC if (hid_event == UX_NULL || hid_event->ux_device_class_hid_event_length < 2) return UX_ER
Hi everyone,I'm trying to drive a WS2812 LED strip (20 LEDs - Strip has 60 LEDs) using an STM32L432KCUx, but so far without success.I've tested multiple approaches — PWM with DMA, SPI-based encoding, and bit-banging via GPIO — but none of them produce stable or correct results. Sometimes up to 22 LEDs light up instead of 20, and the colors are often wrong or appear white.Occasionally, the first LED doesn’t light up at all, which seems to indicate timing jitter or inaccurate bit timing.Setup:Microcontroller: STM32L432KCUxNo external HSE crystal or LSE availableSYSCLK = 48 MHz, tested using both MSI via PLL and HSI via PLLOutput pins used:PA12 for SPI and bit-bangingPA9 for PWM (TIM1_CH2)SPI clock set to 2.4 MHz (used for encoded WS2812 bitstream) SYSCLK = 38MHz3.3 V logic level used for WS2812 data line (no level shifter)LED strip powered with 5 V USB - GND connectedAdditional info:I confirmed the LED strip and wiring are working:Using an Arduino, the same strip works immediately and re
Hello,I'm new to STM32 and trying to learn exciting stuff. I want to light a single LED from my WS2812B strip. For example I will choose 6th LED on my computer and 6th LED on strip will light up.But I'm not sure where to start. How can I access to single LED address? And how to get it work with STM32?Thanks in advance.
i am trying to implement openBootloader for an stm32l451,but i cant get the write to work i get the following errors HAL_FLASH_ERROR_PROG | HAL_FLASH_ERROR_PGA |HAL_FLASH_ERROR_PGSi am trying to write to 800c000 in the flashthis is my code( i used https://github.com/STMicroelectronics/stm32wl-openbl-apps to assist in how to write the interfaces)void OPENBL_FLASH_Unlock(void) { HAL_FLASH_Unlock(); } static void OPENBL_FLASH_Program(uint32_t Address, uint64_t Data) { /* Clear all FLASH errors flags before starting write operation */ __HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_ALL_ERRORS); HAL_FLASH_Program(FLASH_TYPEPROGRAM_DOUBLEWORD, Address, Data); } void OPENBL_FLASH_Write(uint32_t Address, uint8_t *Data, uint32_t DataLength) { uint32_t index; __ALIGNED(4) uint8_t buffer[FLASH_PROG_STEP_SIZE] = {0x0U}; uint8_t remaining; if ((Data != NULL) && (DataLength != 0U)) { /* Unlock the flash memory for write operation */ OPENBL_FLASH_Unlock(); /* Program double-
Hello all,I allow to send this message after a long attempt to perform a switch bank on my STM32U385RG.This is part of my code:/*--------------------------------------------------------*/ void OptionBytes_SwapBanks(void) /*--------------------------------------------------------*/ { FLASH_OBProgramInitTypeDef OBInit; HAL_StatusTypeDef status; swo_printf("Current USERConfig: 0x%08lx\n", OBInit.USERConfig); __HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_OPERR | FLASH_FLAG_PROGERR | FLASH_FLAG_WRPERR | FLASH_FLAG_PGAERR | FLASH_FLAG_SIZERR | FLASH_FLAG_PGSERR | FLASH_FLAG_OPTWERR); uint32_t optr = FLASH->OPTR; if (optr & FLASH_OPTR_DUALBANK) { swo_printf("Dual Bank is ENABLED\n"); } else { swo_printf("Dual Bank is DISABLED\n"); } if (optr & FLASH_OPTR_SWAP_BANK) { swo_printf("Swap Bank is ENABLED\n"); OBInit.OptionType = OPTIONBYTE_USER; OBInit.USERType = OB_USER_SWAP_BANK; OBInit.USERConfig = OB_SWAP_BANK_DISABLE; } else { swo_printf("Swap Bank is DISABLED\
Hello, I'm using lwIP and I try to change DEFAULT_THREAD_STACKSIZE But where it applies ? I have my code under version control but I don't see any change ... and I don't see "lwIP" thread, maybe EthIF ?
Hi team, I am using STM32F7 for my work, am facing one issue regarding USB CDC Class, whenever am using it without enabling this macro everything is working fine, however as soon as i enabled this macro system will stop working itself, it will not even detect the device. Is there anything additionally i need to do to enable this. #define USBH_USE_OS 1U As per my knowledge , when am not using this OS enabled USB , I am calling this USBH_Process() within infinite loop. and after enabling it , no need to call this function inside infinite loop ryt? Kindly help me to clarify these doubts. Regards, Shikamaru
Hello,I'm experiencing strange intermittent failures using STM32U575ZIQ using SPI and related DMA. MCU SPI setup: slave Rx-only mode, with slave select HW signal.SPI from the master (AD7768 ADC) shows 4MHz clock active all the time (even when there is no data), and slave select signal is active all the time too except for one "inactive" pulse just before the first data transmission bit is issued (i.e. there is an active start transition just before the first bit). The data burst from this master is 64bytes long (16 x 32-bit words), and one burst is sent every 250us (4kHz activity).As the slave select and data clock are still active after the last data bit is over, I have to stop the SPI (for not reading empty data) and re-start it to have it ready listening for the next "slave select" active transition. I'm using HAL routines "HAL_SPI_DeInit" and "HAL_SPI_Init" to do this. I'm transferring the data from the SPI to the MCU memory using DMA 32-bytes bursts, and this works fine quite
Hi Everyone,I am currently working on a project that involves interfacing the "AT21CS01-STUM10-T" 1-wire EEPROM with the STM32C011F6U6TR microcontroller. I aim to implement read and write operations between these components but require guidance on the hardware setup and code flow.Specifically, I seek assistance in understanding the following:Hardware Connection: I need guidance on how to physically connect the 1-wire EEPROM to the STM32C011F6U6TR microcontroller. What are the necessary connections and considerations for ensuring proper communication?Code Flow: I am looking for insights into the code structure and flow required to communicate with the 1-wire EEPROM using the STM32C011F6U6TR microcontroller. How should I initialize GPIO pins and implement functions for read and write operations?Read Operation: Could someone provide guidance on how to perform read operations from the 1-wire EEPROM? What are the necessary steps and considerations for retrieving data reliably?Write Operatio
Hi,1. [Part Number] NUCLEO-L432KC2. [Environment] STM32CubeIDE 1.14.13. [Schematics] NA4. [Details] I am trying to measure a fast pulse with the ADC (~3 us rise time). I would like to trip a comparator when the pulse starts to rise and then start an ADC (paced by a timer) to fill a buffer via DMA. After the buffer is full, I will send the data over UART for analysis.The COMP and ADC are both connected to the same input. The COMP is set to trigger when the voltage exceeds that of an external input set to 0.04 volts. The ADC is connected to a timer that triggers at 2 Mhz.I wait for HAL_COMP_TriggerCallback and then start the ADC with DMA: void HAL_COMP_TriggerCallback(COMP_HandleTypeDef *hcomp) { if (hcomp == &hcomp1) { HAL_ADC_Start_DMA(&hadc1, (uint32_t*)voltage_buf, VOLTAGE_BUF_LEN); HAL_COMP_Stop_IT(&hcomp1); }} 5. [Problem and Expected behavior] I have configured the above but I am seeing that the first ADC reading starts well after the pulse has started. Should I expe
Hello everyone,I am using a NUCLEO-F446ZE board as a USB device. I use EP1(IN/OUT) for bulk transfer and EP2 IN for Interrupt transfer.USB firmware side(STM32F446ZE), I send EP2 data as below.i call USBD_LL_Transmit(pdev, ep_addr, pbuf, size) then callsHAL_PCD_DataInStageCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum).everything up to this step seems fine and EP2 IN data is stored in FIFO.However when PC(host side) polls for EP2 IN data, PC can`t receive the data. I use WinUSB to poll EP2 IN data.WinUsb_ReadPipe(winusbHandle, ENDPOINT_INT, interruptBuffer, sizeof(interruptBuffer), &bytesRead, NULL);//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////000058: Bulk or Interrupt Transfer (UP), 2025-05-07 09:50:43.1859061 +0.2135957. (1. Device: )Status: 0xc0010000Pipe Handle: 0x22737730 (Endpoint Address: 0x82)Get 0x0
Dear ST, I use STM32F777 and try to receive SPI Data as a slave via SPI DMA. That works only pretty fine, when I don't activate the CRC Checksum calculation. I receive after the DMA threshold the expected data, but when I set: .CRCCalculation = SPI_CRCCALCULATION_ENABLE, The received data traped in a Error Callback from the SPI, always. All my init values of the SPI are vaild, look like here:.SPI_CONFIG = {.Mode = SPI_MODE_SLAVE, .Direction = SPI_DIRECTION_2LINES_RXONLY, .DataSize = SPI_DATASIZE_8BIT, &n
When using I2C with DMA on an STM32G4, is there a recommended relative ordering of the I2C event, I2C error, and DMA interrupt preemption priorities?I have not been able to find anything in documentation about this (though I might have missed it). What I have found is the CubeG4 examples (I2C_TwoBoards_ComDMA) where the DMA, I2C event, and I2C error interrupts all have the same preemption priority (0 for all). I've also found another post where ST recommends the following relative preemption priority values: DMA (0) < I2C error (1) < I2C event (2).Currently we have the following relative preemption priority values: DMA (8) < I2C event (10) < I2C error (11). In our case the event and error are reversed compared to the above linked ST advice, though we don't remember why. I'm debugging WWDG events that we've traced to an I2C event interrupt storm, and one hypothesis is that the internal state of the HAL I2C driver is getting corrupted by e.g. DMA interrupt preempting an alrea
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.