Ask questions and find answers on STM32Cube packages, including HAL, LL and middleware, and expansion software.
Most recent activity
Hello Everybody, I use STM32CubeIDE1.15.0 Build: 20695_20240315_1429 and a custom board with a STM32303RE inside.I use the IOC interface to set the virtual port com. Everything work fine, just a detail: when i connect, then disconnect and reconnect the USB port, the port com number on Windows change, It increase (search the next available number)! The VID and PID are always the same, so I focus on the serial number, and i found that (code generate by STM32CubeIde): usbd_desc.c: 3 undefined local variables, which are used to generate the serial number. Each time I connect the USB cable, the values change=>so the serial number change. Is it normal? Is it a (strange) way to generate a randomize serial number?Just a bug? (VCP number seems better with this fix: ;)) BR,Guillaume Le Gal
Hi, we are currently using different types of the STM32H743 and I want to verify the package to make sure the software is running on the expected device. For this I am using LL_GetPackageType() and check the returned value against one of the LL_UTILS_PACKAGETYPE defines in stm32h7xx_ll_utils.h (line 202 and following). The UFBGA169 package is not listed here. What is the correct value for it? The H743AII6 on my board reports 8. Please add this package in a next HAL release for H7 series. Kinds regards, Martin
Bonjour à tous, cela fait une semaine que je dois développer une API pour la mémoire sécurisée at88sc12816c De chez Atmel mais trés malheuresement j’arrive paz à établir la communication entre ma carte maitre qui est un stm32f412zgt6 et la mémoire eeprom.De mon côté, j’ai bien compris le fonctionnement de la mémoire mais sauf que dans ce dernier les adresses sont diverses, j’explique par exemple pour faire une écrituredans une UserZone c’est B0 et cet octet ce termine par 0 ce qui est correctement compris par la HAL pour faire de l’écriture en i2cmais dans le cas d’une lecture aussi par exemple on l’adresse qui se termine encore 0, alros que dans un protocole i2c standard pour lire le dernier bit de l’octet d’adresse doit être à 1. Et je pense que c’est exactement ce que la HAL ne comprend pas à son niveau. J’ai vraiment besoin d’aide pour avancer
Hello,i have configured timer1 to trigger via CC1 an adc + dma.For the DMA i have placed the TC irq routine and placed a gpio toggle to follow with a logic analyzer like shown below void DMA2_Stream0_IRQHandler(void){ if (DMA_GetITStatus(DMA2_Stream0, DMA_IT_TCIF0) != RESET) { GPIO_ResetBits(gpio_led_port,gpio_led2); GPIO_SetBits(gpio_led_port,gpio_led2); GPIO_ResetBits(gpio_led_port,gpio_led2); DMA_ClearITPendingBit(DMA2_Stream0, DMA_IT_TCIF0); } }And this is my nvic setup SysTick_Config(SystemCoreClock / 1000); NVIC_InitTypeDef NVIC_InitStructure; NVIC_PriorityGroupConfig(NVIC_PriorityGroup_0); NVIC_InitStructure.NVIC_IRQChannel = SysTick_IRQn; NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1; NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; NVIC_Init(&NVIC_InitStructure); NVIC_InitStructure.NVIC_IRQChannel = DMA2_Stream0_IRQn; NVIC_InitStructure.NVIC_IRQChan
Hi All,I'm struggling to get LPTIM1 to wake from STOP mode on the STM32U5 series parts. I have a STM32U575ZI Nucleo board. When I use SLEEP mode, the LPTIM1_IRQHandler in stem32u5xx_it.c is hit. When I use STOP mode, it is not. I made an example with CubeMx to make it as simple as possible. I'll attach the CubeMx ioc and main.c, but see below for the snippit with all the CubeMx comments removed. Presumably its not an issue with the LPBAM, as if I set the RCC->SRDAMR to all ones, it still fails.Any ideas?ThanksJeff int main(void){HAL_Init();SystemClock_Config();MX_LPTIM1_Init();__HAL_RCC_LPTIM1_CLKAM_ENABLE();HAL_LPTIM_Counter_Start_IT(&hlptim1);while (1){HAL_SuspendTick();HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI); // Doesn't work//???HAL_PWR_EnterSLEEPMode(PWR_LOWPOWERREGULATOR_ON, PWR_SLEEPENTRY_WFI); // WorksHAL_ResumeTick();}}
Hallo,does exist, in FileX, a function that returns the free available space not yet utilized?Thank you.
Specifically the SNB (SSN1 & SSN2 in the data sheet) bits are defined erroneously as being 3 bits wide at position 6, whereas it should be 7 bits wide, allowing all 128 sectors in each bank to be erased.#define FLASH_CR_SNB_Pos (6U) #define FLASH_CR_SNB_Msk (0x7FUL << FLASH_CR_SNB_Pos) /*!< 0x00001FC0 */ #define FLASH_CR_SNB FLASH_CR_SNB_Msk /*!< Sector erase selection number */ #define FLASH_CR_SNB_0 (0x01UL << FLASH_CR_SNB_Pos) /*!< 0x00000040 */ #define FLASH_CR_SNB_1 (0x02UL << FLASH_CR_SNB_Pos) /*!< 0x00000080 */ #define FLASH_CR_SNB_2 (0x04UL << FLASH_CR_SNB_Pos) /*!< 0x00000100 */ #define FLASH_CR_SNB_3 (0x08UL << FLASH_CR_SNB_Pos) /*!< 0x00000200 */ #define FLASH_CR_SNB_4 (0x10UL << FLASH_CR_SNB_Pos) /*!< 0x00000400 */ #define FLASH_CR_SNB_5 (0x20UL << FLASH_CR_SNB_Pos) /*!< 0x00000800 */ #define FLASH_CR_SNB_6 (0x40UL << FLASH_CR_SNB_Pos) /*!< 0x00001000 */This causes the HAL_FLASHEx_Erase to behave
Hello everyone!I have just noticed that The OPAMP_CSR_OPARANGE bit in NUCLEO-U575ZI-Q is not shown during debug mode. Some bug perhaps?..
I have a project working on the NUCLEO-N657X0-Q with FSBL and an application. In total I am using under 1MB of the 64MB flash this board has. I was wondering if it was possible to segment off the rest of the flash to be used as a mass storage device over USBX with FileX. I am using the load and run config instead of XIP. The current flash usage is as follows: 0x70000000 - FSBL (66KB) 0x70100000 - Application (100KB) 0x71000000 - Weights and activations (400KB) I know I can use cube programmer to write external data directly to the memory mapped flash drive but I would prefer to use standard file access tools. I have successfully implemented mass storage on a STM32H5 but that MCU didn't need to also load firmware so FileX could manage the whole drive as if it was empty. Alternatively would it be possible to instead use FileX to load the FSBL/Application parts instead of the external memory manager?
I'm working on entering and exiting low power run mode at runtime on Zephyr rtos. I can't find a way to change clock frequency to 2MHz (required by LPR) and back to 80MHz using zephyr features at runtime. Is there any api to achieve this, or some similar example? I'm working on STM32L4S5 series.
Hi Team, I made a custom board using STM32F769BIT microcontroller using with the DP83867 PHY in MII mode, but I am not able to ping it. What could be the possible reasons? I did Memory configurations for TxDecrip, RxDecrip, LwipHeap like this. .lwip_sec (NOLOAD) : . = ABSOLUTE(0x2007C000); *(.RxDecripSection) . = ABSOLUTE(0x2007C0A0); *(.TxDecripSection) . = ABSOLUTE(0x2007C140); *(.LwIPHeap) also my SRAM configuration is like this_ MEMORY RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 496K SRAM2 (xrw) : ORIGIN = 0x2007C000, LENGTH = 16K FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 2048K I am using the 10pin STM32 debugger, but I am not able to see the stack usage there, when I press the debug button. Is it due to code or due to the debugger? For this should I need the 20pin debugger? Thanks, Sayan Das
Interrupts not in proper peripherals:- WWDG is placed in I2C2,- TIM8_CC is in peripheral TIM1,- LPTIM1 is in LPUART1,- USB_HP, USB_HPLP & USBWakeUP are in EXTI,- CRS is in the EXTI as well.
In stm32u5xx_hal_flash_ex.c, version 1.6.2, FLASH_OB_GetUser() is defined as:/** * @brief Return the FLASH User Option Byte value. * @retval The FLASH User Option Bytes values. * The return value can be a combination of @ref FLASH_OB_USER_BOR_LEVEL, * @ref FLASH_OB_USER_nRST_STOP, @ref FLASH_OB_USER_nRST_STANDBY, * @ref FLASH_OB_USER_nRST_SHUTDOWN, @ref FLASH_OB_USER_SRAM_RST, * @ref FLASH_OB_USER_IWDG_SW, @ref FLASH_OB_USER_IWDG_STOP, * @ref FLASH_OB_USER_IWDG_STANDBY, @ref FLASH_OB_USER_WWDG_SW, * @ref OB_USER_SWAP_BANK, @ref FLASH_OB_USER_DUALBANK, * @ref FLASH_OB_USER_BKPRAM_RST, @ref FLASH_OB_USER_SRAM3_ECC, * @ref FLASH_OB_USER_SRAM2_ECC, @ref FLASH_OB_USER_SRAM2_RST, * @ref FLASH_OB_USER_nSWBOOT0, @ref FLASH_OB_USER_nBOOT0, * @ref FLASH_OB_USER_PA15_PUPEN, @ref FLASH_OB_USER_IO_VDD_HSLV, * @ref FLASH_OB_USER_IO_VDDIO2_HSLV and @ref OB_USER_TZEN */ static uint32_t FLASH_OB_GetUser(void) { uint32_t user_config = READ_REG(FLASH->OPTR); CLEAR_BIT(user_config, FLASH_OPTR_RDP); re
Hi ST community,I am using the B-L4S5I-IOT01A board to record 3 sec of 16 kHz audio using DFSDM + DMA, and then transmit it offline via UART (after recording is complete). Since two MP34DT01-M microphones are connected to DFSDM Channel 2, I configured Filter 0 to use only one microphone. I am using a Python script to receive the DFSDM data and save it in .WAV format. I am able to record 3 sec of audio; however, when I play the audio on my laptop, it seems to play at 10× speed.Here is my code : #define SAMPLE_RATE 16000 #define RECORD_SECONDS 3 #define TOTAL_SAMPLES (SAMPLE_RATE * RECORD_SECONDS) #define DFSDM_BUFFER_SIZE TOTAL_SAMPLES #define UART_TX_TIMEOUT 1000 static int32_t dfsdm_rec_buf[DFSDM_BUFFER_SIZE]; // Raw 32-bit DFSDM samples static int16_t audio_output[DFSDM_BUFFER_SIZE]; // 16-bit PCM samples static volatile bool record_done = false; extern DFSDM_Filter_HandleTypeDef hdfsdm1_filter0; extern UART_HandleTypeDef huart1; int16_t clamp(int32_t val, int32_t min,
Hi, I am having issues with threadX tx_byte_allocate throwing a hard fault exception. This only happens after some time of byte allocate and release. There are still plenty of available bytes according to the pool. But somehow in _tx_byte_pool_search it encounters some problem. I am not posting the entire source code here as that will be huge. Anyway, I am using STM32H753. I created a byte pool using DTCRAM (128K). Linker snippet: RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K .ram_dtcmram : { *(.ram_dtcmram) } >RAM Code Snippet #define RAM_DTCMRAM \ __attribute__((section(".ram_dtcmram"))) #define GENERIC_MEM_ALLOCATION (0x20000-0x1000) static u8 m_genericMemBytePoolBuffer[GENERIC_MEM_ALLOCATION] RAM_DTCMRAM; static TX_BYTE_POOL m_genericMemBytePool RAM_D3; bool Hal_MemPool_Init(void) { if (tx_byte_pool_create(&m_genericMemBytePool, "Generic memory pool", m_genericMemBytePoolBuffer , GENERIC_MEM_ALLOCATION) !=
I'm trying to implement a USB touchscreen on a NUCLEO F446ZE. I'm making a full-speed device using ST's USB library (Custom HID class) and I'm testing it with on a Windows 10 host. The first contact registers, but when I try to press another, it doesn't. This happens even when the contacts are being pressed independently.I'm using the sample report descriptors provided in the Windows Hardware Developer docs, modified such that the X and Y usages only report intended touches. I've also excluded the Device Certification Status Feature Report for simplicity. My report descriptor is as follows: /* USER CODE BEGIN 0 */ 0x05, 0x0d, // USAGE_PAGE (Digitizers) 0x09, 0x04, // USAGE (Touch Screen) 0xa1, 0x01, // COLLECTION (Application) 0x85, 0x01, // REPORT_ID (Touch) 0x09, 0x22, // USAGE (Finger) 0xa1, 0x02, // COLLECTION (Logical) 0x09, 0x42, // USAGE (Tip Switch) 0x15, 0x00, // LOGICAL_MINIMUM (0) 0x25, 0x01, // LOGICAL_MAXIMUM (1) 0x75, 0x01, // REPORT_SIZE (1) 0x95, 0x01,
I am currently experimenting with STM32F030RCTX and STM32F030CCTX devices.My goal is to use RS485 with auto-baudrate detection, since I have modules that operate either at 115200 baud or 500k baud.On STM32F030RCTX, I use USART1.On STM32F030CCTX, I use USART3.The UART init functions are identical, except for the instance selection.Example init function:void mcu_UART3_Init(void) { huart3.Instance = USART3; huart3.Init.BaudRate = 115200; huart3.Init.WordLength = UART_WORDLENGTH_8B; huart3.Init.StopBits = UART_STOPBITS_1; huart3.Init.Parity = UART_PARITY_NONE; huart3.Init.Mode = UART_MODE_TX_RX; huart3.Init.HwFlowCtl = UART_HWCONTROL_NONE; huart3.Init.OverSampling = UART_OVERSAMPLING_16; huart3.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE; huart3.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_AUTOBAUDRATE_INIT; huart3.AdvancedInit.AutoBaudRateEnable = UART_ADVFEATURE_AUTOBAUDRATE_ENABLE; huart3.AdvancedInit.AutoBaudRateMode = UART_ADVFEATURE_AUTOBAUDRATE_ON0X55FRAME; if (
Hi,Master:MCU: stm32h743iiIDE:keilQuestion:There is a 32M external SDRAM, and the scatter file is as follows:LR_IROM1 0x08000000 0x00200000 { ; load region size_region ER_IROM1 0x08000000 0x00200000 { ; load address = execution address *.o (RESET, +First) *(InRoot$$Sections) *(_drv_set_) .ANY (+RO) .ANY (+XO) } ... EXT_SDRAM 0xC0000000 0x2000000 { ; RW data *.o(ext_sdram) } }Suppose there are some variables in the program that are specified to be located in 'ext_sdram' section.static lv_color_t buff1[1024 * 600] __attribute__((used, section("ext_sdram"))); static lv_color_t buff2[1024 * 600] __attribute__((used, section("ext_sdram"))); ...During the scatter file loading, these variables will be initialized. Therefore, the external SDRAM needs to be initialized before the scatter file loading, as shown below:Reset_Handler PROC EXPORT Reset_Handler [WEAK] IMPORT SystemInit IMPORT __low_level_init IMPORT __main LDR R0, =SystemInit BLX R0 LDR R0, =__low_level_init B
Hi STM community,I’m working on a project with an STM32L031K6 paired with a Fujitsu FRAM MB85RC256V and an SHT31-D temperature/humidity sensor (on a breakout board). Both peripherals are on the I²C bus PB7 = SDA, PB6 = SCL.I’m trying to test the setup using Tera Term, but I’m not seeing any UART output at all — even though I’ve added print statements. No text appears on the terminal.Here’s what I’ve tried so far:1. Verified that my code reaches the print statements; I added edge cases and test prints.2. Confirmed my pinout configuration: PB7 → SDA, PB6 → SCL with pull-up resistors connected to 3v3 rail.3. Enabled USART2 with TX = PA2, RX = PA15, and ensured the global interrupt is enabled with priority 0.4. Enabled I²C communication.Despite these steps, I’m still not getting any serial output.Has anyone encountered a similar issue on the Nucleo-L031K6 where USART2 over the ST-Link Virtual COM Port does not show output in Tera Term? Any suggestions or troubleshooting steps would be grea
Hi everybody,On my project, my µC receives data from a rapsberry pi on a serial bus.For another project, I've used this method : https://github.com/MaJerle/stm32-usart-uart-dma-rx-tx/blob/main/projects/usart_rx_idle_line_irq_F4/Src/main.c to receive data with unknown length, it was working very well.So, i'd like to use the same thing, but I have something that I don't understand.For my test, Raspberry in sending the following frame every 10s ("DATA RASPBERRY"). My buffer has 64 bytes.The following line gives me the position of cursor : pos = ARRAY_LEN(buffer_rx_dma_rs1) - __HAL_DMA_GET_COUNTER(huart->hdmarx);So, the first time, it gives me 14, the second time 28 and the third time 32 (instead of 42), but 32 is the half of 64.When I take a look on the values, ARRAY_LEN(buffer_rx_dma_rs1) = 64 and __HAL_DMA_GET_COUNTER(huart->hdmarx) = 22, but pos = 32, how is it possible that the substract operation is false ?
NUCLEO-F411REI am trying to read data from a ADXL1002Z.I have set up my board to use PA1 (A1 on the Arduino header) as ADC1_1/* adc.h */ #ifndef INC_ADC_H_ #define INC_ADC_H_ #include <stdint.h> void pa1_adc_init(void); uint32_t adc_read(void); void start_conversion(void); #endif /* ADC_H_ */ and...#include "stm32f4xx.h" #include "adc.h" #define GPIOAEN (1U<<0) #define ADC1EN (1U<<8) #define ADC_CH1 (1U<<0) #define ADC_SEQ_LEN_1 0x00 #define CR2_AD0N (1U<<0) #define CR2_SWSTART (1U<<30) #define CR2_CONT (1U<<1) #define CR1_EOCIE (1U<<5) #define SR_EOC (1U<<1) void pa1_adc_init(void) { /***Configure the ADC GPIO pin ***/ /*Enable clock access to GPIOA*/ RCC->AHB1ENR |= GPIOAEN; /*Set the mode of PA1 to analog*/ GPIOA->MODER |=(1U<<2); GPIOA->MODER |=(1U<<3); /***Configure the ADC module***/ /*Enable clock access to ADC */ RCC->APB2ENR |= ADC1EN; /*Conversion sequence start*/
I have followed the article (https://community.st.com/t5/stm32-mcus/how-to-create-a-project-for-stm32h7-with-ethernet-and-lwip-stack/ta-p/49308#memory-layout ) to get it working for ethernet but I am facing hardfault. In H7S3L8 I am using AXI-SRAM at address 0x24020000 for ethernet buffers and lwip and configuring this sram as non cacheable, non bufferable and shareable at level 1 I am getting hardfault. I is related to memory but I am not able to resolve it. Any help me to find where is the problem? Linker file is shown below /* ****************************************************************************** ** ** @file : LinkerScript.ld ** ** @author : STM32CubeIDE ** ** Abstract : Linker script for STM32H7Sxx Device ** 64Kbytes FLASH ** 456Kbytes RAM ** ** Set heap size, stack size and stack location according ** to application requirements. ** ** Set memory bank area and size if external memory is used ** ** Target : STMicroelectronics
Hello, I’m working on a project with an STM32F446RE where I read data from a CAN bus at 500 kbps (CAN1_RX0) and also use I2C to control an MCP4725 DAC, plus timers and DMA for other tasks. The problem: When I test CAN alone, it works perfectly — I can receive all messages from my device (a motorcycle inverter). When I run the full code with all peripherals connected and active (CAN + I2C + TIM2 + DMA), the CAN stops receiving after a short time, or doesn’t receive at all. On the motorcycle, this happens consistently, but on the bench with CAN only, it works fine. What I tried so far: Set CAN NVIC priority higher than other interrupts: Confirmed CAN1_RX0_IRQHandler() calls HAL_CAN_IRQHandler(&hcan1). Reduced I2C timeout to avoid blocking (HAL_I2C_Master_Transmit with 2 ms instead of HAL_MAX_DELAY). Tried opening the CAN filter (mask = 0) to receive all IDs for debugging. Enabled HAL_CAN_ErrorCallback Despite all these changes, when all peripherals ar
Hi All,I am writing a code to generate an PWM at output. I want to drive an H-bridge outside.All initializations I have done.I am using TIM1 (advanced timer) for this purpose. I am using STM32F Discovery Board (Microcontroller is STM32F407) and STM32CubeIDE 1.19.0 The issue I am facing is whenever I get an interrupt i tried to load value from the LUT but its not working and generate unexpected PWM at output but when I load any fix value then PWM is generated at the output.I am wondering why it is not generating the PWM from LUT.below is my code. kindly tell me what I am doing wrong volatile uint16_t sineIndex = 0; #define SINE_TABLE_SIZE 10 uint16_t sineTable[SINE_TABLE_SIZE] = {400, 657, 794, 746, 537, 263, 54, 6, 143, 400}; int main(){ HAL_Init(); System_Clock_Source(); UART2_Init(); MX_GPIO_Init(); MX_TIM1_Init(); // Here all the settings are done related to PWM timings MX_TIM2_Init(); SPWM_Start(); } void MX_GPIO_Init(void) { GPIO_InitTypeDef GPIO_InitStr
Will ST's ThreadX versions available through CubeMX and on ST's Github eventually be derived from the Eclipse ThreadX project rather than Azure RTOS? Such as...https://github.com/STMicroelectronics/x-cube-azrtos-h7https://github.com/STMicroelectronics/stm32-mw-threadxDoes ST have a plan to transition their middleware to use sources and licenses from Eclipse ThreadX?
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.