Developer support experience survey - We value your feedback
Ask questions and find answers on STM32Cube packages, including HAL, LL and middleware, and expansion software.
Most recent activity
Hello, I am using an STM32U375RETQ6 (512 KB Flash) and I am trying to erase and program the internal Flash using the STM32 HAL. Environmentborad: customboradDevice: STM32U375RETQ6STM32CubeIDE generated project(Ver2.2.0)debugger: j-linkTrustZone disabled (TZEN = 0)Dual Bank enabled (DUALBANK = 1)Flash size confirmed as 512 KB (FLASHSIZE_BASE = 512)Voltage Scaling: Range 1Flash Latency: 3 Wait StatesEPOD Booster enabledMPU enabled, but no Flash region is configuredICACHE disabled during Flash operations Flash layout Since this device has 512 KB Flash and Dual Bank is enabled: Bank1: 0x08000000 - 0x0803FFFFBank2: 0x08040000 - 0x0807FFFF Target programming address: C0x0807C000 which belongs to Bank2. Erase operation Flash erase completes successfully. After erase, memory contents are correctly read back as: 0x0807C000 : FFFFFFFF FFFFFFFF ... HAL_FLASHEx_Erase() returns HAL_OK. No Flash error flags are reported. Program operation Programming fails inside the HAL function. Call: CHAL_FLASH_P
Hello ST Community & ST Engineers, I am building a field Over-The-Air (OTA) firmware update system on the STM32H7S78-DK discovery board. The system uses an ESP32 connected over high-speed UART to transfer the updated firmware binary (2.4MB containing the application and TouchGFX GUI assets). Because the STM32H7S7 is a BootFlash MCU with only 64 KB internal flash and executes the application from the external 128 MB Octo-SPI NOR Flash there is no direct out-of-the-box dual-bank OTA example in the STM32Cube_FW_H7S7 package for this board. Background Streaming while TouchGFX is Active: The running application Appli receives 1024-byte chunks from the ESP32 over UART and stages the full 2.4 MB binary directly into external Hexa-SPI PSRAM at (on XSPI1).Note : Since the binary file i use is only 2.4MB is use PSRAM to store it but actually i wanted to do in NOR flash since the excepted binary is around 40-50MB(so PSRAM can’t be used in final application binary file). Safety In
I’m trying to get two threads running, one that changes audio volume based on a rotary encoder input and one that actually pipes the music to the speaker. I am able to get both working independently with good audio on the audio thread, but I cannot get BOTH threads to work at the same time. I’ve been tweaking the thread priority, preemption priority, time slice/no time slice, and thread sleep parameters (the sleep not being a parameter but just a tx_thread_sleep() call and the end of the thread while loop). My last iteration had the following params and still didnt work:Volume thread:Priority: 16 Preempt: 0 Time slice: 1 sleep: 100USB Audio thread:Priority 15 Preempt: 15 Time slice: 200 sleep: 1 Would love to get direction in getting BOTH working with clear audio.
The function comment of HAL_ADCEx_MultiModeStop_DMA() states "Multimode is kept enabled after this function" (in stm32f1xx_hal_adc_ex.c, line 792).However, in the F1 implementation (stm32f1xx_hal_adc_ex.c, line 841) the function actively executes:CLEAR_BIT(hadc->Instance->CR1, ADC_CR1_DUALMOD);which is misleading.So, on STM32F1 the dual ADC mode is silently lost on every stop using HAL_ADCEx_MultiModeStop_DMA(). Users should call HAL_ADCEx_MultiModeConfigChannel() every time before the next start, or the buffer of ADC won’t receive any data on the high 16 bits.Suggestion: update the F1 header comment to state that DUALMOD is cleared and must be re-configured, or align the F1 implementation with its comment (keep DUALMOD, disable multimode only via HAL_ADC_ReInit).Happy to provide a minimal reproducer.
Transitioning a working FreeRTOS project over to CMSIS_os2. Got most of the bits and pieces to compile. It’s not working (surprise).At the simplest level, the patch of code that turns on an LED, then calls osDelay does not delay. investigating the problem using vTaskDelayUntil (and bypassing the CMSIS_OS2 wrapper for this one call to eliminate the possibility that the error is in how the cmsis_os2 routine is somehow wrong), the problem is that the xTickCount never increments. (HAL TICK works and increments).This triggers an error routine because the new timetowake is computed as less that the existing time. Therefore, no delays.Going through error reports suggests that the TickCount interrupt never triggers. This seems to be true.My thought is that the default priorities that are assigned are wrong, so in cmsis, which assigns interrupt priorities, is getting it wrong. The main task is at priority 24 (PriorityNormal). Tasks created for LED blinking are set at priority 26 and u
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. Hello, I ran into a very strange problem with a STM32H743 that I don't understand. I have the following config sequence: MX_ADC1_Init() -> generated by CubeMX MX_ADC2_Int() -> generated by CubeMX HAL_ADCEx_Calibration_Start(&hadc1, ADC_CALIB_OFFSET_LINEARITY, ADC_SINGLE_ENDED) HAL_ADCEx_Calibration_Start(&hadc2, ADC_CALIB_OFFSET_LINEARITY, ADC_SINGLE_ENDED) The MX_ADC1_Init() contains the following generated code: multimode.Mode = ADC_DUALMODE_REGSIMULT; multimode.DualModeData = ADC_DUALMODEDATAFORMAT_DISABLED; multimode.TwoSamplingDelay = ADC_TWOSAMPLINGDELAY_1CYCLE; if (HAL_ADCEx_MultiModeConfigChannel(&hadc1, &multimode) != HAL_OK) { Error_Handler(); } This worked without a problem on all my boards so far and I was able
I have an application that uses internal flash for logging. Unfortunately, after exiting stop3 subsequent writes to flash fail. Here’s my exit code -- the names of the routines should give a general idea. I don’t really have a clue what changed and the reference manual is notably sparse on details about the various stop/standby/shutdown modes SET_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SLEEPDEEP_Msk)); __DSB(); __WFI(); __ISB(); CLEAR_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SLEEPDEEP_Msk)); PWR->APCR &= ~PWR_APCR_APC; palSetLine(LINE_testpin); chSysLock(); tagPowerRestoreClocksAfterStop3(); tagPowerPostStop3WakeEventI(); chSysUnlock(); // Ensure Flash is awake and not stuck in low-power mode FLASH->ACR &= ~(FLASH_ACR_SLEEP_PD); __DSB();
Hello,I’m encountering an issue with the STM32H743VIT6 and the latest STM32H7 HAL driver.When using LPUART1 with USE_FULL_ASSERT enabled, the initialization code generated by STM32CubeMX triggers an assertion in:HAL_UARTEx_SetTxFifoThreshold()The assertion is:assert_param(IS_UART_FIFO_INSTANCE(huart->Instance));The problem is that LPUART1 is missing from the IS_UART_FIFO_INSTANCE() macro, although it is documented as supporting TX and RX FIFOs.Interestingly, this exact issue was already reported in March 2023:Previous discussionAt that time, ST representatives indicated that the issue was being investigated and that a support case had been opened.However, the issue still appears to be present in the latest HAL driver.Could someone from ST confirm whether this is a known issue and whether a fix is planned?It seems that simply adding LPUART1 to IS_UART_FIFO_INSTANCE() would solve the problem.For comparison, I checked the STM32G4 HAL driver (STM32G474RE), and LPUART1 is correctly inclu
My STM32H743 application runs from internal Flash, with some code and data in external NOR via FMC. It runs stably for days without NOR issues, but after repeated external resets the board eventually becomes silent and will not recover with an MCU reset; power-cycling restores it. HAL_NOR_Init() has writes disabled, and captured pre-FMC pin levels were unchanged. What should I check to identify whether FMC/NOR initialization, access sequencing, or reset behavior causes the hang?
On STM32F7 OTG_HS with an external ULPI PHY, is there a supported way for firmware to issue an ULPI Extended Register Read/Write transaction?The required ULPI sequences are:Extended read: TX CMD 0xEF extended address byte read returned dataExtended write: TX CMD 0xAF extended address byte data byteThe undocumented PHYCR viewport at USB_OTG_HS + 0x34 used by STM32CubeF7 only appears to support ordinary single register accesses. Can PHYCR issue an extended ULPI transaction?Thanks,Alex
After I configure EP1 to the double‑buffered mode, debugging reveals an issue inside stm32g4xx_hal_pcd.c. At line 1761, the endpoint register value is read. After executing PCD_CLEAR_TX_EP_CTR(hpcd->Instance, epindex); to clear the interrupt flag, the actual register content has already been updated. However at line‑1906, (void)HAL_PCD_EP_DB_Transmit(hpcd, ep, wEPVal); still receives the register value captured before interrupt‑flag clearing. This triggers incorrect conditional judgements inside the HAL_PCD_EP_DB_Transmit() function.Probable root‑cause: When transmitting data for the first time under double‑buffered setup, USB_EPStartXfer populates both buffers by default. After Buffer‑0 finishes transmission and triggers an interrupt, the program reads register data at line‑1761 of stm32g4xx_hal_pcd.c. Right after this read operation, Buffer‑1 also completes its transmission and updates the endpoint register. Since HAL_PCD_EP_DB_Transmit uses the stale register value obtained earli
Is there a STM32N6 throughput test on the USB 2-480Mb happened. I'm just curious because i'm getting a throughput on my design of * 97 Mb Just wondering what is a idealistic throughput to see if i need to edit something on my end or this is a expected throughput to get.
Hello, I am working on one customized DFU on my controller, the procedure is working now. I can jump to application without touch user button, and the procedure will go to DFU mode when user button is pressed. However, when I am DFU mode, I open stm32 programmer, the programmer has detected DFU mode on USB OTG, but when I try to connect controller, I got the following screen: when I check “reading unprotection”, I got the following screen shot: also I got programmer log and I attached this post aswell. I saw some other posted talked this issue 2 years ago, does this issue fix? I still need slow hub between controller and pc? thanks a lot
Greetings all,This is my first go around with a USB microphone with the AL94 Composite USB library. Currently I have the device enumerating as a USB audio device, which I can select and use via an application such as Sound Recorder on Windows. Additionally, the SOF interrupt is firing, the USB link is active, the descriptors are accepted, and the endpoint is armed. However, no data is ever transmitted, despite data being fed into the USBD_AUDIO_MIC_Data_Transfer function. I am not entirely sure what else to do here, any guidance would be appreciated.Thanks!Edit #1 10:29:2026 7:31 AM - Added link to repository being used:https://github.com/alambe94/I-CUBE-USBD-Composite /* AUDIO Class Config */#define AUDIO_MIC_CHANNELS 0x01#define AUDIO_MIC_SMPL_FREQ 16000U#define USBD_AUDIO_MIC_CONFIG_DESC_SIZE (116 + AUDIO_MIC_CHANNELS)#define AUDIO_MIC_VOL_MIN 0xDBE0#define AUDIO_MIC_VOL_RE
I believe I’ve encountered an Issue with the current version of the STM32 HAL2 and wanted to raise an issue, but I’m not sure where best to raise the issue.The one of the new features in the new HAL2 hash is that HAL_HASH_Update can handle input sizes that don’t perfectly line up with the block size, using HASH_SaveRemainingBytes to save any excess bytes at the end of a call and then calling HASH_AppendLastIncompleteWord at the next call to write those excess bytes to peripheral along with using some bytes from the new buffer to bulk it up to 4. This means that I can write something like: (where the buffer is 163 bytes long)HAL_HASH_Update(&hhash, &u8InputBuffer[0], 10,0xFFFF);HAL_HASH_Update(&hhash, &u8InputBuffer[10], 10,0xFFFF);HAL_HASH_Update(&hhash, &u8InputBuffer[20], 1,0xFFFF);HAL_HASH_Update(&hhash, &u8InputBuffer[21], 62,0xFFFF);HAL_HASH_Update(&hhash, &u8InputBuffer[83], 7,0xFFFF);HAL_HASH_Update(&hhash, &u8InputBuffer[90], 73,0
Not using calibration rotinesADC output not using calibration routines (ADC pins are differential and are shorted)VS using them:MX_GPIO_Init();MX_DMA_Init();MX_ADC1_Init();MX_ADC2_Init();MX_TIM15_Init();MX_TIM6_Init();/* USER CODE BEGIN 2 */// 1. Initialize Profiler hardwareprofiler_init();profiler_reset(&g_isr_profiler);setupRecorder();// HAL_ADCEx_LinearCalibration_FactorLoad(&hadc1);// HAL_ADCEx_LinearCalibration_FactorLoad(&hadc2);if (HAL_ADCEx_Calibration_Start(&hadc1, ADC_CALIB_OFFSET_LINEARITY, ADC_DIFFERENTIAL_ENDED) != HAL_OK)Error_Handler();if (HAL_ADCEx_Calibration_Start(&hadc2, ADC_CALIB_OFFSET_LINEARITY, ADC_DIFFERENTIAL_ENDED) != HAL_OK)Error_Handler();ADC output with adc calibration (pins are shorted in differential mode)As you can see the HAL library calibration made it worth instead of healing it.Then what is the right solution to calibrate? What is the problem here? I’ve used linear and offset only both introduced jumping on the short circuited sig
From what i've seen the Rust programming language is becoming more and more popular and since it does not rely on a virtual machine, like java or python, it could be a good option for embedded development and other low-level programs. I know that there are ways to get Rust on STM32 MCUs running, but without official support its really hard to start a series project using those tools. At this point i see it as something fun to try out and benchmark and compare with a traditional C program + FreeRTOS.Does anyone know if there are any official plans from ST to have a Rust wrapper on the existing C HAL or a complete ground-up Rust HAL? Maybe support in CubeIDE for both C and Rust?
I have built up a project using FreeRTOS and STM32_WPAN on an STM32WB55M. It also implements the VBAT for the RTC and uses the EXTI0 and EXTI1 interrupts.The problem I’m having is that as soon as MX_GPIO_Init() completes an interrupt is generated, but the supporting FreeRTOS queues have not yet been defined and the program just hangs.My presumption was that on a reset (restart in the debugger) interrupts were disabled, but what I’m seeing doesn’t support this.What have I missed?
I want to generate an SBOM (Software Bill of Materials) for my STM32 firmware project, specifically targeting the STM32H733 microcontroller. I have tried searching for guides or examples of how others have done this for similar projects, but I haven’t been able to find any detailed resources. Any guidance or references on generating an SBOM for my firmware project would be greatly appreciated.
I am working with NUCLEO-H563ZI. We started with threadX. Out of ignorance, I used LwIP because I knew of it. I got it installed and found out it works with FreeRTOS, not threadX, and I should be using NetX. New Project time. Generate Code with ThreadX and NetX. I see all my files, the standard files and app_threadx files. I see a NetXDuo folder, but I see no netx files in the Core folder to connect up ThreadX and NetX. NetX files compile (and my compiles now take more than 40 second to compile), but there is no connection between main.c or app_threadx.c and netx. Is there a step-by-step tutorial to use netx? I see several topics on netx but I don’t see any “How to plug in NetX” tutorials or anything similar. I am swimming in shark-infested waters, and I don’t even have a boat to avoid being eaten or drowning.Obviously, any help is appreciated. Thanks in advance for directing me to instructions.
I am working on stm32 C5A3ZG platform for one of my projects. I want to use SD card for data logging. I have working SD card module. I tried to use it with nucleo_c5a3zg board using zephyr RTOS and there infrastructure of file management that code is not working on this C5 controller which uses HAL2 driver. It works on other STM32 controllers which use HAL driver.I tried to create a project in STM32CubeMX2 but couldn’t find configuration for SDMMC over SPI which would be required to interface SD card.I checked in STM example library https://dev.st.com/stm32-example-library/result?filters=N4IgpgHghgtgDgGzAOVmEAuA2gXQDQgwDGArpliAMoAqAsgMwBMAwgKwj4gBGA9lAE4ATcpxgBLQYKQB3AemyjSAEX5iAbmH4iCvAYIAKUIgGsoAc3m4Cg1Rv7UAnnEs4AvkA but was not able to find any sample or SD card.Can someone provide a sample code to me otherwise i have to look for potentially changing the platform and move to some other controller.
Hi everyone,I want to read data from an SPI slave using SPI3 while the MCU is in STOP2 mode.The communication protocol requires me to transmit a command before receiving the response.I configured LPBAM according to the following YouTube tutorial, and my CubeMX/LPBAM configuration is shown in the attached screenshots.My observations are:If I use only the “Transmit Data” node, everything works correctly. If I add a “Receive Data” node after the transmit node, the SPI transaction stops when it reaches the receive node. However, the “LPTIM1_CH1” output continues to generate trigger signals. If I replace them with a single “Transmit Receive Data” node, neither SPI nor LPTIM1_CH1 works.Could you please explain what might be causing this behavior? Is there any additional configuration required to use the “Transmit Receive Data” node in LPBAM with SPI3 in STOP2 mode?Thank you.
There are still some typos to fix in the migration docum. for instance:"Atomic" API names - change to "unitary" as was agreedPACKET - > PACKED
Hi, I'm following the "Programming guidelines for IEEE 1588 timestamping" from page 2792 of the RM0481. I've been working on this specifically for quite a while and I cannot even get the timestamp nanosecond or second registers to move. It feels to me like a clock issue, but unless I'm mistaken, the PTP clock (clk_ptp_ref_i from the manual(p.456)) is the same as the ETH clock (PLL1Q), which I've verified is running because I'm successfully using NetXDuo to negotiate DHCP and send/receive UDP packets successfully. I've also tried initializing the PTP Timestamp without NetXDuo just in case there was some conflict there, but that was also unsuccessful. Here is my initialization code: /*1. Mask the Timestamp Trigger interrupt by clearing bit 12 of Interrupt enable register(ETH_MACIER).*/ ETH->MACIER &= ~(ETH_MACIER_TSIE); PRINT_U32_BINARY(ETH->MACIER); // 2. Set bit 0 of Timestamp control Register (ETH_MACTSCR) to enable // timestamping. ETH->MACTSCR |= ETH_MACT
I have a bunch of following warnings:c:/programs/ARMtools/EmbeddedBSPs/arm-eabi/com.sysprogs.arm.stm32/STM32F1xxxx/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h: In function 'void LL_GPIO_SetPinMode(GPIO_TypeDef*, uint32_t, uint32_t)': c:/programs/ARMtools/EmbeddedBSPs/arm-eabi/com.sysprogs.arm.stm32/STM32F1xxxx/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h:343:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister] 343 | register uint32_t *pReg = (uint32_t *)((uint32_t)((uint32_t)(&GPIOx->CRL) + (Pin >> 24))); |in several LL headers.Can this please be fixed in some suitable way? One way to do that might be to replace the 'register' specifier by a macro, which would be defined based on the __cplusplus standard preprocessor macro and its value. A simple version would be to add#if __cplusplus >= 201703L #define register #endifto each header where this occurs, but I am not a C++/build-environment specialist so don't know whether thi
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.