Ask questions and find answers on STM32Cube packages, including HAL, LL and middleware, and expansion software.
Most recent activity
I'm using the STM32F401RE in a new design and trying connect the USB CDC device interface to FreeRTOS_CLI. I modified its _write function to call CDC_Transmit_FS, but I don't see a received data callback where I can add a xTaskNotifyFromISRfor to send data to the CLI task.It looks like I call CDC_Receive_FS to get the data, but I need an interrupt to trigger the call to that function. Where can I hook in a callback function?
Hello,I am developing an embedded project using the STM32H7 microcontroller, integrating FreeRTOS, FatFs file system, USB mass storage device (USB flash drive) functionality, SD card reading/writing,UART communication, and ADC sampling. My system uses LVGL as the graphical user interface (GUI) library and drives the LCD through LTDC.Core issue phenomenon:I observed that the system's functional behavior has a direct and consistent correlation with the on/off state of the LVGL screen:DISPLAY_ENABLE is a macro definition I created to control whether to use the screen.When the screen is off (DISPLAY_ENABLE = 0):All functional modules (USB mass storage mounting and writing, UART communication, ADC sampling, SD card reading/writing, database operations) work normally.When the screen is on (DISPLAY_ENABLE = 1), two different phenomena occur:Phenomenon 1: When test buffers (writeBuffer/readBuffer, 512 bytes each) are located in the data segment:USB mass storage device fails to mount (output lo
Hello there, I'm using a STM32G431KBU and programming it using STM32 Cube IDE.There are 2 pins, PB4 and PB6, both digital inputs, I'm having problem with. On both, I apply 5V with a 10K pull-up resistor, while the MCU is working is at 3V3, this should work fine, as both are five-volts tolerant (FT), as per datasheet. When connected to the pull-up resistor, the voltage on the pin drops to 1V7 - 1V6, while there is 3V3 on the pull-up resistor. It looks like there is a pull-down resistor configured on these pins, and according to the DS, these pull-down resistors are controlled by the level on PA9 and PA10:I've tried to disable these before GPIO init, but it did not work:Any recommendations on how to properly disable these internal pull-down resistors on PB4 and PB6?
Hello ST Community,I'm working on an STM32N6570-DK project where I've merged two example codes from the STM32CubeN6 repository:1 . DCMIPP_ContinuousModehttps://github.com/STMicroelectronics/STM32CubeN6/tree/main/Projects/STM32N6570-DK/Applications/DCMIPP/DCMIPP_ContinuousMode Used for capturing data from the IMX335 camera and displaying it on LTDC.2 . Nx_WebServerhttps://github.com/STMicroelectronics/STM32CubeN6/tree/main/Projects/STM32N6570-DK/Applications/NetXDuo/Nx_WebServerModified to set a static IP and transmit packets over Ethernet and not using the SD card part and FileX.The merged code compiles successfully in STM32CubeIDE. I've attached a ZIP file containing the full merged project for reference.Initially, I used the linker script (STM32N6XX_AXISRAM2_fsbl.ld) , which allocates 512KB of RAM (255K + 256K) and manages Ethernet buffers, I attached .txt file named WORKING.Camera image is visible on the LCD.Ethernet packets (with static data) are sent at ~900
Hi, just looking to learn the best way to do this. We're aiming to create a system for STM32H7R/S where the bootloader acts as USB MSC device to store a number of different app binaries to a permanently-mounted SD card. At system restart, the booloader needs to let the user chose which of the binaries to load from the SD card (the system has a small touch screen). The bootloader would then load the binary from the SD card into the fast internal RAM and run it there. Is the External Memory Loader a good way to do this? Is this use case supported by CubeMX? Is there a good set of examples or "howto" documents?
Today I bought a new NUCLEO-H563ZI board and downloaded the STM32CubeH5 main software package from www.st.com. But when I compile the example "STM32CubeH5 main \ Projects \ NUCLEO-H563ZI \ Applications \ NetXDuo \ Nx_UDP_Cho_Server" with IAR, it prompts that some files is missing. I had to download the missing files from elsewhere and put them in. Finally, the compilation passed, but after burning the out file into the board, the program could not run properly. After debugging, it was found that there was a DMA error in the Ethernet. I changed an other example to compile, burn, and debug. the same mistake. I don't know how to solve it. By the way the net cable and the led of the ethnet socket CN14 is ok. Can ST provide a complete examples package for the NUCLEO-H563ZI board? Title edited by ST moderator to reflect the content of the post.
I did not understand the significance of the number 65536 in the below codepHandle->OvfFreq = (uint16_t)(pHandle->TIMClockFreq / 65536U); /* Set fixed to 150 ms */ pHandle->HallTimeout = 150U; /* Compute the prescaler to the closet value of the TimeOut (in mS )*/ pHandle->HALLMaxRatio = (pHandle->HallTimeout * pHandle->OvfFreq) / 1000U ; /* Align MaxPeriod to a multiple of Overflow.*/ pHandle->MaxPeriod = pHandle->HALLMaxRatio * 65536UL;My main confusion is how the OvfFreq with division of 65536 help the code to reduce the calculations. According to my understanding if TIMClockFreq = 170MHz then the time is T = 1/170Mhz i get overflow after 65535, so if the number of overflows are OverflowCnt then the total time elapsed will be 65535*1/170MHz*OverflowCnt + Input capture timer registers.
I adapted the official BSP example code (available at https://www.st.com/en/embedded-software/stm32cubeu5.html, stm32cubeu5-v1-8-0.zip) to acquire and process audio. My code is running very slowly on the board. We thought the slowdown might be due to other features enabled by default that I don’t need. Therefore, I created a project from scratch, enabling only the pins I need, but I’m doing something wrong with the GPDMA1 and MDF1/ADF1 filter configuration (even callbacks don't work). Could you provide an example .ioc file with the integrated microphone configured correctly (with GPDMA1) or, alternatively, the BSP .ioc project itself (which is not included in the official example you provide)? Thank you.
Hi, My board consists of stm32h733 that interfaces SDRAM via FMC. I want to execute code from SDRAM. Code is loaded from external flash(OCTOSPI) to SDRAM at address 0xc0700000.But running the code from this region causes hard-fault disabling the Debug Port. After this I'm unable to flash firmware into the hardware. I have to bring board into "connection under reset" by connecting BOOT0 to 3.3v and NRST to GND. I have tried with multiple test firmware but always got into hard-fault. Why MCU disables, it's debug port? While debugging in the disassembly I can execute firmware running from SDRAM one by one line, but at some point code hard-fault, causing it to stuck into the above told situation. Here is the MPU config for SDRAM; /* Configure the MPU attributes for SDRAM */ MPU_InitStruct.Enable = MPU_REGION_ENABLE; MPU_InitStruct.BaseAddress = 0xC0000000; // Start address of SDRAM Bank 1 MPU_InitStruct.Size = MPU_REGION_SIZE_8MB; MPU_InitStruct.AccessPermission = MPU_REGION_FULL_ACCESS; M
Hello, I am developing a custom made PCB, for a pico balloon, mounting a STM32F103C8T6. For this project I will need to use low power techniques but before going deep into the Sleep/Standby/Stop mode I was working on understanding and reducing the power consumption of the STM32 during RUN mode. For these tests, the STM32 has only the decoupling caps in the VDD, VBAT and VDDA pins, and the rest of the PCB are left unpopulated to ensure the current consumption comes only from the STM32.I reduced the code to the minimum by just setting the Clock configuration for 8 MHz (directly from HSI, PLL and LSI off) , setting all the GPIO to INPUT + PULLDOWN + Set to RESET, configure 1 GPIO as output + set to RESET, and then wait forever in a while(1) loop.The problem is that, when I compile the project without optimization "-O0" the STM32 consumes 9 mA, however when I set the "-O1" flag the same code runs at 2 mA. In the "-O1" compilation if, instead of an empty while I have a "HAL_Delay(
Hello, I have made my own STM32F732RET6 board that has a USB FS configured as a Stereo, 24 bit 48kHz Audio Interface and SAI2 connected to an SN75176BDR (Differential Bus Transceiver IC) because I want to transmit AES3-AES/EBU (same as SPDIF) audio data coming from the USB). So USB Audio -> SPDIF TX. Problem is I cannot get it to work right and ALWAYS get noise in the output signal (I have hardware that can receive AES3-AES/EBU so I can hear it). I am suspecting this is a clock issue where the frequency of the SPDIF signal is not high enough to support 24 bit stereo 48kHz, from what I've read, this would require an SPDIF frequency of 6.144MHz. I don't know if "Real Audio Frequency" in the .ioc "Pinout & Configuration" on SAI2 should match this number (6.144MHz) or the Audio Sampling Frequency (48kHz). I cannot get "Real Audio Frequency" to be exactly 6.144MHz. I don't know if this should be the frequency the the SAI2 Clock Mux outputs (SAI2 Clock Mux sources from PLLSA
Hi, I'm trying to get a few lines of text displayed on an OLED screen using 4-wire SPI on an STM32H755 board, but I haven't succeeded yet. I've looked into the sample code provided by the manufacturer (which is Arduino-based), but it hasn’t helped much so far. Has anyone worked with this display or with the SSD1322 controller before? I’m mainly looking for example code for the STM32 platform.I’ll be uploading my current progress to my GitHub repo. Thanks in advance!
So I want to use a capture compare to measure an input frequency 0.1Hz to 100kHz. Peripheral clock is set to 32MHz to cover full range and maximise speed of calculations. At lower frequency I have to count the number of times the over capture call-back is called, to put into the calculation. However there are a few frequencies where the over capture and edge detection IRQs have a beating effect, I have delt with this on other processors by ensuring the order IRQs are delt with but it doesn't seem to be working here.Sometimes the last over capture is called first, other times in is not, leading to a large jump in my calculated result. As anyone any experience with this issue on the STM32 TIM peripherals?/****************************************************************************** Function : Calculate_Frequency Return : Frequency post calculation as a float *****************************************************************************/ #define TIMCLOCK 32000000.00 //System clock value
Hello,Sorry if it's a *** question but I don't understand something.I want to have an HID and MassStorage usb device. I've seen that ST add USE_USBD_COMPOSITE but I don't understand why we use it for USBD_ClassTypeDef.For me, we have 1 device desc + 1 config desc with 2 interfaces, it's not enough to have only 1 class (with init, setup, dataIn, dataOut, getHsDesc) and put 2 registerInterface in MX_USB_DEVICE_Init and an if(epnum == HidEp) else if(epnum == MscEp) in dataIn and dataOut ?I think I missing something.Thank you for your answer.
Hello,I am experiencing an issue with LwIP on the NUCLEO-F746ZH board. I am using STM32CubeIDE 1.14.0 with the STM32F7 firmware package v1.17.3 (I also tried v1.17.0 and the latest CubeIDE version, but the errors still persist).In the screenshots I shared, you can see my LWIP, ETH, FreeRTOS, and Cortex MPU settings. With these settings, I expect to be able to ping without adding any extra code, but unfortunately I encounter problems in the lwip_init function.This issue has been mentioned before in the forums: when I configure the MPU as suggested (example file attached), the first configASSERT hits a breakpoint. If I try without any MPU configuration, it stops at the second configASSERT (as shown in the screenshot).I tried many approaches but couldn’t solve it. Without RTOS, there is no problem and ping works fine, but with RTOS I face an issue related to semaphores. At this point, I am not sure what I am missing. I also attached my FreeRTOSConfig file.Interestingly, the LWIP_HTTP_Serv
This is a line of code i don't understand, /* Force the TIMx prescaler with immediate access (gen update event) */ LL_TIM_SetPrescaler(TIMx, pHandle->HALLMaxRatio); LL_TIM_GenerateEvent_UPDATE(TIMx);The code is part of the __weak void HALL_Init(HALL_Handle_t *pHandle) functionwhen the second line of code is executed does it mean that i get the interrupt timer over flow interrupt immediately. Please clarify. The TIM4 is configured in XOR / Hall mode.
Hi everyone,I’m working on an STM32U3 project and ran into an issue where flash erase was failing with error code 0x00000080 on page erase, even though the option bytes and addresses appeared correct.After debugging, I found that explicitly setting the voltage scaling to PWR_REGULATOR_VOLTAGE_SCALE1 before flash erase resolved the issue. The working sequence I use is: HAL_FLASH_Unlock(); HAL_StatusTypeDef status = HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE1); if(status != HAL_OK) { return status; } EraseInitStruct.TypeErase = FLASH_TYPEERASE_PAGES; EraseInitStruct.Banks = BankNumber; EraseInitStruct.Page = FirstPage; EraseInitStruct.NbPages = NbOfPages; if (HAL_FLASHEx_Erase(&EraseInitStruct, &PageError) != HAL_OK) { return status; }This step wasn’t required on my Nucleo board but was essential on my custom hardware.My questions now are:Is it safe and recommended to keep the voltage scaling at SCALE1 permanently after flash erase, or sh
Howdy;I have a li'l stm32u031, with a pushbutton attached to PA0. This MCU is clocked with no external oscillators. I've configured the button/pin to work with Timer2/Channel1 in Input Capture mode when the MCU is in run mode, to detect and measure button presses. This works swell. I'd like to be able to put this device into STOP2 mode, and be able to re-awaken it with the button. My understanding is that I'd do this by de-initing it as an alt function pin, and re-initing it for EXTI. At the moment, I'm doing this: // Stop all timer channels HAL_TIM_IC_Stop_IT(&htim2, TIM_CHANNEL_1); HAL_TIM_OC_Stop_IT(&htim2, TIM_CHANNEL_2); HAL_TIM_OC_Stop_IT(&htim2, TIM_CHANNEL_3); // Stop the timer itself HAL_TIM_Base_Stop(&htim2); // Mask any stray interrupts and clear latched flags __HAL_TIM_DISABLE_IT(&htim2, TIM_IT_UPDATE | TIM_IT_CC1 | TIM_IT_CC2 | TIM_IT_CC3 | TIM_IT_CC4); __HAL_TIM_CLEAR_FLAG(&htim2, TIM_FLAG_UPDATE | TIM_FLAG_CC1 | TIM_FLAG_C
Hello,I'm just a begginer with embedded and STM32 so bare with me please.I was trying to follow a program tutorial to periodically blink an LED using a timer channel in PWM generation mode. I have an STM32 Nucleo h755zi-q board, I set the integrated LED on pin PB0 to it's alternate function which is timer 3 channel 3, I assigned timer 3 to core C7 turned on internal clock as source and set channel 3 to PWM generation. I used different setups but for example 200 Mhz on the clock, prescaler 19999, autoreload 9999, pulse 5000. I left everything else as default and generated the code and only added this line"HAL_TIM_PWM_Start(&htim3, TIM_CHANNEL_3);"right before the infinite loop in the main function. This should make the user LED on pin PB0 blink periodically with 1 Hz frequency I think. But the LED isn't doing anything at all.I'm using CubeIDE obviously and using just a basic timer with interrupt works flawlessly, so where is the mistake?Sorry for low details, I'm currently in a rush
I'm developing camera-related things on the N6, and while perusing the JPEG encoder, I noticed that the datsheet and registers for it seem to indicate it can convert raw RGB (565? 888?) to JPEG. This is alongside Grayscale, YUV, and CMYK. However, in the HAL driver, there only seem to be defines and code around the last three. There are defines and support for Greyscale, YCbCr (which I assume to be YUV from the datasheet? But that is also confusing), and for CMYK. But there is little to no reference at all of the RGB options in the JPEG encoder. Is this functionality not supported? Am I missing something? Is it a bug in the firmware? While I'm on the subject, am I able to pump the YUV420 planar from the DCMIPP into the JPEG Encoder? The datasheet suggests I can but all examples and information I canf ind online suggests I need to convert it to YCbCr first, but I thought they were the same? Thanks for Support
Want to incorporate LwIP_UDP_Echo_Server example code for NUCELO-H723ZG with another project which has ADC, DMA, and timer system setup for sampling data. Issue is there is no .ioc file for the example code and when trying to look into the code manually for the parameters to feed into cubeMX when trying to configure a new project, there was some values that were missing, and some that were showing up as invalid (even though when testing the example code it was working fine). A bit lost and have been spending a lot of time trying to identify how to go about this. Any help on this would be appreciated.
Hi,I have a lwIP implementation running on an STM32H723 using a CubeMX HAL implementation, so no OS-like stuff involved. In case of heavy outgoing traffic, it seems it is running low on memory at some point. This is not dramatic as tcp_write() knows an error-code ERR_MEM which would give the possibility to deal with that situation.Unfortunately it seems this error code is not used here. Instead of that, the system dies and ends up in HardFault_Handler() via following stacktrace:HardFault_Handler() at stm32h7xx_it.c:85 0x8002f04 <signal handler called>() at 0xffffffe9 mem_malloc() at mem.c:934 0x800d7fe pbuf_alloc() at pbuf.c:284 0x800e348 tcp_pbuf_prealloc() at tcp_out.c:263 0x801299a tcp_write() at tcp_out.c:610 0x8012e48 So...how can I change that? What do I have to do to let tcp_write() return with a proper error code instead of letting the whole system crash?Thanks!
I am using the Nucleo STM32U385rq development boards to create an I3C controller and a I3C target.I have the following scenario working:1) Controller assigns dynamic addresses.2) Target sends an in-band interrupt.3) Controller acknowledges the in-band interrupt.4) Target calls HAL_I3C_Tgt_Receive_IT with a size of 16 bytes.5) Controller calls HAL_I3C_Ctrl_Transmit_IT with a size of 16 bytes.6) After the controller received notification of the transmit completion, it starts a timer to do a read after a delay.6) Target receives the data and calls HAL_I3C_Tgt_Transmit_IT with a size of 16 bytes.7) Controller timer times out and calls HAL_I3C_Ctrl_Receive_IT with a size of 16 bytes.8) Target sends the data to the controller.There are a few issues with this sequence: a) There doesn't seem to be a way for the Target to be setup to handle a read or write at any time. The Target has to explicitly setup for one or the other and there are times where neither is se
Hello, I am working on a low-power STM32 system. In my original configuration I was running the core at 32 MHz (PLL from HSI16) with Voltage Scaling 1, and in this setup USB CDC worked without any issues. To reduce power consumption, I reconfigured the system to run the core at 16 MHz HSI (no PLL) while keeping Voltage Scaling 1. The USB clock source is HSI48. With this configuration, when connecting to a USB 3.0 host port, the device often crashes during enumeration. Sometimes it enumerates fine, but most of the time it fails. Interestingly, if I connect the device through a USB 2.0 hub, the problem does not appear. From my research, I found that: - USB 2.0 controllers are more tolerant and usually accept HSI48’s +/-1–2% drift. - USB 3.0 controllers are stricter, and if HSI48 drift exceeds +/-0.25%, CRC errors occur. This causes descriptors to get corrupted and Windows shows a crash or device not recognized. My question:What are the recommended ways to avoid this issue w
以上就是我配置的所有内容。您能指出我的配置有任何问题吗? edit (translated in English): Hello, I have configured the STM32C071KBT6 for USBX standalone mode. Attached are all the screenshots of my configuration. Could you please review and let me know if there are any issues with my configuration? Thank you.
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.