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
Hello, everyone on the forum.I am using an STM32H735IG, ThreadX, and FileX to create files on an SD card and write data to them. In each iteration, I open the file using `fx_file_open`, seek to the end of the file using `fx_file_relative_seek`, write data using `fx_file_write`, close the file using `fx_file_close`, and finally flush the media using `fx_media_flush`.When performing this operation, each file write takes about 10 milliseconds. If I want to write multiple files in a short amount of time, should I use multithreading and have each thread write a file? Also, when writing data to a file on a regular basis, is it okay to keep the file open and write the data without calling `Open` and `Close`?How often should I run fx_media_flush? I’d appreciate any advice you can offer.
Could you provide a routine for reading and writing external flash using spi+dma+ interrupt in the STM32F407 standard library?
Hello,The STM32Cube project Template_LRUN is failed on STM32H7S78-DK:STM32H7S78-DK, MB1736-H7S7L8-D01SW is from the latest master of https://github.com/STMicroelectronics/STM32CubeH7RS/tree/main/Projects/STM32H7S78-DK/Templates/Template_LRUNI also double check with the stm32cubeh7rs-v1-3-0.Follow the instructions from readme:Build Template LRUN projects with CubeIDE v2.0.0Use CubeIDE to load Template_LRUN_Boot.elf to internal flashUse CubeProgrammer to program Template_LRUN_Appli.bin to external Nor-Flash and success.Powerup the DK board and no LED is light-on.By tracing the boot program, the MCU is hangup when copy the program from Nor-Flash to PSRAM. Crash happen on exact the copy to the first address in PSRAM. It seems PSRAM is not ready.The error occurs at: https://github.com/STMicroelectronics/stm32-mw-extmem-mgr/blob/5c92d55af712b20030853a8ac7ddf87ab9eb1adf/psram/stm32_psram_driver.c#L138 /* Execute the command sequence */ for (uint8_t command_index = 0u; command_index < Psra
Hello everyone,If you've ever tried running Azure RTOS with an HTTP server, an FTP server, multiple TCP sockets, and a handful of threads on a standard NUCLEO-144 board, you know exactly where this is going.You hit the memory wall.1 MB of internal RAM sounds like a lot — until ThreadX, NetXDuo, and FileX each want their own byte pools, packet pools, and thread stacks. Add an HTTP server for a web interface, an FTP server for remote file access, and you're fighting for every kilobyte before your actual application even starts. And storage? The NUCLEO boards don't have any. If you want to serve a web dashboard or datalog sensor readings, you're out of luck.Then there's the documentation gap. ST provides excellent examples for HTTP servers with NetXDuo. FTP gets reasonable coverage. But WebSockets? Real-time bidirectional communication between a browser and your STM32? Good luck finding an ST example for that. And it's the one thing that turns a static web page into a live control interfa
I've developed my own PCB using an STM32H723ZGT6 microcontroller. I'd like to store data to a microSD card that's onboard, and I've designed it to use SDMMC2 for the better transmission rate. I have no external pullup resistors, but I have enabled the internal pullup resistors (found to be 38kOhms using a multimeter) on each of the data lines and the CMD line. I have ESD protection inline using the EMIF04-1005M8. The bus is configured in 1-bit mode until successful connection is made. Additionally, I've tried two different micro SD cards, a 32GB SanDisk, and an 8GB Gigastone micro SD card. I run into issues in HAL_SD_Init, which is called in the MX_SDMMC2_SD_Init. I've stepped through the code using the ST-Link and have found the issue to be in this loop: while (!__HAL_SD_GET_FLAG(hsd, SDMMC_FLAG_RXOVERR | SDMMC_FLAG_DCRCFAIL | SDMMC_FLAG_DTIMEOUT | SDMMC_FLAG_DATAEND)) { if (__HAL_SD_GET_FLAG(hsd, SDMMC_FLAG_RXFIFOHF)) { for (count = 0U;
Hi everyone!I have generated a code from CubeMX for USB-PD in bare-metal configuration like this: Then I started testing the code and the function USBPD_PE_Init at this line: /* PE SET UP : Port 0 */ CHECK_PE_FUNCTION_CALL(USBPD_PE_Init(_port_index, (USBPD_SettingsTypeDef *)&DPM_Settings[_port_index], &DPM_Params[_port_index], &dpmCallbacks));returned false.I have looked in the assembler window and found out that some members of static const USBPD_PE_Callbacks dpmCallbacks = { USBPD_DPM_SetupNewPower, USBPD_DPM_HardReset, NULL, USBPD_DPM_Notification, USBPD_DPM_ExtendedMessageReceived, USBPD_DPM_GetDataInfo, USBPD_DPM_SetDataInfo, USBPD_DPM_EvaluateRequest, NULL, NULL, // Like this one!!! USBPD_PE_TaskWakeUp, #if defined(_VCONN_SUPPORT) USBPD_DPM_EvaluateVconnSwap, USBPD_DPM_PE_VconnPwr, #else NULL, NULL, #endif /* _VCONN_SUPPORT */ USBPD_DPM_EnterErrorRecovery, USBPD_DPM_EvaluateDataRoleSwap, USBPD_DPM_IsPowerReady };are not a
Hello,As a lot of people here, i'm trying to implement USB in standalone mode (bare metal, no OS used).I'm using NUCLEO-STM32WBA65RI board.CubeDE 1.19CubeMX 6.15.0 still can't make it work. I'm looking for help. I checked a lot of forum posts, a lot of github pages.I based myself on :https://github.com/STMicroelectronics/x-cube-azrtos-h7/blob/dev/usbx/Projects/NUCLEO-H723ZG/Applications/USBX/Ux_Device_CDC_ACM_Standalone/USBX/App/app_usbx_device.cand tried to implement the AzureRTOS USBX standalone versionHere is my Cube MX configuration :Clock USB :I only used X-CUBE-AZRTOS-WB and desactivated USBX : Using buffer <10*1024 would rise a memory error flag in ux_device_stack_initialize() : The rest is default configuration. Then USB_OTG_HS : Device_Only and :Then i generated the code,I added : if(MX_USBX_Device_Init() != HAL_OK) { for(;;); }And inside of it : /* USER CODE BEGIN MX_USBX_Device_Init1 */ USBX_APP_Device_Init(); /* USER CODE END MX_USBX_Device_Init1 */A
Hello everyone!I am using stm32n6570-dk. My project has only FSBL and was generated using STM32CubeMX. I was able to run it in debug mode without issues. The code does not execute when flashed to external flash memory. I had to comment out "MX_ICACHE_Init();" for the code to run from external memory. I thought there may be a configuration issue from my side. So I ran the "Starter project" provided by STM located at "STM32CubeN6\Projects\STM32N6570-DK\Templates_Board". This code also runs fine in debug mode. It does not work when flashed to external memory without commenting out "MX_ICACHE_Init();".I expect the example code to work without modifications. I figured out that the program does not reach the error handler and gets stuck in HAL_ICACHE_ConfigAssociativityMode(). This is when flashed to external memory.if (HAL_ICACHE_ConfigAssociativityMode(ICACHE_1WAY) != HAL_OK){Error_Handler();}Within HAL_ICACHE_ConfigAssociativityMode() it gets stuck in READ_B
Hi Community,Today you will provide the answers, and I will ask the questions!Looking at the statistics gathered by our tools (assuming customer consent given), we can see the huge popularity of designing software relying on an RTOS. FreeRTOS is widely used, and we assume that the adoption Azure ThreadX will also spread quickly.As CubeIDE tools guys, we have invested some effort in RTOS debug features. To quickly summarize the RTOS debug offer, let's make a list:Window > Show > View > Other > FreeRTOS / ThreadXProvides views to visualize kernel objects for the 2 RTOSesDebug config > Debugger > Enable RTOS ProxyWill allow the debugger to unwind and display the full call stack for ALL threads in the RTOS, not only the one currently in context!For Azure ThreadX CubeIDE 1.8.0 can also conveniently export trace logs to be visualized "offline" in Microsoft TraceX toolIn our view the RTOS support is now quite decent! ;)What is puzzling is the lack of feedback and bug reports
Hi,Having successfully installed SW4STM32 I recently tried to build the example project detailed on the RIP Tutorial web page entitled "First time setup with blink LED example using SW4STM32 and HAL library". This "threw up" four errors. The first was classed as a fatal error whilst the other three errors involved "make" which I believe are due to the first error.Within the IDE, on the "Problems" tab, the first error is listed as follows.Description: fatal error: usbh_conf.h: No such file or directoryResource: usbh_conf.hPath: /STM32F4_Discovery_Blinky/Middlewares/ST/STM32_USB_Host_Library/Core/Inc line 28 C/C++ ProblemWithin the ".../Inc/" directory is a further subdirectory called "usbh_core.h" within which is the "offending" (non-existent?!) usbh_conf.h This header file is clearly listed on both the Project Explorer and Outline tabs within the IDE. Opening this file shows the following. (How could this be done if the file did not exist ?!) /** **********************************
The integrated ST-Link debugger/programmer on STMicroelectronics NUCLEO boards is widely appreciated for its ability to output messages to a serial port, enabling easy debugging and communication with host PCs. However, setting up the board to not only send but also receive commands from PC-based applications such as Tera Term requires additional programming effort. This guide will walk you through the steps to implement bidirectional serial communications, allowing your NUCLEO board to interact dynamically with your computer.
Hello Community,I tried with different boards (073, 093, 533, 401) to work with the SPI1 or SPI2.I used the examples, but there is no clock on an SPIx clock pin.e.g. HAL_SPI_Transmit(&hspi1, SpiData, 2, 100); Has anybody a working STM32Cube porject to load in the STM32CubeIdefor an SPI only master (no slave no DMA) in the send modus via MOSI pin.Thank youMichael
Hello everyone!I am currently working on a speaker project that gets audio data from a microsd card over spi and sends it over i2s with DMA.I noticed that the main issue is the latency from the sd card so i got the adivce to use a triple pointer ring buffer.I searched for implementations on triple buffering with i2s but couldn't find a single one.I tried implementing it but it didn't work.(i added the code file to the post)Does anybody have good resources to learn this?
Hello, I am working with STM32H750 and encountered an issue related to SPI communication in low-speed mode. Issue description When operating SPI in low-speed (e.g. prescaler /128, ~195 kHz), I observed that: The last SCLK high pulse becomes shorter than the others This may affect correct sampling of the last bit on the slave side This behavior seems consistent with Errata 2.22.6: "Truncation of SPI output signals after EOT event" Root cause understanding From the errata description and signal observation, it appears that: The SPI peripheral is disabled too quickly after the EOT event Since the CPU (PCLK domain) is much faster than SCK,the last SCLK high period is truncated Implemented workaround To address this, I modified the HAL driver (stm32h7xx_hal_spi.c::SPI_CloseTransfer()) to introduce a short delay between EOT and SPI disable, only in low-speed conditions. Instead of using a fixed delay, I implemented a minimal delay proportional to SCK period, to avoid unnecessa
I'm trying to get a basic example of USB comms working on an STM32U575 chip working. I've looked into several bits of example code, but they all just say "it should just work" and don't. STM32CubeU5 Example. This seems like a logical choice, as it's packaged in the FW pack that I'm currently using. But I can't get the VSCode STM32Cube extension to recognize that it's a project and build. I've tried moving the STM32CubeIDE directory contents (.cproject, .project, etc.) to the root of the application directory, but it's still not being recognized. Also, looking into Core directory, I don't see any code that demonstrates USB data transfer. It looks like a template for starting with AzureRTOS, but nothing beyond that. What am I missing?USB_Device Middleware. This is one example that describes using a middleware called USB_DEVICE, and then calls to a function CDC_Transmit_FS(). There are several other examples floating around with this. H
Hi all, X-CUBE-AUDIO-KIT has a project for STM32H573I-DK but this discovery kit has a very small LCD screen. I see the soon to be available STM32H5F5J-DK with a larger screen. Both of these kits have an M33 core MCU so technically the example for one could be ported to the other but that's not something I'll like to do. Will there be an upgrade to X-CUBE-AUDIO-KIT anytime soon and will it include any examples for STM32H5F5J-DK? Thanks
Hi everyone, I’m working on an STM32N6 project configured with: ThreadX running in Non-Secure SAU configured RISAF configured External Memory Manager enabled(Load and Run mode) The project is very simple. However, when debugging the Non-Secure application, as soon as tx_thread_schedule() is called, execution jumps to HardFault.The Fault Analyzer reports: “Attempt to do exception with bad value in EXEC_RETURN number (INVPC)”. The code is loaded in external flash memory using Load and Run mode, the signed bin files are uploaded in the external flash using STM32CubeProg and then debugged using STM32CubeIDE.Has anyone experienced INVPC errors on STM32N6 with ThreadX in Non-Secure?Any suggestions would be greatly appreciated.
Hello everyone,we have a setup where the STM32U375 MCU is the slave in I2C communication.We want to NACK the host request on certain conditions. Basic description of our firmwareWe are internally using a register structure in the MCU and the host can send a read/write request via I2C to access the contents of the registers.The current register address is handled internally by the firmware and automatically incremented on each byte written / read.For example, if the requested register address is 0x0001, the host should not be allowed to write to the register but only to read it.First we receive the one-byte device address, then the 2-byte register address.After receiving the 2-byte register address, we can check if the host is allowed to read/write on this register and want to either ACK or NACK the communication on I2C1. Solution tried but not successfullIt seems when HAL_I2C_AddrCallback is called then it is already too late to NACK the current byte and the hardware has alre
Hello, a while ago I ran into a problem with my system consuming to much power.After searching this forum, I came across this post: https://community.st.com/t5/stm32-mcus-wireless/using-stm32wb55-freertos-osthreadflagswait-can-return/td-p/767777 It describes how osThreadFlagsWait adjusts the timeout and explains that this can cause problems.In the thread i described my problem with this function (see below), but I was asked to post that question in a new thread.No problem, of course, so I did :) I discovered another annoying problem with osThreadFlagsWait.I was measuring the current consumption to check if it was sufficiently low in case the system goes into stop2.To my surprise, I discovered that it wasn't (draining 6mA instead of 30uA).After a long search, I discovered that the high-consuming task state wasn't "suspended", but "blocked"!A little later, I realized this would happen when I called osThreadFlagsWait.I assumed the timout value could be osWaitForever, so the task wo
Hello everybodyI'm working with USB PD sink on my own board with STM32G071KBT6 microcontroller ad development software: STM32CubeIDE 2.1.1 and STMCubeMX 6.17 (freeRTOS, without TCPP, with my own protection of VBUS and CC lines).I want to set sink to APDO 24 V (if the charger accept it) or otherwise 20 V PDO.Unfortunatelly if the charger, which I use, not accept APDO 24 V, it send hardreset and cut off the Vbus, so I can't use the flag to inform about the status (APDO or PDO).Is there any way to read the PDOs from the source and on based on this choose APDO or PDO?I have no structure DPM_Ports, and USBPD_DPM_GetDataInfo(PortNum, USBPD_CORE_DATATYPE_RCV_SRC_PDO, buffer, &size);returns size = 0;Best regards
Hi everyone,I have developed a custom USB DFU HOST class, which I use to update other stm over the usb.I was first on the F4 series, but now switched to the G0 series because of this issuehttps://community.st.com/t5/stm32-mcus-embedded-software/usb-writepacket-stuck-in-infinite-loop/td-p/870532I am using external bypass clock, but the update worked also on HSI just fine.These are all the bootloader versions and the chips I was able to update without any issues:14.4 H573I-DK9.2 L562RET69.0 F446ZE-NUCLEO3.3 F207ZG-NUCLEOBut when I try to update the H745I-DISCO or the H743, the update does not work.I checked the bootloader version on the H745I-DISCO and it's 9.0, which is the same version as F446ZE-NUCLEO which I update without any issues.The update process to update H745I-DISCO worked one in 100 or 200 tries.I have tried messing with timings, clocks, adding prints in the interrupt to slow things down (I know that it's a bad practice), an
Hello,after setup SPI1 and setting CSTART=1, I expected that SPI is send immidiatly on bus.(I toogled PE00 with CSTART=1)I couldn't find some that explains that behaviour. It behave the same, if I use DMA or writing directly to TXDR.Do you have an idea ?My testcode. SPI1->IFCR = 0xFFFF; // Clear all flags MODIFY_REG(SPI1->CR2, SPI_CR2_TSIZE, BufferSize); SPI1->CR1 |= (SPI_CR1_SPE); SPI1->CR1 |= SPI_CR1_CSTART; GPIOE->ODR &= ~(1 << 0); for (u32 i = 0; i < BufferSize; i++) { LL_SPI_TransmitData8(SPI1, pBuffer[i]); }CPU is set to 160Mhz and SPI Prescaler is 256
Setup: STM32F411RE + STM32CubeIDE + X-CUBE-AZRTOS-F4 v1.1.0 + TIM4 as HALtimebase Problem: Thread runs once, toggles LED, then hangs inside tx_thread_sleep(50) and never wakes up. Debugger shows:System Timer thread → State: SUSPENDED, Run Count: 0Thread 1 → State: SLEEP, Run Count: 1 System Timer never runs, so sleeping threads never wake up.Question: Why is the System Timer thread never getting scheduled? Any known issues with X-CUBE-AZRTOS-F4 v1.1.0?
Hi,We are running a crypto key generation library on both an STM32G474 (170MHz) and an STM32H563 (240MHz).Over about 80 runs, the average generation time is around 12 seconds for the H5 and 38 seconds for the G4.These times are fine for our application (although faster would be better) but I am curious why the G4 is over 3 times slower as I would have expected something more like 40% longer generation times.The arithmetic part of the library uses some assembler functions for long multiplications and, for both processors, these seem to have picked a section for "Armv6-M (or later) with DSP Instruction Set Extensions."The compiler flags being used are listed here. The repeated sections are because I still haven't really figured out how cmake is generating them but I believe the relevant differences are:-mcpu= cortex-m4 or cortex-m33-mfpu= fpv4-sp-d16 or fpv5-sp-d16compile C with /usr/bin/arm-none-eabi-gcc__VERSION__ "14.2.1 20241119"G4 Flags:C_FLAGS = -mcpu=cortex-m4 -mfloat-abi=hard -mf
Hi,I am using a STM32WB5MMGH6 BLE module and for some reason HAL_IncTick() is not being called. It is baffling because it was working perfectly well when I was recently working on it before switching to another project for a week.I stripped the project down to almost nothing and placed a HAL_Delay() right after the CubeMX-generated initialization code in main(). So no custom code could do anything to affect that behavior (like turning off interrupts etc). However, the delay never completes.The code is stuck inside the while loop in HAL_Delay() because HAL_IncTick() is never being called (i.e. the system tick is not incrementing) so the HAL_GetTick() always returns 0. __weak void HAL_Delay(uint32_t Delay) { uint32_t tickstart = HAL_GetTick(); uint32_t wait = Delay; /* Add a freq to guarantee minimum wait */ if (wait < HAL_MAX_DELAY) { wait += (uint32_t)(uwTickFreq); } while ((HAL_GetTick() - tickstart) < wait) { } } The Timebase Source is set to SysTick
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.