Join conversations with your peers and ST experts. Explore the full potential of STM32 microcontrollers for your embedded design.
Most recent activity
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
Hello everyone. I am writing to you because I am trying to capture a thermal image (frame of temperature values) using a Lepton 2.5 thermal camera with Break Out board 2.0 connected to a Nucleo U5A5ZJ-Q board. First I connected the following pins of the Break Out board 2.0 to the Nucleo board, as shown in the table below. I checked the communication of the I2C on the oscilloscope and it seems good. Anyway I read 0 as the temperature of the case of the Lepton Thermal camera and I have never received the VSYNC signal from the Lepton Thermal camera to read the thermal frame on the SPI. I tried to put software pull-up and to remove them on the I2C, but the situation remains the same. Then I noted that about each minute the Lepton thermal camera shutter close and open for a while. Do you have any idea how I can solve this problem? Thank you very much for the support!
Hi,i am currently trying to implement OTA Update capabilities in my own custom board based on a WB55CGU6.So i flashed the BLE_Ota app to its desired sectors. The bootloader is starting and spawning the BLE Update Service correctly.Now i take my custom app binary and flash it. After flash -> The new firmware starts properly and is running smoothly.Now i implemented sth like this:If a user button on my board is pressed (boot to OTA) it should boot to the OTA Loader.I have done this with the following code snippet:*(uint32_t*)SRAM1_BASE = CFG_REBOOT_ON_BLE_OTA_APP; NVIC_SystemReset();Now the device was doing a reboot, but it does not spawn my BLE OTA Update Service anymore...I checked the SRAM1 address 0x2000000 and there is a 01. After hard debugging this stuff somehow with blinking an LED on the board (from the OTA Firmware) i figured out that it seems to get stuck at the point where it waits for the SHCI / HCI command (wireless fw ready). This event never seem to happen :( so
My simple program to test wake from standby with PC13/Wakeup_pin4 is working. I use the pushbutton on this pin as an EXTI and had to add the GPIO_DeInit before setting the pin as an input without EXTI.The same code does not work in my larger program and I can't work out why?? printf("0 - sleep until button pressed\r\n"); HAL_GPIO_DeInit(GPIOC, GPIO_PIN_13); GPIO_InitTypeDef GPIO_InitStruct = {0}; GPIO_InitStruct.Pin = GPIO_PIN_13; GPIO_InitStruct.Mode = GPIO_MODE_INPUT; GPIO_InitStruct.Pull = GPIO_NOPULL; HAL_GPIO_Init(GPIOC, &GPIO_InitStruct); HAL_PWR_DisableWakeUpPin(PWR_WAKEUP_PIN4); PWR->WKUPCR = 0x3F; // Clear all wakeup flags (write 1 to clear) PWREx_WakeupPinTypeDef sPinParams = { .WakeUpPin = PWR_WAKEUP_PIN4, .PinPolarity = PWR_PIN_POLARITY_HIGH, .PinPull = PWR_PIN_NO_PULL }; HAL_PWREx_EnableWakeUpPin(&sPinParams); HAL_Delay(10); HAL_TIM_Base_Stop_IT(&htim6); HAL_SuspendTick(); BlinkOff(); HAL_PWR_EnterSTANDBYMode();
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?
I’m working on a design where I need to communicate with two SPI devices that operate at different logic levels:1) A sensor running at 1.8v logic (need SPI + 2 other lines, all at 1.8v) 2) Everything else on my board, preferably running at 3.3v, I will need CAN, UART, and another SPI. I’m trying to avoid level shifters if possible (and avoid sourcing 1.8 V CAN/UART transceivers). Ideally, I’d like to use an STM32 that has split power domains, both with SPI peripherals. So far, I’ve found that the STM32L496QI supports SPI on both the main VDD rail and the VDDIO2 rail (which can be independently run at 1.8 V), which fits the bill. The only issue is that it’s a 100-pin part, which is way more than I need for this design.What I’m looking for:STM32 with VDDIO2 or similarSPI on both 1.8V and 3.3V-capable banksPreferably 64 pins or lessThanks, Sameer
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
Hello,I try to implement a tamper detection for my project. In general, it works. When the device is only powered by a coin cell and a tamper is detected, the backup registers are erased and unfortunately also the backup RAM. When the device is powered and a tamper is detected while the firmware is accessing the backup RAM, an imprecise memfault is generated.Because of performance reasons, I didn't try to guard every byte written into the backup RAM. Instead, I only guard a std::copy, and this (obviously) is not enough. Because of that, I tried to enable the tamper interrupt to catch the tamper event and solve it, before I continue with the copy. The data copied into the backup RAM will be corrupted, but that is okay and can easily corrected. But unfortunately, this does also not work. I still get a memfault before I get the tamper interrupt.What I want to archive is to delete only the RTC backup registers during a tamper event. That is the place where I keep my secret keys. The backup
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 have STM32H757I-EVAL board which has MB1166 Rev A LCD daughter board. I tried to find which display controller is used with this LCD display. I had gone through the MB1166 schematics which shows 2 options 1. KM-040TMP-02 2. FRD397B2509I got confused which one to consider.And I found different in example code which is OTM8009A. Which display driver used exactly in this board? Thanks,Satheesh
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
Hello Everyone,I’m using sensorless FOC to control a BLDC motor with 3-shunt current sensing for closed-loop control. At startup, the motor slightly moves backward before starting to rotate in the correct (forward) direction. I understand this is likely due to the lack of initial rotor position information. There are no position or speed sensors involved—everything is handled via FOC and current feedback.I verified that 6-step control on the same hardware supports Initial Position Detection (IPD), although I haven’t tested it yet. That said, I am not switching to 6-step control. I want to stay with FOC and retain the 3-shunt topology for current sensing in closed-loop mode.My questions:Is there a way to prevent this backward motion using FOC only?If IPD is the only viable solution, how can I integrate IPD into the FOC framework, using my current hardware setup (STM32F401RE + 3-shunt topology)?Can I reuse the 6-step IPD logic just for startup, and then transition into FOC with 3-sh
I have measured the MCU current on the NUCLEO-L433RC-P dev board by removing JP6 and connecting a multimeter. The current in shutdown is ~1mA, why is this so high ? The shutdown current should be nA or uA at most... To shutdown I call "HAL_PWREx_EnterSHUTDOWNMode();" and have PC13 (the blue top button) set to SYS_WKUP2 to wake up. Looking at the dev board schematic, it appears that the only other load on the 3.3V supply are two level shifters (SN74LVC2T45DCUT) but the datasheet says that these have a low power consumption, 4-μA maximum ICC.
Hi,what i need to do, if i want to build the Debug app of BLE_Ota Demo application (FW 1.23.0)If i import the BLE_Ota app there is only "Release".If i now click on Debug as STM32 Application, the fw is uploaded but then in the Breakpoint i just get the following:In this video: https://www.youtube.com/watch?v=mRzZOa3jmuM&t=389sthere seems to be a "Debug" config for this project - But i can not see this in my IDE.
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, I am using this example: https://github.com/STMicroelectronics/x-cube-n6-ai-h264-usb-uvc HW: STM32N6570-DK + STEVAL-66GYMAI I have this strange behavior only when using the VD66GY. If no motion on the video, i barely see the flickering. However, when i do a little motion in front of the camera, I begin to see white horizontal lines on the of the video stream, this flickering happens only at around 30fps. Only when I reduce to 15fps it disappears... Also lowering the VENC resolution did not fix it. #define VENC_VD66GY_WIDTH #define VENC_VD66GY_HEIGHT BTW, The IMX335 works fine at 30fps. Can someone help me ? Thank you.
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!
Hello again, The DMA now works in standard request mode with circular mode disabled, but it doesn't when I am trying to use circular buffering mode (my destination buffer only contains 0s). I defined manually the data size, the source and destination addresses in my code once my memory buffers are defined. Once these parameters defined I enable the GPDMA. Here are the lines I add in the main() : LL_DMA_ConfigAddresses(GPDMA1, LL_DMA_CHANNEL_0, p_dma_buffer, m_dma_buffer); LL_DMA_SetBlkDataLength(GPDMA1, LL_DMA_CHANNEL_0, 8); LL_DMA_EnableChannel(GPDMA1, LL_DMA_CHANNEL_0); But when I launch the debug only the parameters I set manually were taken into account. All the CubeMX Configuration doesn't appear here (for example DINC and SINC should be at 1 in GPDMA_C0TR1 in the image below) ... Do you have any idea of what I should do to use circular buffering in standard request mode? I saw in the user manual an example of application for circular buffering using link
Hello All, I am using STM32L011G4U6TR for one of my application development. I have written a code where I am using,11 GPIO, 1 UART and Internat EEProm.When I am building the code in I am getting below Error and not able to load the Application on STM32L011G4U6TR board.If someone could guide how to resolve it, would be helpful. (Have removed the unnecessary arrays variables and using minimum variables to optimized ). Description Resource Path Location TypeIPL_Handpiece_Control_Board_Firmware.elf section `.text' will not fit in region `FLASH' IPL_Handpiece_Control_Board_Firmware C/C++ Problemmake: *** [makefile:64: IPL_Handpiece_Control_Board_Firmware.elf] Error 1 IPL_Handpiece_Control_Board_Firmware C/C++ Problemregion `FLASH' overflowed by 568 bytes IPL_Handpiece_Control_Board_Firmware C/C++ Problem Note when I am commenting some part of needed code then, I am able to load it and debug, but I need all the GPIO, UART, EEprom working together. Will do as pe
Hello All,I have a camera of 5 MP and optical light engine with display of 1280 x 720 pixels.Can I run both the peripherals on MIPI interface simultaneously such that the camera content is input/feed is input to optical light engine having display of 1280 x 720 pixels. I am using STM32N647A0. Do we have a running example on STM32N6. I have the N6-DK board. Please suggest and recommend. Best Regards,Sakshi
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!
[VERSION]: MCSDK6.4[TOOL]: MC Workbench6.4.0, KEIL5, ST Motor PilotI am currently conducting an experiment where a quadrature encoder is used as the primary sensor and STO_PLL serves as the auxiliary sensor. During testing, after using Motor Pilot to acquire the waveforms of ENCODER_EL_ANGLE and STOPLL_EL_ANGLE, I observed that the two do not align. The motor can still run normally without any error reports. Have any of you encountered situations where the electrical angles of two sensors (ENCODER_EL_ANGLE and STOPLL_EL_ANGLE) fail to align? If so, could you share potential causes?The image below shows my test results; I think the correct waveform should be perfectly aligned;As shown in the figure below:
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 -----------------------------
ST Community highlights – April to June 2026
Already have an account? Login
No account yet? Create an account
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.