Ask questions and find answers on STM32Cube packages, including HAL, LL and middleware, and expansion software.
Most recent activity
I configured dual DAC synchronous sampling,DMA is in normal mode for data transfer.When the timer frequency of the ADC is 10KHz, the main cycle can print serial port information, but when the timer frequency is 50KHz, the main cycle does not print ADC data information. What is the reason for this? Below is my cubemx software configuration and related code. int main()CallBack: ADC DMA NVIC
Hi all,I'm having trouble getting reliable SPI communication using the STM32N6570-DK board. I'm using SPI5 with DMA, but the data I receive is only correct about 50% of the time.I'm expecting to receive the value 1025, but often get corrupted values like 1024, 512, or 256. However, on the oscilloscope, the SPI signal is always correct—it doesn't vary between good and bad reads.I've already taken steps to avoid cache issues by placing the DMA buffers in a non-cacheable memory region:__attribute__((section(".noncacheable"))) static uint8_t spi_tx_buf[IO_CHUNK_SIZE]; __attribute__((section(".noncacheable"))) static uint8_t spi_rx_buf[IO_CHUNK_SIZE];My MPU configuration for this region is as follows:/** * @brief Configure the MPU attributes for the non-cacheable RAM section. * @note This function should be called before enabling the caches. */ static void MPU_Config_NOCACHE(void) { MPU_Region_InitTypeDef MPU_InitStruct = {0}; /* Make sure the address is aligned to the region size */
I am beginner in using STM32 boards I am working with stm32f411re board with that I will use sim900a gsm module for internet connectivity and then mqtt protocol to send data to AWS cloud. So, when I am using paho mqtt library paho.mqtt.embedded-c/MQTTClient/samples at master · eclipse-paho/paho.mqtt.embedded-c I am getting errors related to socket,mutex,semaphore so confused which library to use can anyone help me in selecting and integrating mqtt library. Thanks in advance for help.
USB HID Endpoint Size Challenge - My Experience Issue Description I'm experiencing an issue with USB HID endpoint sizes in my firmware running on an STM32U5 microcontroller with ThreadX RTOS and USBX middleware. Specifically: My host is sending 20-byte messages (1 byte report ID + 1 byte page number + 18 bytes of data) I've tried setting the endpoint maximum packet size (USBD_HID_CUSTOM_EPOUT_HS_MPS and USBD_HID_CUSTOM_EPOUT_FS_MPS) to 24U and 32U, but neither worked Only a 16-byte endpoint size works with my hardware, which creates a mismatch with my 20-byte report size Most importantly, my USBD_Custom_HID_SetReport callback function does not get called at all when using 24U or 32U endpoint sizes Technical Details Hardware Platform: STM32U5 series microcontroller RTOS: ThreadX USB Stack: USBX middleware USB Class: Device HID Custom Class Report Size: 20 bytes (defined in HID report descriptor) Working Endpoint Size: 16 bytes Non-working Endpoint Sizes
I'm working on some code that has a boot loader and an application. At the moment I am using one linker script for each, which means I have to make sure I keep them in sync. Is it possible to configure the build for (e.g.) the boot loader so that .boottext is used instead of .text for the code so that a single linker file can be used?I've tried searching (here and internet) and it appears as if this can't be done with GCC - but I thought it was worth asking just in case I've missed something.
The STM32 HAL is good and simple. It's highly appreciated that I am not forced to use a certain build system. But there is one thing that drives me crazy: The STM32 HAL has lots of weakly defined symbols. That forces me to put any strong symbol overrides into objects linked with the executable. It is impossible to put the HAL and the strong symbol overrides into a or different static libraries. It's a nightmare. Consider projects where all hardware-related code is hidden in static libraries and the executable code is platform-independent.A pragmatic solution could be to enclose all weak function definitions in the ST32 SDK inside ifdef guards to be able to switch those off. I will now copy the related HAL files out of the SDK and patch them on my own. That's not optimal because I will have to repeat that on every SDK update.Please consider to fix this problem.
Hello ST Community, I noticed that STM32L5 series (e.g., STM32L552) does not currently have official FDCAN support in Zephyr. The stm32l5.dtsi does not define an fdcan node, and there are no corresponding bindings or support in the driver layer for this series. I’ve attempted to adapt the FDCAN configuration using references from STM32G4 and STM32U5 series. While I was able to build the device tree by manually adding a node with compatible = "st,stm32-fdcan", the runtime initialization fails—likely due to differences in clock setup or message RAM layout. I would really appreciate guidance on the following: Is there a plan to add STM32L5 FDCAN support officially in Zephyr? What would be the correct fdcan node configuration in the .dtsi or overlay? What values should be used for bosch,mram-cfg and what memory region is reserved for message RAM on STM32L552? Are there any working examples or patches that can help enable FDCAN on STM32L5? Any help or direction would be greatly ap
Hello dear supporters,I had some issues setting up my STM32G0B1CET6N as USB Communication Device Class (Virtual Port COM). Clock Source for the USB is the internal "HSI48 RC" oscillator, designed for USB application. What happened? I used the default USB Settings (default USB STMCube MX generated).I started debugging (step by step) and came to the MX_USB_Device_Init();function inside the main.c Then I open the Windows11 "Gerätemanager (Device Manger)" and the USB device always failed to get recognized. --------------------------------------------------------------------------------------------------------------------------------------------------I relaunched the debugger and this time I just klicked on the "Run" button. No step by step debugging this time. The STM32 gets recognized as a COM device without any problem. And the communication (sending data to the putty terminal) works without any problem. ---------------------------------
Hi. I am currently using the stm32u545ret6q mcu. Looking at the RCC of reference documentation(RM0456) it says that it has MSIS hardware autocalibration, but the example code(AN5676) only shows how to adjust the trimming value. Do you have any example code that shows how to do hardware auto-calibration?
Hello,I'm working on a project using the STM32H750B-DK board with TouchGFX and FreeRTOS. The application gets stuck in this loop:while ((HAL_GetTick() - tickstart) < Delay) {}I debugged and confirmed that HAL_GetTick() is not incrementing
I have a STM32L432 Nucleo-32 board and I'm trying to use ITM printf trace. I created new project with configuration: "Targeted Project type: Empty" "targeted language: C++". I'm not using HAL libraries.In the syscalls.c I added following code://Debug Exception and Monitor Control Register base address #define DEMCR *((volatile uint32_t*) 0xE000EDFCU ) /* ITM register addresses */ #define ITM_STIMULUS_PORT0 *((volatile uint32_t*) 0xE0000000 ) #define ITM_TRACE_EN *((volatile uint32_t*) 0xE0000E00 ) void ITM_SendChar(uint8_t ch) { //Enable TRCENA DEMCR |= ( 1 << 24); //enable stimulus port 0 ITM_TRACE_EN |= ( 1 << 0); // read FIFO status in bit [0]: while(!(ITM_STIMULUS_PORT0 & 1)); //Write to ITM stimulus port0 ITM_STIMULUS_PORT0 = ch; } __attribute__((weak)) int _write(int file, char *ptr, int len) { (void)file; int DataIdx; for (DataIdx = 0; DataIdx < len; DataIdx++) { ITM_SendChar(*ptr++); } return len; }I didn't make any changes t
Hello everyone,I am currently working on a project using an STM32H755ZIT6 MCU and want to use the USB CDC class to send data over USB. I can successfully program the MCU and the system clock configuration is correct. However, when I plug in the USB, the device is not recognized by Windows. I receive the following error message:"Unknown USB Device (Device Descriptor Request Failed)""The last USB device you connected to this computer malfunctioned, and Windows does not recognize it."Schematic details:I have attached the schematic of the USB circuit to this post.USB_DP is connected to PA12.USB_DN is connected to PA11.The circuit is powered via USB as well.Currently, only R45 and R50 are mounted (0 Ohm), R47 and R49 are not mounted.The TS3USB30EDGSR chip is not activated at this stage. I have the option to activate it if needed.To make sure the MCU has enough time after power-up, I added a 3-second delay before initializing the USB stack.Still, the USB device is not recognized.If anyo
I'm having difficulties in approaching GPDMA in H5 architecture. In another thread I'm trying to run a DMA, which keeps going itself (circularly?).Does that mean inherently that always a linked list has to be used?And would uneviteably go along with an interrupt being generated?If the buffer length is 1 (in my case), that would be very costly and would foil the benefit of DMA.Where can I find a good source for reading on (tutorial, examples)?
Recently I’ve been developing a host application on a Mac Mini (Apple M4, Sequoia 15.5) using Xcode. It communicates with a STM32H7 board via USB CDC, using the internal PHY at 12 Mbps. The USB CDC code is auto-generated by CubeMX with all default parameters. The board works perfectly with serial tools on Windows.When the same board is connected to the Mac Mini, it successfully enumerates two devices: /dev/tty.usbmodem and /dev/cu.usbmodem. Regardless of which one selected to communicate, writing always succeeds and the board receives the data correctly and sends respond back.However, for some reason, the Mac computer “drops” the incoming data—the application’s read() function never gets anything.I’ve already tried the following combinations:Reading and writing from tty or cu deviceBlocking and non-blocking reads (including background event-listening methods)Enabling DTR and/or RTSUsing third-party libraries like ORSSerialPortNone of them worked. Also tried some serial tools on Ma
Hi, I assume there have already been posts on this topic, but I can't handle this problem. I have an STM32F429I-DISC1 board and I'm trying to connect it as a USB HID keyboard. Unfortunately, all the guides and articles don't work, and my board isn't even detected by the computer after uploading the program. Why? Has anyone else had this problem and would like to share a solution?
Hi, I'm working on STM32H7A3NIH6Firmware Package: STM32Cube FW_H7 V1.11.2 I have a very interesting issue with bootloader jumping.According to the file "an2606-stm32-microcontroller-system-memory-boot-mode-stmicroelectronics", the bootloader address is 0x1FF0A000. The issue: Sometime its works (succeed to jump into the bootloader, and succeed to program by STM32CubeProgrammer), and sometime is not. After investigation, I found that when it is not works, it is because the jumping function stuck in HAL function named SCB_DisableDCache().In SCB_DisableDCache(), there is a while loop that reduce a variable named "sets", and when it came to be zero, the loop is done, and the jumping is continue.The variable "sets" value starting with some value, 127 for example, and sometime without any reason it changed to a non-reasonable number (605028303), and the loop is continued and continued. SCB_DisableDCache() is a pure HAL function. I'm using thi
I have an STM32H735 Discovery Kit and am running the example LWIP code from STM32H7-LwIP-Examples/STM32H735_Disco_ETH. This works great. But, when I add MDNS, I get a very curious crash.I enabled MDNS in CubeMX, and then created a new thread to wait for an address to be assigned by DHCP before initializing MDNS:void mdns_thread(void *argument) { mdns_resp_init(); while(!dhcp_supplied_address(&gnetif)) { vTaskDelay(1000/ portTICK_PERIOD_MS); } LOCK_TCPIP_CORE(); mdns_resp_add_netif(&gnetif, "scion", 60); /* mdns_resp_add_service(&gnetif, "_scion", "_scion", DNSSD_PROTO_UDP, 9000, 3600, srv_txt, NULL); mdns_resp_announce(&gnetif); */ UNLOCK_TCPIP_CORE(); while (1) { vTaskDelay(500/ portTICK_PERIOD_MS); } } With the thread created as: osThreadAttr_t attributes; memset(&attributes, 0x0, sizeof(osThreadAttr_t)); attributes.name = "MDNS"; attributes.stack_size = 512; attributes.priority = osPriorityNormal; osThreadNew(mdns_thread, &gnet
HiI'm having troubles programming the stm32h755zit6 on my selfmade PCB. The schematics should be right, as i am able to programm the STM32. But if i run a simple code inwhich a certain pin should be pulled up high, it just won't work. Therefore I thought about debugging the code to see whether it reaches the part inwhich the GPIO-function is called. But instead it doesnt and ends up in a error_handler. Afterwards i somehow am not able to reprogramm the STM32H755 anymore as the message following message appears:stmicroelectronics st-link gdb server. version 7.10.0 copyright (c) 2025, stmicroelectronics. all rights reserved. starting server with the following options: persistent mode : disabled logging level : 1 listen port number : 61234 status refresh delay : 15s verbose mode : disabled swd debug : enabled initwhile : enabled target no device found error in initializing st-link device. reason: no device found on target.I have no done this over and over again three time an i always had
Problem DescriptionI am having some trouble using HAL_UART_Receive_IT() to receive UART data in interrupt mode, the callback HAL_UART_RxCpltCallback() only triggers once for the first byte, subsequent bytes do not trigger the interrupt. I don't know if there is some problem with my implementation or if the problem is in STM32CubeH5 (v1.5.0). I would really appreciate some help!SymptomsHAL_UART_RxCpltCallback() executes correctly for the first received byte.Calling HAL_UART_Receive_IT() again does not fix the issue.No further interrupts are generated, even though UART data is arriving.Root Cause?I did some digging and found the UART interrupt handler (UART_RxISR_8BIT) clears the RxISR function pointer (huart->RxISR = NULL) after processing the first byte. This prevents the interrupt from being handled correctly again, even if HAL_UART_Receive_IT() is called again.Workaround: Manually Restore huart->RxISRTo workaround this, I added one line to manually reassign huart->
I am trying to switch the USB to DisplayPort mode via the PD (Power Delivery) line. I have a custom board based on the STM32G0B1CBT6, and another board based on the RTD2556, which works well for switching. I am sniffing PD communication using the LA1016 logic analyzer, and I have successfully been able to repeat all responses connected to perform the switching mode, except for sending SOP from the device to the host. All the necessary logic is implemented in the usbpd_vdm_user.c file, in the callbacks function. In the main thread, I have osDelay(2000); /* Update DP Status first */ sDP_Status[0].d.HPDState = 1; // Set HPD state sDP_Status[0].d.Enable = 1; // Set enabled /* Request attention - this will trigger message send */ USBPD_DPM_RequestDisplayPortStatus(0, USBPD_SOPTYPE_SOP, 0xFF01U, &sDP_Status[0].d32);But nothing in the log happining. Like it whaiting for something. I'm tring to send2.5380323000,Preamble2.5382400500,SOP,,2.5383050000,Header,0x2E8F,DataObject
Hello!I am using STM32F427VIT6 and OV5640 camera to stream MJPEG to a webserver. I used DCMI DMA to get a jpeg_frame, size around 10KB to 25KB per image, with almost 30FPS and send it to jpeg buffer in CCMRAM like this.__attribute__((section(".ccmram"))) __attribute__((aligned(32))) uint8_t jpeg[32768]; __attribute__((section(".ccmram"))) __attribute__((aligned(32))) uint32_t jpegLength = 0; Then I used LwIP with raw TCP, tcp_write() function to send it to webserver but it's very laggy, sometimes return ERR_MEM in this functionLWIP_DEBUGF(TCP_OUTPUT_DEBUG | LWIP_DBG_LEVEL_SERIOUS, ("tcp_write : could not allocate memory for pbuf copy size %"U16_F"\n", seglen)); goto memerr;Although I spent nearly 100% of my RAM allocating for LwIP heap memory and SND buffer. Here is my LwIP mem config/*----- Default Value for MEMP_NUM_TCP_PCB: 5 ---*/ #define MEMP_NUM_TCP_PCB 1 /*----- Value in opt.h for NO_SYS: 0 -----*/ #define NO_SYS 1 /*----- Value in opt.h for SYS_LIGHTWEIGHT_PROT: 1 -----*/
Hi,I'm using the STM32H743, with TLV320AIC3254 audio codec to send and receive audio using the SAI peripheral in I2S mode, 16 bits (extended mode, i.e 32 bit slot), master, stereo.I'm using DMA to send/receive the data, but have come across an issue where the data transmitted by the SAI seems to have the left and right data swapped. As I understand, the even samples in my buffer should be for the left channel, and the odd samples for the right channel.As a test, I have written specific values (0x0033 , 0x0088) to the first to the first two int_16 of the output buffer. And I expect to see the first sample output with FS low, then then next with FS high. However checking the data output with a logic analyzer, shows that 1. There is an initial sample that is 0, which is not in the output buffer. 2. The left and right data are swapped.I've tried changing the FS polarity, which will fix the transmitted samples, but then the received samples are swapped.I guess it could be
Hello everyone,I am looking for a solution for a CustomHID device on a STM32C071.I would like to implement a CustomHID device, with TreadX and USBX.Unfortunately I can only find examples for mice in the templates. It is a bit difficult to deduce a CustomHID from these.The tutorials I have looked at so far have not helped me either.I already have experience with the “old” USB_Device library (also CustomHID) from STM in conjunction with FreeRTOS.On the STM32C071 I already got TreadX to work, but when I try to implement CustomHID, nothing works anymore.Unfortunately I can't find any information on what to look out for when implementing a CustomHID on an STM.Does anyone have any idea where I can find information on this problem?A tutorial would be great, but I haven't found one yet.Greetings Greg
Hello,I am just trying to compile the example project GPIO_IOToogle_FSBL by using the STM32CubeIDE and firmware with its patch STM32Cube_FW_N6_V1.1.0.zip (i.e., en.stm32cuben6-v1-1-1 (patch).zip) and after following the instructions per "UM3249 - User Manual - Getting started with STM32CubeN6 for STM32N6 series" when I attempt to compile I started getting these errors: 08:42:09 **** Incremental Build of configuration Debug for project GPIO_IOToggle_FSBL ****make -j16 allarm-none-eabi-gcc "D:/ST/SW/STM32Cube_FW_N6_V1.1.0/Drivers/STM32N6xx_HAL_Driver/Src/stm32n6xx_hal.c" -std=gnu11 -g3 -DDEBUG -DUSE_HAL_DRIVER -DSTM32N657xx -c -I../../../FSBL/Inc -I../../../../../../../../Drivers/STM32N6xx_HAL_Driver/Inc -I../../../../../../../../Drivers/CMSIS/Device/ST/STM32N6xx/Include -I../../../../../../../../Drivers/STM32N6xx_HAL_Driver/Inc/Legacy -I../../../../../../../../Drivers/CMSIS/Include -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -mcmse -MMD -MP
Greetings, I am using a Discovery Kit (B-U585I-IOT02A) and I want to use the LPTIM1 to wait 5 seconds (counting x ticks), at the end of the 5 seconds enter in a Callback to do something and then restart the counter again.I want to use as clock source the 32.768Khz crystal (LSE). So, I configured the LSE clock in the RCC section of the .ioc, then I set the LSE as clock source for LPTIM1, and activated the interrupts. At the main function, I used the HAL_LPTIM_TimeOut_Start_IT(&hlptim1, 16383) and used the void HAL_LPTIM_AutoReloadMatchCallback (LPTIM_HandleTypeDef* hlptim) callback to do something. The callback is not being called, I measured the signal at the crystal, and I can't see any clock in it. I guess something's missing in the configuration but I have no clue what it is and I can't make it work. An helping hand would be appreciated.
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.