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 am trying to implement Mass storage class in STM32U083RCT6. i thought to implement mass storage on external flash but it is not happening for RAM memory itself USB is not working.
Hello. I have a custom board with a STM32U5F9 device, it has a 1-lane DSI connection to a 240x320 colour display with a JD9852 Controller. This works fine in LP mode; I can initialise the JD9852 controller and write to the GRAM using DSI commands in LP mode- this all works great. I can use Adaptive Command Mode to send my frame buffer to the display via the LTDC & DSI in LP mode. But, when I enable HS mode for LongWrites, the data sent after a HAL_DSI_LongWrite call, observed on my scope, is not as expected for a DSI LongPacket format. I can see the DSI bus going from LP to HS mode as expected, I can see the SoH byte pattern, but after that the bytes on the line are always wrong. (I'm counting data bits on each pos, neg DSI clock edge). Example. I send 8 bytes of FE'h via a LongWrite command so I expect to see 15 bytes on the DSI data line; (SoT) (39 09 00 ECC) (2C FE FE FE FE FE FE FE FE) (CS CS) (EoT) (Sot) (Header) (Payload) (Checksum) (EoT) But I actually observe only
I have tried USB examples for Stm32F070, F401, F407 Black board and calling a single "CDC_Transmit_FS" function to print a string but none is working. The hcdc->TxState value is some garbage big value so it always stay busy and also not getting interrupts for USB receive as I have put break points in it too. The STM32 device show up as "composite" instead of VCP. For configuration it is RCC->Bypass Clk, USB connectivity->Device Only, USB_Device->VCP, heap size->0x1000.
I am using STM32U5G9 implementing USB MSC device. When calling function ux_device_stack_initialize(), it returns error 18, which is correspond to UX_MEMORY_INSUFFICIENT. This error happens line 397 of use core file ux_device_stack_initialize.c. if (endpoints_pool -> ux_slave_endpoint_transfer_request.ux_slave_transfer_request_data_pointer == UX_NULL) { status = UX_MEMORY_INSUFFICIENT; break; } May I know how to fix this error?
STM32WB55arm_rfft_fast_instance_f32 fft_instance; arm_rfft_fast_init_f32(&fft_instance, NUM_SAMP);I'm trying to use the rfft_fast function from the arm_math.h libraryBut when I compile I get... ../STM32_WPAN/App/custom_app.c:122:24: error: expected declaration specifiers or '...' before '&' token122 | arm_rfft_fast_init_f32(&fft_instance, NUM_SAMP);| ^../STM32_WPAN/App/custom_app.c:69:25: error: expected declaration specifiers or '...' before numeric constant69 | #define NUM_SAMP 256 I looked at the docs & many examples of the init function, the usage is always as above. Compiles fine if I comment out the init function but obviously that is of no use to me.
Hi everyone,I'm working on a project using the STM32F103C8T6 microcontroller and the ICM-20948 IMU sensor, connected via I2C. I'm using STM32CubeIDE with FreeRTOS integration.In a bare-metal (non-RTOS) project, the IMU communicates correctly. The device address is detected properly, and I get valid accel/gyro data.When I move to a FreeRTOS-based project using the same I2C configuration, the IMU fails to respond.The device address is not found, and I get errors from HAL_I2C_Mem_Read().I've confirmed that I2C are initialized before osKernelStart(). want to reliably read IMU data (ICM20948) using I2C + FreeRTOS on STM32F103C8T6.Can anyone who has done this successfully share suggestions or example code?
What's wrong with my code? Every time I start a DMA transfer only 2 Bytes get transferred although I specified 16 bytes.Also, I get an FIFO Error after transmit, whereas Transmit Complete is ok./* FUNCTION ************************************/ void SPI1_Init (void) /************************************************/ { LL_SPI_Enable (SPI1); LL_DMA_EnableIT_HT (DMA2, LL_DMA_STREAM_3); LL_DMA_EnableIT_TE (DMA2, LL_DMA_STREAM_3); LL_DMA_EnableIT_TC (DMA2, LL_DMA_STREAM_3); LL_DMA_EnableIT_DME (DMA2, LL_DMA_STREAM_3); LL_DMA_EnableIT_FE (DMA2, LL_DMA_STREAM_3); } /* --- SPI1_Init --- */ /* FUNCTION ************************************/ void SPI1_Write_DMA (uint8_t *buff, uint16_t count) /* * Write a complete buffer to SPI with DMA ***********************************************/ { uint32_t reg_addr; reg_addr = LL_SPI_DMA_GetRegAddr(SPI1); LL_DMA_ConfigAddresses (DMA2, LL_DMA_STREAM_3, (uint32_t)buff, reg_addr, LL_DMA_DIRECTION_MEMORY_TO_PERIPH); LL_DMA_SetDataLength (DMA2, LL_DMA_STREAM
Hello Sir/Madam, My project is using Nucleo-F767Zi + X-NUCLEO-IKS4A1. The calibration data need to store in STM32F767ZI flash memory. I have coded writing and loading function for this purpose. However, the data read out from the flash memory are different from the data written into with forementioned functions. I do appreciate your help for debugging my codes and sorted out the issues. My codes are: /** ****************************************************************************** * @file motion_ac_flash.c * @author ChatGPT * @brief 实现 MotionAC 加速度计校准参数的 Flash 存取功能 * - 使用 STM32F767ZI 的内部 Flash(Sector 11) * - 支持写入后逐字校验 * - 保证读取与写入数据完全一致 * - 自动刷新 D-Cache,避免缓存导致读出旧数据 ****************************************************************************** */ #include "motion_ac_manager.h" #include "motion_ac.h" #include "stm32f7xx_hal.h" #include <string.h> #include <stdio.h> /* -------------------------------------------------------------------------- * Flash 存储地址设置(根据 STM32F767
Hi,I attempt to free the 1st sectors of the MCU flash by relocating the firmware and its interrupt vector table to further sector (e.g sector 5 at 0x08040000 address). For that purpose, I updatedthe linker (IAR) configurationthe vector table location by setting SCB->VTOR (set to 0x08040000)the boot address option byte BOOT_ADD0 (set to 0x2001 to get the 0x0804000 boot address)This configuration is only working from my debugger. The system does not start, neither in standalone, neither from the Go command of the system bootloader.However, the Reset Handler address is well available at the 0x08040004 address.Ifthe interrupt vector table is located at the 0x08000000,the code remains at the 0x08040000 address,SCB->VTOR is updated to 0x08000000,BOOT_ADD0 set to 0x80 (i.e. 0x20000 boot address) or set to 0x2000 (i.e. 0x08000000 boot address),the system is able to start, either in standalone, either from the Go command of the system bootloader.What did I miss to get the system starting
Dear all,For a project I'm generating a sin wave with DAC and sampling concurrently with two ADC's. Both DAC and DMA are updated by the DMA. The DAC is triggered by a timer and the two ADC's by another timer.Details of my setup:- STM32G491- DAC3 routed via internal opamp as voltage follower, running at 25MHz in DMA double data mode, trigger source: TIM3 update event.- ADC1 channel1, ADC2 channel2, both fed by PLLP at 60Mhz, independent mode, continues conversion mode disabled, trigger source: TIM7 update event, 12-bit resolution, 2.5 cycles sampling time, DMA in normal mode.- TIM3 triggers DAC running at 25MHz.- TIM7 triggers ADC1 and ADC2, running ideally at ~4MHz.- APB and AHB busses all running at 150MHz The problem I'm facing is that the ADC's seem to skip some samples at fixed interval as can be seen in the figure below. I can't figure out what's the problem.I already have tried the following, all without any changes in the skipping of the samples:- Lower the triggering frequ
Hey,I want to Integrate with Lora module sx162 with stm32 Board. Can any one Help me ??
Hi there,I am working on a project that requires sending just two commands to an FT232 chip and waiting for the response data.I can already successfully communicate the STM32 USB HOST CDC and the STM32 USB DEVICE CDC (refer to repo's first commit ).However, while I was trying to modify the USB HOST CDC example to work with FT232(refer to the above repo's second commit), it didn't work.Can anyone give me some advice or demo code?Thank you.
the sample code I2C_TwoBoards_ComDMA for the STM32H563 EVB.On the host side, if the command length is unknown and may vary from one to three bytes, how can I modify the following function to handle a variable-length transfer based on I2C received size of bytes instead of a fixed size?HAL_StatusTypeDef HAL_I2C_Slave_Receive_DMA(I2C_HandleTypeDef *hi2c, uint8_t *pData, uint16_t Size)Thanks
Hello,I have been working on a project recently that has me using the SPI1 and 2 peripherals to perform conversion between a non-standard serial format and TCP/IP. I have SPI 1 set up as a transmit-only master which takes data received via TCP/IP and sends it to another device using HAL_SPI_Transmit_DMA. This works fine by itself.I also have SPI2 set up as an rx-only slave. This receives incoming variable length serial data from another device that has a head and tail sequence to identify each packet. These come in very slowly at 64khz, and are only sent once every 200ms. A tim2 interrupt triggers a scan of the circular buffer they are received into, and if a header/tail is found then the SPI is halted, pointed at the other of two buffers, and restarted, and the rxed packed is DMAed out into memory. This also works fine by itself.My problem is that calling HAL_SPI1_Transmit_DMA causes the data received by SPI2 to be bitshifted right anywhere from 1-8 bits, so the head/tail sequence can
Hello!This function was defined and used instead of memset to reset mbedtls's sha256 context. Is there a good reason behind this choice?https://github.com/STMicroelectronics/STM32CubeH7/blob/master/Middlewares/Third_Party/mbedTLS/library/templates/hash_stm32.c /* Implementation that should never be optimized out by the compiler */ void hash_zeroize( void *v, size_t n ) { volatile unsigned char *p = (unsigned char *)v; while (n--) { *p++ = 0; } }
I've written a flash-based bootloader for the STM32F4 using the latest STM32CubeMX tool and its HAL libraries. I've avoided all the usual pitfalls (it's not my first bootloader), and my code works reliably. I'm not erasing my bootloader segment, writing to the wrong address, or failing to account for the instruction pipeline stall that a flash write causes. So far, so good. However, one problem I encountered was that on power-up, BEFORE any flash operations were done, I would generally find that the flash alignment and parallelism error flags were set. Moreover, during the course of writing a 200K byte image to flash in small chunks, I randomly encounter these error flags after successfully writing data to the last byte in a 256-byte page (this happens at various places in mid-sector, not at the sector boundary). Specifically, the call to HAL_FLASH_Program() to write a byte at a 256-byte boundary fails because the PGP and PGS flags got set after the end of the last (verified
I'm working on RTC smooth digital calibration on an STM32U575 board using the HAL function HAL_RTCEx_SetSmoothCalib(). I'm using the LSE (32.768kHz) as the RTC clock source.What I'm trying to do:I want to adjust a known RTC drift (e.g., 500ms) over time using the RTC’s smooth calibration feature. I understand that I can configure the calibration window to 32s, 16s, or 8s using the SmoothCalibPeriod parameter, and that I can add or subtract pulses (each approx 30.5µs) to speed up or slow down the RTC.What I expected:With a 32s window, each call to HAL_RTCEx_SetSmoothCalib() can adjust ~15.6ms max (512 pulses × 30.5µs). So, it should take about 1024s (500 / 15.6 = 32 calls every 32s) to fully adjust 500ms. With a 16s window, I expected the correction rate to double, since the same pulse change should now apply over a shorter time, and thus the 500ms adjustment should take ~512s (500/15.6 = 32 calls every 16s).What I’m observing:When I call the function with RTC_SMOOTHCALIB
Hi,I am using a NUCLEO-G071RB development board. I accidentally erased the original bootloader while flashing a custom one. Is it possible to reflash or restore the built-in bootloader on the NUCLEO-G071RB development board? If so, where can I obtain the original bootloader file? Thanks,Aiswarya
I am having issues when writing a buffer that is declared in the external buffer to an SD card. When I tried to download a bulk file (1.5MB), write failure (f_write returns FR_DISK_ERR) would happen at least once during the download process, but if I declared the buffer in the internal RAM, I didn't have the problem. Example of my linker: /* Memories definition */MEMORY{RAM (rw) : ORIGIN = 0x20000000, LENGTH = 499K /*512K*/FLASH (rx) : ORIGIN = 0x8008000, LENGTH = 2048K - 0x8000SDRAM (rw) : ORIGIN = 0xC0000000, LENGTH = 16MMemory_B1 (rw) : ORIGIN = 0x2007C000, LENGTH = 0xA0Memory_B2 (rw) : ORIGIN = 0x2007C0A0, LENGTH = 0xA0QUADSPI (rw) : ORIGIN = 0x90000000, LENGTH = 16M}.....buff_sec (NOLOAD) :{. = ABSOLUTE(0xC0144100);*(.buff_Section)} > SDRAM//code example - buffer definitions__attribute__((aligned(4))) static FILE_SYS_BUFFER _bulkdwldBuff __attribute__((section(".buff_Section")));If I remove "__attribute__((section(".buff_Section")))" from t
Hello,An ST employee wrote this article: https://community.st.com/t5/stm32-mcus/how-to-use-the-stm32n6-in-overdrive-mode/ta-p/810926where you can increase the voltage to the STM32 core to get higher performance. I have 3 questions regarding this article.1- it says you need to use PF4 to kick the processor in overdrive. Does PF4 need to be used (ie special function) or can any GPIO be used? (ie is PF4 just used on the STM32N657-DK board)?2- Since ST published this article, are there any benchmarks or data (ie bus speeds) that were recorded when the core voltage was increased from 0.8V to 0.89V. It would be nice to know if we should implement this mod, or its really not worth it. What about reliability over time?3- I purchased the STM32N657-DK development board. Is the source code available for the demo on the board, and if so, where can I download it. It says by default the DK is not in overdrive mode, so I would like to modify the code to enable
Hello ST Community, I’m working with the NUCLEO-H533RE. The MCU is feature-rich (three PLLs, robust comms, and onboard USB wired to a USB-C connector) and I’m running the system clock at 250 MHz. I’ve migrated the project to ThreadX (since the old USB stack isn’t provided for this part with FreeRTOS), and the USB stack is the USBX integration. ThreadX alone comes up clean, but as soon as I enable USBX the application stalls—my threads stop cycling and the system appears to hang. I’m likely missing a configuration detail in the USBX/ThreadX bring-up. If someone with deep experience on STM32H5 + ThreadX/USBX could point me to the typical culprits (initialization order, memory pools/stack sizes, NVIC priorities/interrupt routing, cache/MPU settings, or any H5-specific gotchas), I’d really appreciate it. Happy to share configuration snippets, clock tree, and MX-generated code if that helps. Thanks in advance,Val
Does the STM32N657 run AzRtos / threadx / filex / etc? The libraries don't seem to be available in the latest IDE. Is this coming soon?
I'm trying to build a simple HTTP server using Mongoose with the LWIP IP stack on FreeRTOS CMSIS_V1. It is important that I let LWIP handle the network interface since I'm also using it to advertise a service using mDNS. This is what my task looks like:void StartMongooseTask(void const * argument) { /* init code for LWIP */ MX_LWIP_Init(); /* init code for USB_DEVICE */ MX_USB_DEVICE_Init(); while (netif_default == NULL || !netif_is_up(netif_default) || !ip4_addr_isany_val(*netif_ip4_addr(netif_default)) ) { osDelay(100); } extern struct dhcp_state_enum_t; struct dhcp *dhcp_client = netif_dhcp_data(netif_default); while (dhcp_client == NULL || dhcp_client->state != 10) { osDelay(100); } ip = *netif_ip4_addr(netif_default); printf("IP acquired: %u.%u.%u.%u", ip4_addr1(&ip), ip4_addr2(&ip), ip4_addr3(&ip), ip4_addr4(&ip)); mdns_resp_init(); mdns_resp_add_netif(netif_default, "22223335", 3600); mdns_resp_add_service(netif_defa
I’m using the STM32F401RET6 board, collecting data from a USB accelerometer at 16 kHz.I wanted to verify that the data is actually being collected at 16 kHz, and then run an FFT to compare it with previously collected PC data. To do this, I need to transfer the data to the PC.At first, I tried collecting data and transmitting it with HAL_UART_Transmit, but due to the transmission overhead, the actual sampling rate wasn’t 16 kHz—it dropped to about 9 kHz.So I tried using the DMA + double buffer method, where data collection and transmission happen simultaneously. I structured my task like this: void vUSBReadTask(void *pvParameters) { AUDIO_HandleTypeDef *audio_handle; uint8_t *buf; static uint8_t isoc_submitted = 0; for (;;) { MX_USB_HOST_Process(); audio_handle = (AUDIO_HandleTypeDef *)hUsbHostFS.pActiveClass->pData; if (!(audio_handle && audio_handle->microphone.supported)) { // taskYIELD(); continue; } buf = audio_handle->microphone.buf; // Submit
Hi, I'm having the following issue with the F103C8 USART DMA.After reset, sometimes the USART DMA Receive doesn't work. It doesn't happen every time, but it happens about once every 10 resets. HAL_UARTEx_ReceiveToIdle_DMA(&huart1, (uint8_t *)RxDataUsart1, 128); __HAL_DMA_DISABLE_IT(&hdma_usart1_rx, DMA_IT_HT); HAL_UARTEx_ReceiveToIdle_DMA(&huart2, (uint8_t *)RxDataUsart2, 128); __HAL_DMA_DISABLE_IT(&hdma_usart2_rx, DMA_IT_HT);void HAL_UARTEx_RxEventCallback(UART_HandleTypeDef *huart, uint16_t Size) { if(huart == &huart1) { timer_UART1_Datalost = millis(); uart_1_Ready = SET; __HAL_UART_CLEAR_FEFLAG(&huart1); memcpy(copyRxDataUsart1, RxDataUsart1, 128); copyRxDataUsart1[127] = '\0'; usart1Datareceived = 1; for (int i=Size; i < 128; i++)RxDataUsart1[i]=0; } __HAL_UART_ENABLE_IT(&huart1, UART_IT_IDLE); HAL_UARTEx_ReceiveToIdle_DMA(&huart1, (uint8_t *)RxDataUsart1, 128); __HAL_DMA_DISABLE_IT(&hdma_usart1_rx, DMA_IT_HT); if(huar
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.