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
I've been previously programming the STM32F103C6T6 blue pill with an FTDI via UART and am now trying to flash a USB bootloader binary to program it directly via USB.I've closely followed the guide on https://www.electrosoftcloud.com/en/stm32f103-bootloader-and-programming/ - I've successfully flashed the generic_bootloader_pc_13.bin file via UART, installed the required drivers, and followed the BOOT0 pattern correctly. On connecting via USB, the board is detected as "Maple DFU" in the Device Manager.But STM32CubeProgrammer keeps showing "No DFU detected" when I try connecting via USB and pressing the refresh button.However, when I enter the PID and VID specified in the Maple DFU driver properties shown below in STM32CubeProgrammer: On refreshing and trying to connect, the error "unknown or unsupported device" is displayed:I've followed several online resources, and nobody seems to encounter this issue.Can anyone provide any insights into why this might occur?
I’m using NUCLEO STM32H753ZI.I use ST ID: STM32cudeIDEI have HardFault_Handler when call vTaskStart_Scheduler() using FreeRTOS Could you please let me know how to resolve this issue? Below is the sample code int main(void) { (void) HAL_Init(); /* Configure the system clock */ SystemClock_Config(); /* Enable the CPU Cache */ CPU_CACHE_Enable(); BaseType_t xReturned; TaskHandle_t xHandle = NULL; /* Create tasks / xReturned = xTaskCreate( Task_Code, “SB”, configMINIMAL_STACK_SIZE, (void) NULL, tskIDLE_PRIORITY+2U, &xHandle ); if( xReturned == pdPASS ) { vTaskStartScheduler(); } else { } while(1);
For a project i want to save log files in the external SPI of the Stm32n6 for this is already tried to configure xspi2 and the external memory, but i am not sure if i have done it right. I also have found no source on how to continue with the Code after this maybe someone can help with this.
I successfully configured the I2S2 interface to a sample rate of 48KHz. The attached WCMCU-5102 is connected to these three wires. I2S2_WS = PA3I2S2_CK = PA5I2S2_SDO = PB1 FLT = GNDDMP = GNDSCL = GNDFMT = GND XMT = Vdd (3.3V) static void MX_I2S2_Init(void) { /* USER CODE BEGIN I2S2_Init 0 */ /* USER CODE END I2S2_Init 0 */ /* USER CODE BEGIN I2S2_Init 1 */ /* USER CODE END I2S2_Init 1 */ hi2s2.Instance = SPI2; hi2s2.Init.Mode = I2S_MODE_MASTER_TX; hi2s2.Init.Standard = I2S_STANDARD_PHILIPS; hi2s2.Init.DataFormat = I2S_DATAFORMAT_16B; hi2s2.Init.MCLKOutput = I2S_MCLKOUTPUT_DISABLE; hi2s2.Init.AudioFreq = I2S_AUDIOFREQ_48K; hi2s2.Init.CPOL = I2S_CPOL_LOW; hi2s2.Init.FirstBit = I2S_FIRSTBIT_MSB; hi2s2.Init.WSInversion = I2S_WS_INVERSION_DISABLE; hi2s2.Init.Data24BitAlignment = I2S_DATA_24BIT_ALIGNMENT_RIGHT; hi2s2.Init.MasterKeepIOState = I2S_MASTER_KEEP_IO_STATE_DISABLE; if (HAL_I2S_Init(&hi2s2) != HAL_OK) { Error_Handler(); } /* USER CODE BEGIN I2
Hi all!On an STM32 project I'm working on, I want my USB port (USB C in that case) to work either in Host Mode or in Device Mode, depending on a menu change from the user. For added context, this is for a MIDI project in which the MC will either use USB Host or USB Device as a means of communication.It appears the mode is determined by the state of Pin PA13 (SYS_JTMS_SWDIO), but I would rather do everything in software, as the USB connection will be the same (the implementation will differ between the two).Also, when I set the USB mode to OTH/Dual_Role_Device, all of the USB files are being deleted. Should I just save the files used in Host_Only and in Device_Only in another folder, or is there a cleaner way to have both implementations at the same time? If I need to code everything from scratch, I would love to have some pointers on where to begin.Thanks in advance!
Dear ST's experts,I want to send/receive data through UART between STM32 and PC. The data must be sent to PC every 500ms and then STM32 receive data from PC. I have configured UART2 with DMA in circular mode. I am using the function HAL_UART_TxCpltCallback to pause the UART (HAL_UART_DMAPause(&huart2);) to send data every 500ms. My problem is that when I use the above function, receiving data does not work properly.How I can solve the problem?Should I use DMA in normal mode for TX?
Hello,I am working with the STM32U5G9ZJT6Q MCU to implement a USB UVC application. Here are the key details of my setup:MCU: STM32U5G9ZJT6QSystem Clock: 160 MHzUSB PHY External Clock: 32 MHzData Source: DCMI captures data at 640x480 resolution in 8-bit format.USB Configuration: Isochronous transfers for UVC video streaming.The issue I am facing is that for each isochronous packet, only 30 micro packets contain valid data, while the remaining 98 micro packets (out of 128 total) are empty. This limits the overall data throughput.I would like to understand how I can increase the number of micro packets with valid data in each isochronous packet to optimize data transfer performance.Steps I have tried:Verified DCMI and DMA data reception – data appears to be received correctly.Adjusted isochronous max packet size (HS_MPS) but did not see a significant improvement.Could this be related to:USB descriptor configuration?DMA/USB buffer handling?Timing or bandwidth issues with the USB PHY or DCM
I'm looking for some guidance on using DMA with SPI. I have the M4 core on an STM32H755 set up as a master in full duplex mode, and as long as I invoke the SPI transfer using interrupts, the program runs fine. When I try to migrate to DMA, however, I note that the program is successful on the first pass only, triggering the callback, etc., but on the second time through, I always get an error, apparently because the transmit is still busy (?) I have used SPI and DMA often before without incident, but I don't know what else to check in this case. Any insights are appreciated. See the screen shots of where the code is finally failing. Line 2508 is in the HAL SPI driver C file, the point at which the driver attempts to start the DMA with IT, and the second shot shows the result of this call in the HAL DMA file, line 695. Thanks
Hi, I'm working on a STM32h747 dual core and I'm trying to put the CM4 to sleep so that it wakes up only on a CM7 event. I used _WFE on CM4 and _SEV on CM7 but the CM4 is never wake up. I release a HSEM directly after WFE in CM4 to notify the CM7 that the CM4 is awake and I never receive it. I tested the HSEM mechanism without putting the CM4 to sleep and it works well. Here the sleep procedure for the CM4 : // Disable SEVONPEND => this bit define all pending interrupt (even disabled) as event CLEAR_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SEVONPEND_Msk)); // Disable all interrups __disable_irq(); // Enter in stop mode /* Select the regulator state in STOP mode */ MODIFY_REG (PWR->CR1, PWR_CR1_LPDS, PWR_MAINREGULATOR_ON); /* Set SLEEPDEEP bit of Cortex System Control Register */ SET_BIT (SCB->SCR, SCB_SCR_SLEEPDEEP_Msk); /* Ensure that all instructions are done before entering STOP mode */ __DSB (); __ISB (); //Generate an event to clean pending events __SEV(); __WF
Hii Team, I'm using STM32G070RBT6 MCU to communicate with ADS124S06. I've configured the SPI on the MCU for Mode1 and GPIOs CS, RST, START pins as output (NO pull up/ pull down) and DRDY as input (NO pull up/ pull down). GPIO Configuration:SPI Configuartion:Clock Configuration: Code : the ADS124S06_Init function: bool ADS124S06_Init(ADS124S06_Handle *dev) { DEBUG_PRINT("Entered init Function"); // RESET pin sequence HAL_GPIO_WritePin(dev->reset_port, dev->reset_pin, GPIO_PIN_RESET); HAL_Delay(1); HAL_GPIO_WritePin(dev->reset_port, dev->reset_pin, GPIO_PIN_SET); HAL_Delay(5); ADS124S06_WriteRegister(dev, 0x02, 0x54); // I/p MUX: AIN5-AIN4 0x54 HAL_Delay(1); ADS124S06_WriteRegister(dev, 0x03, 0x00); // GAIN: PGA=1, 20SPS ADS124S06_WriteRegister(dev, 0x04, 0x14); // DataRAte : 20SPS, osc-4.096MHz HAL_Delay(1); ADS124S06_WriteRegister(dev, 0x05, 0x0A); // REF : internal 2.5V On always. ADS124S06_WriteRegister(dev, 0x06, 0x0
Hello everyone,I'm using AZURERTOS on my STM32F407 microcontroller. My goal is to use the FPU to perform some mathematical operations (FFT, etc.). Could you help me figure out how to activate the FPU and how to tell when it's active, taking into account the RTOS I'm using?- I am using STM32CUBEIDE Thank You!
STM32H523HEYX Flash Write Issue1.I’m currently working on a project using the STM32H523HEYX.I'm using STM32CubeIDE, and the firmware libraries are up to date.I’m also using STM32 X-CUBE-FREERTOS.I’m trying to write data to Flash memory using the following functions:2. HAL_FLASHEx_Erase(...);HAL_FLASH_Program(FLASH_TYPEPROGRAM_QUADWORD, ASDF, (uint32_t)&quadData[0]);However, the code triggers a HardFault when executed.3. When I run the same code on a STM32H533 Nucleo board, it works without any fault and writes to Flash successfully.4. I'm not sure why this Flash issue only occurs on the STM32H523HEYX.If anyone has experienced a similar issue or knows of any related problems, I’d appreciate your advice.Thank you, fellow developers!
Hello.I've been struggling for several weeks to fix an issue when sending data over MQTT using LwIP on an STM32F407 microcontroller.For periodic message publishing, I'm using the following code:void MqttPublishTask(void const * argument) { err_t err; while(1) { xEventGroupWaitBits(mqttSendEventGroup, pdFALSE, pdTRUE, portMAX_DELAY); if(mqtt_client_is_connected(&client)) { cJSON *root = cJSON_CreateObject(); for(uint8_t i = 0; i < (nodeID - 64); i++) { cJSON *tap_metrics = cJSON_CreateObject(); cJSON_AddNumberToObject(tap_metrics, "ER", taps[i].alarmCode); cJSON_AddNumberToObject(tap_metrics, "C", taps[i].coldWater); cJSON_AddNumberToObject(tap_metrics, "H", taps[i].hotWater); cJSON_AddNumberToObject(tap_metrics, "E", taps[i].totalEnergy); cJSON_AddNumberToObject(tap_metrics, "T", taps[i].waterFlowTime); cJSON_AddNumberToObject(tap_metrics, "N", taps[i].numberOfUses); snprintf(serialString, sizeof(serialString), "%lu", taps[i
Hello everyone,I ran into a problem. First of all, I have two tablets: one with a bootloader and another without it. Tablet without bootloader works fine so its something bad in bootloader. I’m trying to plug in and unplug the power supply, and sometimes this happens:What can cause it? I'm adding my bootloader code/* USER CODE BEGIN Header */ /** ****************************************************************************** * @file : main.c * @brief : Main program body ****************************************************************************** * @attention * * Copyright (c) 2025 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. * If no LICENSE file comes with this software, it is provided AS-IS. * ****************************************************************************** */ /* USER CODE END Header */ /* Includes -----------------------------
Hi,I'm using an STM32H7 board with a LAN8742 PHY, configured via STM32CubeMX.LwIP is initialized without RTOS, and Ethernet is in RMII mode. The main goal of this project is to receive data over UART and forward it via Ethernet.I want the STM32 board to connect to a standard router using a physical Ethernet cable, obtain a dynamic IP address via DHCP, and then transmit the received UART data over the network.Currently, the board does not seem to request or receive any IP address — while the PC connected to the same router receives an IP successfully, the STM32 does not. So far I've verified: MX_LWIP_Init() is called from main.c MX_LWIP_Process() is called inside the main while (1) loop MAC address is manually set in ethernetif.c: MACAddr[0] = 0x02; MACAddr[1] = 0x12; MACAddr[2] = 0x34; MACAddr[3] = 0x56; MACAddr[4] = 0x78; MACAddr[5] = 0x9A; DHCP is enabled in .ioc under LwIP configuration netif_add(), netif_set_default(), netif_set_up() and dhcp_start() are called ETH is
Hello,I am trying to fill a buffer from the on-board MEMS microphone using the BSP_AUDIO_IN_RecordPDM() function. However, execution pauses around HAL_SAI_Receive_DMA() and the BSP_AUDIO_IN_IRQHandler() is called. The stack trace is as follows:Checking the hdma variable on the debugger, I can see the error code is 1, corresponding (I believe) to a transfer error. I tried looking at the relevant registers with breakpoints, but they were at 0x0 at every point:I've tried almost everything under the sun. I disabled the D-Cache and allocated all the memory to RAM_D1, I tried allocating my buffer (copied below) to each of RAM_D1, D2, and D3ALIGN_32BYTES (uint16_t recordPDMBuf[AUDIO_IN_PDM_BUFFER_SIZE]) __attribute__((section(".RAM_D1")));My linker script looks like this:/* Highest address of the user mode stack */ _estack = ORIGIN(RAM_D1) + LENGTH(RAM_D1); /* end of "RAM_D1" Ram type memory */ _Min_Heap_Size = 0x800 ; /* required amount of heap */ _Min_Stack_Size = 0x800 ; /* requ
I've been working on a project on STM32F746-Discovery with only CMSIS (no other libraries written by not me) on a Windows machine in STM32CubeIDE. I used the default STM startup file (.s with a vector table and a memory initialization), the startup_stm32f746nghx.s. This file, among other things, defines a list of weak IRQ handler hooks with interrupt handler names. So naturally I took the name HASH_RNG_IRQHandler straight from the file. I declared the function extern "C" to prevent name mangling in C++, besides, it's far from the first interrupt handler in the project. All of them work without an issue. When I compiled and ran the project, I found myself hardfaulting. I debugged my way through everything, but everything looked solid. It just suddenly crashed after I enabled the RNG peripheral. I verified everything there was to verify, but found nothing odd, right before RNGEN, the RNG showed no error flags, no seed error, no clock error. My gut feel told me to look at t
Hello,I am trying to use the PKA module on a STM32U5 controller. I have configured the clock at 160Mhz and also initialized the Ring. However, when I try to initialize the PKA, it runs into ADDRERRF = 1, I was expecting ofcourse INITOK to be 1. Does anyone have Idea what am I missing here or what might be causing the ADDRERRF? Thanks,Abhi
Title: UART Loopback with Interrupts Halts After Second Transmission on STM32H747I-DISCO Hello everyone, I'm working on a simple UART loopback test on an STM32H747I-DISCO board using the HAL libraries, and I've run into an issue where my interrupt-driven communication halts unexpectedly. The goal is to have USART2 continuously transmit a byte, receive it back via a physical loopback (TX and RX pins are connected), increment the value, and repeat the process. I'm using an LED to visually confirm when a byte is successfully received. The process starts correctly but stops after the first full cycle. Here is the exact sequence of events I'm observing with the debugger: main() calls HAL_UART_Transmit_IT() to send the first byte. The HAL_UART_TxCpltCallback() is successfully triggered. Inside the TxCpltCallback, I call HAL_UART_Receive_IT() to arm the receiver. The byte is received, and HAL_UART_RxCpltCallback() is successfully triggered. The LED toggles as expected. Inside t
Hello,I have a STM32H747I-DISCO I want to use to record audio. In my test code I tried to record 3 seconds of audio after pressing the JOY_SEL button. I tried to setup the configuration of peripheral SAI4 for PDM and to use DMA and PDM2PCM using the CubeMX tool. I also tried to just use the BSP provided by ST for the discovery board. I was not able to get either the manual configuration or the BSP configuration to work. I have already looked at AN5027 and the examples provided by ST in the STM32Cube_FW_H7_V1.12.1 repository. The examples provide audio recording but for different boards. The DFSDM example for this board is not that useful when using SAI for communication. Any guidance or detailed procedure on how to setup the on-board digital microphone using SAI for the STM32H747I-DISCO is much appreciated!Manual/BSP Setup:CPU ICache enabledCPU DCache enabledFreeRTOS enabledGPIOs for joy stick button configuredTIM6 and TIM3 used for sysclks for Core M7 and Core M4 respectively. (b
Hi,I try to use 6 external interrupts but only EXT4_15 is functionning. All is functionning correctly when i use HAL_GPIO_ReadPin() function without interrupts. Thank you for your HELP void EXTI0_1_IRQHandler(void) { /* USER CODE BEGIN EXTI0_1_IRQn 0 */ /* USER CODE END EXTI0_1_IRQn 0 */ HAL_GPIO_EXTI_IRQHandler(EV5_Pin); HAL_GPIO_EXTI_IRQHandler(EV6_Pin); /* USER CODE BEGIN EXTI0_1_IRQn 1 */ /* USER CODE END EXTI0_1_IRQn 1 */ } /** * @brief This function handles EXTI line 2 and 3 interrupts. */ void EXTI2_3_IRQHandler(void) { /* USER CODE BEGIN EXTI2_3_IRQn 0 */ /* USER CODE END EXTI2_3_IRQn 0 */ HAL_GPIO_EXTI_IRQHandler(EV89_Pin); /* USER CODE BEGIN EXTI2_3_IRQn 1 */ /* USER CODE END EXTI2_3_IRQn 1 */ } /** * @brief This function handles EXTI line 4 to 15 interrupts. */ void EXTI4_15_IRQHandler(void) { /* USER CODE BEGIN EXTI4_15_IRQn 0 */ /* USER CODE END EXTI4_15_IRQn 0 */ HAL_GPIO_EXTI_IRQHandler(EV2_Pin); HAL_GPIO_EXTI_IRQHandler(EV14_Pin)
Hello everyone, I'm working on a custom board that uses the STM32H723ZGT6 together with the LAN8742A-CZ-TR Ethernet PHY. During the call to HAL_ETH_Init() in the stm32h7xx_hal_eth.c file, the initialization fails and gets stuck in this loop: /* Wait for software reset */ while (READ_BIT(heth->Instance->DMAMR, ETH_DMAMR_SWR) > 0U) { if ((HAL_GetTick() - tickstart) > ETH_SWRESET_TIMEOUT) { /* Set Error Code */ heth->ErrorCode = HAL_ETH_ERROR_TIMEOUT; /* Set State as Error */ heth->gState = HAL_ETH_STATE_ERROR; /* Return Error */ return HAL_ERROR; } } I suspect the issue may be related to the NRST pin. On my PCB, I have connected the NRST pin of the LAN8742A to both the MCU's NRST and the ST-Link NRST pin — similar to what is shown in the STM32H7 Nucleo-144 (MB1364) reference design. However, when I checked the LAN8742A datasheet, it suggests that this pin should be driven in a specific way Could this NRST wiring be the reason fo
I am doing development for the STM32N6570-DK board in Zephyr. I can build a simply "blinky" project:$ west build -p always -b stm32n6570_dk ./applications/blinkyAnd can flash the device:$ west flash But when I try to debug:$ west debugserverI get this error:FATAL ERROR: no debugserver runner available for board stm32n6570_dk/stm32n657xx. Check the board's documentation for instructions.I have tried several variations of specifying the runner, but get an error each time, i.e.:$ west debugserver --runner jlinkFATAL ERROR: board stm32n6570_dk/stm32n657xx does not support runner jlinkTo fix, configure this runner in /home/stuart/ns-iot-dev-platform/zephyr/boards/st/stm32n6570_dk/board.cmake and rebuild.or$ west debug --runner openocd$ west debugserver --runner stlink_gdbserveretc.I am running Zephyr v4.1.1.Can someone please confirm that this chip is supported? Anyone tried to debug with Zephyr? Am I doing something wrong?Thank you!
I'm trying to generate an HID keyboard through CubeMX for USBX. I'm using an F411CE based board so picked the appropriate software pack for that. However, when I go to pick to pick components, I can only see the generic HID pack instead of separate keyboard and mouse packs as I've seen here before. I'd usually be fine with this and add the keyboard files in myself but this generic HID pack is based on a mouse implementation and adds a lot of unnecessary bloat to the stack. Is there a way to generate the files without the ux_device_mouse files?
Hi,I was trying to configure WRP protection in the flash for page 0 to page 11 and I am using STM32L443VC MCU.But I am seeing different value in the FLASH_WRP1AR for WRPstartoffset = 0x80 --Expected(0x00). Please find attached snapshot for the reference. Please do check the code snippet as well and let me know any configuration am I missing?
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.