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
The original question is here I too have experienced something like this with my STM32F407ZET controller. TCP Client mode was not working in IAR whereas it worked CubeIDE. Dont know the reason, but had to migrate my whole code to IDE.
Hi Team,Could you please confirm whether the following SPI erratum is considered in HAL version 1.11? I am currently using an MCU with revision V.
I am using stm32f407 and stm32wb series for sending the data usimg uart.first i send th data using the stm32wb uart to the stm32f407 uart the data is correctly sent.After receiving the data i will return the data back to the stm32wb from the stm32f407 but this time the data is corrupted.I am using the hal_uart_receiveto_idle and hal_uart_transmit_it to send and receive the data. I will share the code please review and tell me if i need to make any changes.
#ifdef HWVR_AC_CG_NOV25 #include "lpuart.h" #include "main.h" UART_HandleTypeDef hlpuart1; DMA_HandleTypeDef hdma_lpuart1_rx; DMA_HandleTypeDef hdma_lpuart1_tx; #define LPUART_RX_BUF_SIZE (uint8_t)1 static volatile uint8_t lpuart_rx_buffer[LPUART_RX_BUF_SIZE]; // Buffer for DMA reception #define LPUART_TX_BUF_SIZE (uint8_t)64 static volatile uint8_t lpuart_tx_string[LPUART_TX_BUF_SIZE]; static uint8_t lpuart_tx_string_size = 0; // Size of the lpuart_tx_string buffer #define LPUART_FLAG_RX_COMPLETE ((uint8_t)((uint8_t)1U<<(uint8_t)0U)) #define LPUART_FLAG_READY_TO_SEND ((uint8_t)((uint8_t)1U<<(uint8_t)1U)) #define LPUART_FLAG_TX_ONGOING ((uint8_t)((uint8_t)1U<<(uint8_t)2U)) static volatile uint8_t lpuart_flag = 0; void_const_uint8_t_p_callback_t lpuart_fill_callback = NULL; // Callback for the loop function void_void_callback_t lpuart_loop_callback = NULL; // Callback for the loop function static volatile uint32_t last_timestamp = 0; void HAL_UART_RxCp
I tried in use Nx_WebServer factory example written for STM32N6570-DK board. Finally I compiled (without error) and run the project but nothing (except single step) worked.It never got IP address from DHCP.The Green LED is not blinking.With static IP address it does not answer for ping command.The board does not appear in arp -a list.The breakpoint set inside of ETH1_IRQHandler is never hit.The green and yellow LEDS of RJN45 are not blinkingThe code is running inside the app_thread and wating for events.What did I wrong?Louis
Hi,MCU - STM32H7 familyMCU package: FW_H7 V1.11.2FreeRTOSEnable Multi-threaded support -> Thread-safe locking strategy "FreeRTOS strategy #4 - Allow lock usage from interrupts"the issue:When I'm writing a file in Flash, I reach the main.c::void Error_Handler(void) while loop. in the stack, I see that the last steps was in newlib_lock_glue.c:void Error_Handler(void)static inline void stm32_lock_acquire(LockingData_t *lock)void __retarget_lock_acquire_recursive(_LOCK_T lock)__fflush_r()_swbuf_r()_putc_r()_fputc_r()After investigation I see that the Error_Handler reached because the lock object reached is limit 2.The lock LockingData_t struct defined in ST file stm32_lock.h (line 255):#define STM32_LOCK_MAX_NESTED_LEVELS 2 /**< Max nesting level of interrupts */typedef struct{uint32_t basepri[STM32_LOCK_MAX_NESTED_LEVELS];uint8_t nesting_level;} LockingData_t;When I'm set the STM32_LOCK_MAX_NESTED_LEVELS to 5, problem solved and I succeed to write the file.But i set it man
Hi, I have created a project in STM32CUBEIDE for STM32U575ZITQ for USB CDC. I am getting an 85 | HAL_PCDEx_PMAConfig((PCD_HandleTypeDef*)pdev->pData , 0x00 , PCD_SNG_BUF, 0x18); | ^~~~~~~~~~~~~~~~~~~ | HAL_PWREx_PVMConfig ../USB/Core/Src/usbd_conf.c:85:68: error: 'PCD_SNG_BUF' undeclared (first use in this function) 85 | HAL_PCDEx_PMAConfig((PCD_HandleTypeDef*)pdev->pData , 0x00 , PCD_SNG_BUF, 0x18); I am following the link below to create the project: https://community.st.com/t5/stm32-mcus/how-to-use-stmicroelectronics-classic-usb-device-middleware-with/ta-p/599274 I have tried with USBX but no result. After that I followed above link to create a USB CDC project. Regards, Abhishek
Hello, We have found that, in an OS context, if two tasks change the configuration of different GPIOs belonging to the same port, then the register can get corrupted due to a RMW race.It seems the RMW operations are not protected:// stm32u5xx_hal_gpio.c :232 tmp = GPIOx->MODER; tmp &= ~(LPGPIO_MODER_MOD0 << position); tmp |= ((pGPIO_Init->Mode & GPIO_MODE_OUTPUT_PP) << position); GPIOx->MODER = tmp;Our solution is as follows:ATOMIC_MODIFY_REG(GPIOx->MODER, (LPGPIO_MODER_MOD0 << position), ((pGPIO_Init->Mode & GPIO_MODE_OUTPUT_PP) << position));Is there any reason why these operations were not atomic in the first place ?Do you see any issue with our solution ?Is there a better way to handle this ?
I downloaded the package from here: https://www.st.com/en/embedded-software/x-cube-azrtos-h7.htmlIt is not yet available on MX when searching for example code. Anyways, so I am able to run the UX_Device_Recording which is cool. I notice that it uses the onboard mic, which is AudioInInit.Device = AUDIO_IN_DEVICE_DIGITAL_MIC; But I want to use the analog microphone that comes with the headset - available in CN17. So I change it to AudioInInit.Device = AUDIO_IN_DEVICE_ANALOG_MIC;And now it's giving a static noise, but no mic input is captured. Any idea why?
ST moderator has edited this post to be compliant with the community rules. In next time please use </> button to paste your code. Thank you for your undersranding. Hello collegues. LL library. Can you help with RTC domain in STM32C031T6. Problem is that, RTC start and counting, I set alarm A evry 1s. This wokrs fine. I'm counting moreless about 30min. After push the pin RESET, RTC starts counting from 0, I want to continue counting ? Initialization code below: void MX_RTC_Init(void) { /* USER CODE BEGIN RTC_Init 0 */ /* USER CODE END RTC_Init 0 */ LL_RTC_InitTypeDef RTC_InitStruct = {0}; LL_RTC_TimeTypeDef RTC_TimeStruct = {0}; LL_RTC_DateTypeDef RTC_DateStruct = {0}; LL_RTC_AlarmTypeDef RTC_AlarmStruct = {0}; if(LL_RCC_GetRTCClockSource() != LL_RCC_RTC_CLKSOURCE_LSE) { FlagStatus pwrclkchanged = RESET; if (LL_APB1_GRP1_IsEnabledClock (LL_APB1_GRP1_PERIPH_PWR) != 1U) { /* Enables the PWR Clock and Enables access to the backup domain */ LL_APB1_GRP1_Enabl
Split from: HAL_UARTEx_ReceiveToIdle_DMA return HAL_ERROR when stm32's partner restart. That thread is solved; this is a new question. I think I'm seeing a similar problem if I call `HAL_UARTEx_ReceiveToIdle_DMA()` when the UART receive line is actively receiving data (when the other end is transmitting). A good percentage of the time it returns HAL_ERROR. I'm using STM32L4 HAL 1.13.6 (Cube 1.18.2). The problem is that the UART generates an overrun error immediately when `UART_Start_Receive_DMA()` enables the overrun error. The overrun error overwrites `huart->ReceptionType = HAL_UART_RECEPTION_STANDARD` which causes `HAL_UARTEx_ReceiveToIdle_DMA()` to return HAL_ERROR as shown in the code snippet from `HAL_UARTEx_ReceiveToIdle_DMA()` below: /* Set Reception type to reception till IDLE Event*/ huart->ReceptionType = HAL_UART_RECEPTION_TOIDLE; huart->RxEventType = HAL_UART_RXEVENT_TC; status = UART_Start_Receive_DMA(huart, pData, Size); /* Check Rx process has
Hello, I have used DMA for timer outputs, input compares, memory to memory, etc. and all has worked fine, however I can't seem to get a timer-triggered DMA from memory to GPIO outputs (as this post seems to have managed).I have tried using the ODR register, the BSRR register, 16 bit transfers, 32 bit transfers, reordering the initialisation of different components, setting TIM1->DIER = TIM_DIER_UDE in different places, etc. etc. The timer is definitely incrementing and resetting correctly and I am getting a TEIF1 on DMA1.I am less familiar with DMAMUX (I used the F401 previously) so I may be making a mistake there.#include <stdio.h> #include "main.h" #include "stm32g0xx_hal_tim.h" void SystemClock_Config(void); static TIM_HandleTypeDef htim1 = {0}; static DMA_HandleTypeDef hdma = {0}; #define GPIO_BUF_LEN 4 static uint32_t gpio_buf[GPIO_BUF_LEN] = { 0xFFFFFFFF, 0x00000000, 0xFFFFFFFF, 0x00000000, }; static void Init_GPIO(void) { __HAL_RCC_GPIOA_CLK_E
Hello,I am wondering why the STmicro example code (STM32CubeH7) does not use the interrupt attribute for defining exception handlers.The difference I have noted when using this attribute is that it forces the stack alignement to 8 bytes:Example: void f(void); void handler(void) { return f(); } compiles with arm-none-eabi-gcc 10.2.1 and -O1 -mthumb -mcpu=cortex-m7 in: handler(): push {r3, lr} bl f() pop {r3, pc} whereas if I add the attribute "interrupt": handler(): mov r0, sp bic r1, r0, #7 mov sp, r1 push {r0, lr} bl f() pop {r0, lr} mov sp, r0 bx lr One can see the difference is in the 3 first instructions that align the stack to 8 bytes. Indeed the stack is not always aligned to 8 bytes inside a function. From the Procedure Call Standard: 6.2.1.1 Universal stack constraints At all times the following basic constraints must hold: Stack-limit ≤ SP ≤ stack-base. The stack pointer must lie within the extent of t
Post edited by ST moderator to be compliant with the ST community rules especially for sharing a code. The latest Cube H5 package (STM32Cube FW_H5 V1.6.0) has broken the use of ADC2_INP0 with the following changes to LL_ADC_EnableChannel0_GPIO and LL_ADC_DisableChannel0_GPIO in STM32H5xxLL_ADC.H. Previous, __STATIC_INLINE void LL_ADC_EnableChannel0_GPIO(const ADC_TypeDef *ADCx) { /* Prevent unused argument(s) compilation warning */ (void)(ADCx); SET_BIT(ADC1->OR, ADC_OR_OP0); } Current, __STATIC_INLINE void LL_ADC_EnableChannel0_GPIO(ADC_TypeDef *ADCx) { SET_BIT(ADCx->OR, ADC_OR_OP0); } Previous, __STATIC_INLINE void LL_ADC_DisableChannel0_GPIO(const ADC_TypeDef *ADCx) { /* Prevent unused argument(s) compilation warning */ (void)(ADCx); CLEAR_BIT(ADC1->OR, ADC_OR_OP0); } Current, __STATIC_INLINE void LL_ADC_DisableChannel0_GPIO(ADC_TypeDef *ADCx) { CLEAR_BIT(ADCx->OR, ADC_OR_OP0); } According to the reference manual t
Hello STM32 community!I'm relatively new to the embedded field and have been diving into communication protocols through small projects. Currently, I'm working on implementing USB CDC on an STM32H563ZI, and I've been facing challenges for the past two weeks.I've extensively searched the internet and followed various tutorials, but unfortunately, none of them seem to work.One of the tutorial(from STM community) that I followed: https://www.youtube.com/watch?v=LdY2bieaPwkI have added read functions to receive the data. I have made two separate semaphores for read and write functions. (It should work even without semaphores though). When I run the code, it's not taking any input from the terminal. Inside app_usbx_device.c file,these two threads(for read and write) were created inside MX_USBX_Device_Init() function.I am giving semaphore inside the while loop here...Inside ux_device_cdc_acm.c file,I am declaring variables...I am defining the read and write functions like this
I’m trying to get a USB Full-Speed Host Mass Storage example running on the STM32H753I-EVAL2 using ThreadX, USBX, and FileX.I’ve generated the base project from CubeMX, but I’m running into a few issues:VBUS Enable/Detection: VBUS is not being enabled correctly via the MFX (IO expander).Even when manually configuring, the stack doesn’t seem to handle VBUS properly in host mode.Memory Pool & Stack Sizes:Default memory pool size and system/stack sizes seem insufficient, causing failures with Mass Storage class. tried increasing but did not succeed and ended up in memfaultsI’m looking for:A working USB FS Host Mass Storage example for STM32H753I-EVAL2 with ThreadX, USBX, and FileX.Guidance on properly enabling VBUS via MFX or directly on the board.Recommended USBX memory pool and stack sizes for Mass Storage class.BSP package for STM32H753I-EVAL2Any example projects, tips, or guidance would be greatly appreciated.Thanks in advance!
Greetings,I am in the process of integrating the OpenBootloader Middleware application onto a STM32C011 device.I got the code from the STM32Cube/Repository/STM32Cube_FW_C0_V1.4.0/Middlewares directoryI have the code in an STM32CubeIDE project, and it is not compiling?For example:The C file, Interfaces/Patterns/OPTION BYTES/optionbytes_interface.c, has code to write to aFLASH control register. WRITE_REG(FLASH->PCROP2ASR, (*(Data + 56) | (*(Data + 57) << 8)));Yes, the STM32C0 has not such field name PCROP2ASR in the FLASH_TypeDef structure? ../OpenBootloader/Interfaces/Patterns/OPTION BYTES/optionbytes_interface.c: In function 'OPENBL_OB_Write':../OpenBootloader/Interfaces/Patterns/OPTION BYTES/optionbytes_interface.c:162:22: error: 'FLASH_TypeDef' has no member named 'PCROP2ASR'; did you mean 'PCROP1ASR'?162 | WRITE_REG(FLASH->PCROP2ASR, (*(Data + 56) | (*(Data + 57) << 8)));| ^~~~~~~~~How can this
Hello,I'm attempting to work with the SAI using DMA on the H7S using the NUCLEO-H7S3L8, unfortunately there is no SAI example. There is an I2S example using DMA on the STM32H7S78-DK:https://github.com/STMicroelectronics/STM32CubeH7RS/tree/main/Projects/STM32H7S78-DK/Applications/USB_Device/Audio_StandaloneI've generated a project for the Nucleo using CubeMX, and then brought over the DMA code in the HAL_SAI_MspInit from that I2S example, and modified it for SAI. The result runs, but a user settings error is reported in the DMA interrupt:Here's the complete project:https://github.com/mojolabsdotnet/saiDmaH7SWhat is the right way to setup DMA for the SAI on the H7S?Thanks!
my UART settings are as follows:void USART_Configuration(EUartCom uartCom) { USART_Config(uartCom, COM_BAUDRATE[uartCom]); } void USART_Config(EUartCom uartCom, uint32_t baudrate) { USART_DeInit(COM_USART[uartCom]); GPIO_InitTypeDef GPIO_InitStructure; // DE: GPIO_InitStructure.GPIO_Pin = COM_DE_PIN[uartCom]; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_DOWN; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_Init(COM_DE_PORT[uartCom], &GPIO_InitStructure); GPIO_ResetBits(COM_DE_PORT[uartCom], COM_DE_PIN[uartCom]); // TX: GPIO_InitStructure.GPIO_Pin = COM_TX_PIN[uartCom]; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_25MHz; GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; GPIO_Init(COM_TX_PORT[uartCom], &GPIO_InitStructure); // RX: GPIO_InitStructure.GPIO_Pin = COM_RX_PIN[uart
STM32H563 on custom board. Using NVIC_SystemReset() to reset. It resets consistently.I expect LL_RCC_IsActiveFlag_PINRST() to return true after the MCU comes out of reset. It consistently returns false.NVIC_SystemReset() should result in pin reset, yes?LL_RCC_IsActiveFlag_PINRST() returns false after a restart with STM32CubeIDE debugger also.Could something on the board hold NRST high?
I am testing the Timer and PWM with different combinations to understand it better on NucleoF446RE board. I have configured as belowTimer1 as Master with trigger output as update event, PWM channel1 output on PA8 (interrupt). Timer2 as slave in trigger mode and output PWM Channel1 on PA5 same as LED based on interrupt.Problem is Timer2 Channel1 output does not toggle on PA5 but if i place break point in tiimer2 interrupt is triggered.void TIM2_IRQHandler(void) { /* USER CODE BEGIN TIM2_IRQn 0 */ /* USER CODE END TIM2_IRQn 0 */ HAL_TIM_IRQHandler(&htim2); /* USER CODE BEGIN TIM2_IRQn 1 */ /* USER CODE END TIM2_IRQn 1 */ }Please guide to solve the issue.
Hello, I am using below the libraries with my project.STM32Cube_FW_H7_V1.12.0 (STM32H7xx HAL 1.10.0)- LwIP V2.1.2, FreeRTOS V10.2.1, 2017 - ethernetif.cAnd I designed the HTTP Server with STM32H743ZIT6. It is very well operate.And I updated the libraries such as STM32H7xx HAL 1.11.5 recently.- LwIP V2.1.2, FreeRTOS V10.3.1, 2022 - ethernetif.cAll normal operations are functioning properly. (TCP, UDP)However, an errors is occurring in the HTTP Server.I implemented it by referenceing the LwIP_HTTP_Server_Socket_RTOS example from the STM32H7 HAL repository.When approximately two files are requested simultaneously in a Web Browser, LwIP becomes unresponsive.(Ethernet Event Handler is running when LAN cable Unplug and Plug) (capture packets in old version) (capture packets in new version)There are no changes to the application. (httpserver_socket.c)But, these error continue to appear. I would appreciate any helpful advice. Best regards, 
I have an STM32H7 project (created by TouchGFX) that uses FreeRTOS.FreeRTOS uses the systick, so the HAL uses TIM2 for it's timebase.However, HAL_IncTick is never called, so calls to HAL_Delay never return.HAL_InitTick() is being called during startup and this results in TIM2 counting and its update interrupt flag being set. However, the interrupt handler never gets called.
HI, I'm using stm32h7s78-dk, and setup the external flash following this tutorial The "appli" project is in external flash and runs with no issue. Now I want to write some config data such as display brightness to the external flash according to user input but I can't find a way to do that. I tried HAL_FLASH_Program(), but it seems can only modify the internal flash. Then I tried to enable EXTMEM_MANAGER_APPLI in CubeMX to use EXTMEM_WriteInMappedMode(). However, I can't reinitialize the xspi in "appli" project..What is the appropriate way to do this? Any input is much appreciated!
Hello,I need to build a USB headset(mic+speaker) using STM32H742VIT6 for a project. I want the stm32h7 to be recognized as a audio device when connected to a PC/android device. Is this possible?This is my first time using a STM Board with cubeMX and cubeIDE, so I want to build the microphone part first. I am having trouble programming the board, specially what middleware to use, how the structure of the project works in the ide, what would be the setup e.g. clock config, dma, adc, timer configuration. It would be nice if I could get some resources/guide on how to start, because I am lost inside the mx and ide!Hardware: WeAct Studion STM32H742VIT6MAX4466 mic
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.