Ask questions and find answers on STM32Cube packages, including HAL, LL and middleware, and expansion software.
Most recent activity
Dear all,I'm reading a file on sd card by spi interface on my NUCLEO board using this example: https://github.com/kiwih/cubeide-sd-card/I find that the speed reading 1500 bytes is near 30ms. On Arduino with a 16mhz clock I read them in 7msWhy we have this difference? May be a library problem? The prescaler I set the SPI CLOCK is /4 and the clock is 48MhzThank you to who will help.Nello
Hi,I'm trying to implement SPI slave on STM32U535 ( I have also NUCLEO-U575I). I need the SPI slave to have 4 bytes communication, 1st byte is a command byte, that has 2 options of command, the next 3 bytes the slave sends the content of one of 2 arrays (depends on the command byte). It uses hardware NSS.No matter what I've tried, I have issues. Tried to implement it with inteupt, using LL libary for faster procceing the comand byte. I've set the FIFOThreshold to 1.And still, at the output I recive the data delayed by 4 sends. I assume the TxFIFO is getting full first, and onlt then starting to send, with a delay, anyone can suggest how to overcome it and what am I missing. I'm attaching relevant code of the last configuration, but I've ttreied many others too.Init:static void MX_SPI2_Init(void) { /* USER CODE BEGIN SPI2_Init 0 */ /* USER CODE END SPI2_Init 0 */ LL_SPI_InitTypeDef SPI_InitStruct = {0}; LL_GPIO_InitTypeDef GPIO_InitStruct = {0}; RCC_PeriphCLKInitTypeD
Hi, I am trying to use the dual-bank mechanism of a STM32L496 MCU. Using `BFB2` bit of User Configuration register, I am able to switch between bank 1 and bank 2. My application, using FreeRTOS, runs without problem in bank 1. However, when I set the `BFB2` bit, it properly boots from bank 2 (I can follow traces sent on the UART proving it), but I systematically get a HardFault, forced from a UNALIGNED fault, that seems to occur during the execution of FreeRTOS's `xPortPendSVHandler`. Any idea what could be the cause of it ? or how to workaround it? Thanks in advance for your help.
Hi everyone, I hope someone can help me find or create a driver to communicate the tlv320aic3204 with the stm32f405 on my own custom board. I have been trying to replicate this tutorial (STM32 I2S ADC DMA & Double Buffering - Digital Audio Processing with STM32 #4) but I have not been successful. Some parts of the audio driver are not shown, and my experience with i2s is very low.All my code compiles and everything seems to be ok, however I noticed that apparently it's as if my stm had crashed, because I put a blink on my leds to happen in the while but they don't blink, but if I comment the function that configures the i2c and the i2s, then blink works. I saw other posts that there were people here who managed to communicate this mcu with the codec, I wonder if anyone has released this project or would like to help me with this mission :grinning_face_with_sweat:
Hi all, I have an application where I'm trying to use input capture to capture pulse intervals in a specific period of time. At maximum, the pulses will happen frequently enough that I can't use the straight interrupt capture with HAL_TIM_IC_Start_IT, as it will starve out other tasks. My thought is to use a DMA engine with HAL_TIM_IC_Start_DMA. At the moment, the DMA interrupt triggers when the data buffer is full. However, since I need to record over a specific period, this isn't sufficient - in that period there may be no events, or less than one buffer's worth of data. What I'm thinking is something like this (please pardon the pseudocode):HAL_TIM_Base_Start_IT(tim1); //start timer to measure period HAL_TIM_IC_Start_DMA(tim2); //start input capture while(1) //handle other tasks while waiting on input capture { //do other things here } //input capture period timer has elapsed, so stop capture and store data base_time_interrupt() { //st
Hello everyone, I’m currently working with the STM32N6570-DK board and would like to run a program using FreeRTOS. I’m having some trouble finding clear guidelines or examples specific to this board. My questions are as follows: Has anyone successfully run FreeRTOS on the STM32N6570-DK? If so, could you share the steps or point me to any documentation/tutorials? Are there any plans to integrate FreeRTOS support into the MX Cube environment for this board? Any help, tips, or insights would be greatly appreciated. Thanks in advance for your support!
Hii Community Member,I have a query regarding detection of NTFS based USB pendrive detection.I am currently working on STM32H747 in which I am trying to implement simple file operation (like read-write-modify). I had implemented middleware such as FatFs as per given example.When I tried to detect USB pendrive which was old and exFAT formatted, then controller was able to detect same and did file operation as required. But when another pen-drive (SanDisk 3.2 Gen1 128GB) was tried to detect then it was only able to perform enumeration but not able to perform file operation. When same pendrive formatted in exFAT and performed same activity then it was able to do file operation.I am trying to detect NTFS based pen-drive on this microcontroller so that if user having NTFS pen-drive and trying to connect with my device then user need to able perform same. Rather than formatting to exFAT and then do so.Kindly provide me with your valuable solutions or experience facing similar problem.Th
To test a USB implementation, I have implemented a USB loopback on a Nucleo-144 Development Board (MB1404C). Testing is showing a strange result that I have been unable to isolate:The code is very basic: it creates a thread for USB data handling. In that thread, ux_device_class_cdc_acm_read is used to block until data is received from USB. When it is received, it is send back out USB using ux_device_class_cdc_acm_write. This works great if I send up to 6 bytes of data. As soon as I send 7 or more bytes, the transmitted data is junk (though it is repeatable). Things I have tried and seemingly ruled out:If I don't try to loop the received data out and instead just send data out, I can send 7+ bytes so it doesn't seem to be on the PC side of send/receive data or directly in the transmit code.I have stepped all the way through the receive and transmit code (down through the USB drivers) and the data is received correctly (even
ref. RM0440 Rev 9 vs STM32G4xx HAL v1.2.5.0 (en.stm32cubeg4-v1-6-1.zip)DMA_CCRx.EN - Channel enableThis bit is set and cleared by software.When a channel transfer error occurs, this bit is cleared by hardware.DMA_CCRx.TCIE - Transfer complete interrupt enableDMA_CCRx.HTIE - Half transfer interrupt enableDMA_CCRx.TEIE - Transfer error interrupt enableThis bit is set and cleared by software.It is not read-only when the channel is enabled (EN = 1).It must not be written when the channel is enabled (EN = 1)."it is not read-only" but "it must not be written when the channel is enabled"unless RM is a cookbook, this is a must, not a suggestion.This means that if DMA_CCRx.EN == 1, changing the IE bits along with EN = 0 in a single write must be avoided to prevent entering unpredictable states.Can ST be exhaustive about changing IE bits along with EN in single writes of DMA_CCRx?Function HAL_DMA_IRQHandler():disregarding the RM, __HAL_DMA_DISABLE_IT() is called where the condition DMA_CCRx.EN =
I am trying to use the FreeRTOS on the STM32N6570-DK board, and now I have some problems with it. I downloaded the RTOS from the website and I get the croutine.c, event_groups.c, list.c, queue.c, stream_bufffer.c, tasks.c, timers.c under the route of D:\FreeRTOSv202406.01-LTS\FreeRTOS-LTS\FreeRTOS\FreeRTOS-Kernel. And I can find heap_4.c under D:\FreeRTOSv202406.01-LTS\FreeRTOS-LTS\FreeRTOS\FreeRTOS-Kernel\portable\MemMang. But I have some problems with the ports.c and portasm.c. You see, since the cubeIDE use a GCC complier, I went to the folder under GCC and select the ARM_CM55 core. But there are two folders(secure and non_secure), I am confused. So can anyone explain the trusted_zone stuff so that I can implement the FreeRTOS on the DK board.
I have NUCLEO-F756ZG board with STM32F765ZG and I have hooked up ICS43434 mic into I2S1 bus. Now I have been scratching my head for a day to figure out how to get data out from that puppy. Or actually getting data out is simple, but to make it sane is not. I have configured I2S and DMA like belowThen I allocate some buffers and write DMA callbacks and send the data to freeRTOS task for processing. Now if I play 1kHz sound and dump the raw data from DMA buffers I get something like this113,58880,0,0,116,43008,0,0,123,4608,0,0,134,42496,0,0If I draw the 113, 166 so every 4th sample to graph it is the sine wave what I am playing. My friend the AI said that the data format is left_high, left_low, right_high, righ_low. That might very well be, but I don't want that. If the mic sends 24 bit of data in 32 bit frames it feels insane that I have to spend 2*32bits of memory for it.I just can't figure out what am I missing. It does not help HAL_I2S_Receive_DMA is one big red herring, but I b
Hi all,I am writing to you because I am trying to understand how to make the USB CDC ACM work on the Nucleo U5A5ZJ board. First of all I analyzed some ST webinars and tested the UX_Device_CDC_ACM program which works correctly. I tried to reproduce it starting from Cube MX by checking what had been done in the example project and after generating the code I checked where the code had been added. In the end, despite all the changes, the program does not work because the USB port is not detected by the PC, while with the example program it is detected. I would like to understand some points:1) I placed the code in the app_usbx_device.c and .h files and in the ux_device_cdc_acm.c and .h files. When compiling there are no errors, but when I connect the nucleo board to the PC the serial port is not recognised, whereas with the ST example program it is recognised. Where could the problem be?2) In the UX_Device_CDC_ACM project in CubeMX the USART1 to communicate via STLink and also UCPD1 in th
Hi!I'm trying to make a LCD screen work, but without success.I found this library:https://github.com/STMicroelectronics/stm32-ssd1315But I can'd find more documentation with examples (how to initialize).Can you give me a "wire"? Now I'm using a ssd1306 library, but all the even rows (of my screen) are empty
The HAL tick timer interrupts the MCU every 1 ms. When using FreeRTOS it is best to set the HAL Tick source to a timer rather than the system tick interrupt. Delays in freeRTOS are created using vTaskDelay() or vTaskDelayUntil() and don't use the HAL tick The HAL tick is only used by HAL drivers or in code before the scheduler is started. For low power processors running at low clock speeds the HAL Tick if left enabled adds significantly to interrupt overhead with an interrupt every millisecond. To avoid this, once the HAL tick isn't required any more suspend it. You can do this in the first task started by FreeRTOS viz: /** * @brief Function implementing the monitorTaskHnd thread. * argument: Not used * @retval None */ void monitorTask(void *argument) { HAL_SuspendTick(); ... while(1) // Task loop { ... } } You can also do it before the scheduler is started. If you have to use a HAL driver that uses HAL_Delay() within a task, resume the
Hi, In most of my projects I use the CCM memory for the stack and heap and as it is limited, the question arises how much should I allocate. I specify the stack and heap in the linker script: When using FreeRTOS teach task maintains its own stack, however the base stack set in the linker script is used for interrupt register stacking and the passing of function variables before the scheduler is started. So a stack of non zero size is always required unless there are no interrupts and no function calls. /* Entry Point */ ENTRY(Reset_Handler) /* Highest address of the user mode stack */ _estack = ORIGIN(DTC_STACK) + LENGTH(DTC_STACK); /* end of "RAM" Ram type memory */ _Min_Heap_Size = 256; /* required amount of heap */ _Min_Stack_Size = 1K; /* required amount of stack */ /* Memories definition */ MEMORY { DTC_STACK (xrw) : ORIGIN = 0x10000000, LENGTH = _Min_Heap_Size + _Min_Stack_Size DTCM_MISC (xrw) : ORIGIN = 0x10000000 + _Min_Heap_Size + _Min_Stack_Size, LENGTH = 10K -
Hi @stm32 I have a STM32G070 chip connected to a NOR_FLASH MX25L6433F using Standard SPI. I created an External Loader for the setup, but unable to read/write using the stm32 programmer. The custom driver for the particular flash is proved to work with the same hardware setup, so i can confirm that the bridging between the working driver and the STM2Programmer is somewhat missing. I created an External loader from scratch following the STM32 MOOC course link (https://www.youtube.com/watch?v=xASKxhqphkk&list=PLnMKNibPkDnHIrq5BICcFhLsmJFI_ytvE&index=4) for QSPI.Steps I followed:1) Created a CubeMx project for stm32g070 with SPI enabled in my case.2) Manually copied the loader files from the link https://github.com/STMicroelectronics/stm32-external-loader/tree/contrib/Loader_Files and also integrated my custom driver for the particular NOR_FLASH. The driver is tested and verified separately,So it works.3) In the build configurations, pasted the command cmd
hello i have stm32f429i-disco card. fmc settings are configured. i defined sdram in the linker file but variable sdram is not written. can you help me? i am using cubeide. my linker file is attached and i am attaching the photo of my fmc settings. my variable definition is as follows __attribute__((section(".sdram"))) uint8_t frame_buffer[320 * 240 * 2];/* ****************************************************************************** ** ** @file : LinkerScript.ld (debug in RAM dedicated) ** ** @author : Auto-generated by STM32CubeIDE ** ** Abstract : Linker script for STM32F429I-DISC1 Board embedding STM32F429ZITx Device from stm32f4 series ** 2048KBytes FLASH ** 64KBytes CCMRAM ** 192KBytes 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 STM32 ** ** Distribution: The file is distributed as is, without any warranty ** of any kind. ** ********
Hello ST Community & @stforum & @stforum2 I am working on a project using the STM32F765VGT6 MCU with STM32CubeIDE on Windows, and I'm implementing a Custom HID USB interface. Objective:To send more than 16 bytes of data over USB using the `USBD_CUSTOM_HID_SendReport()` function. USB Report Descriptor (Working - 16 Bytes): __ALIGN_BEGIN static uint8_t CUSTOM_HID_ReportDesc_FS[USBD_CUSTOM_HID_REPORT_DESC_SIZE] __ALIGN_END ={0x06, 0x00, 0xFF, // USAGE_PAGE (Vendor Defined Page: 0xFF00)0x09, 0x01, // USAGE (Vendor Defined)0xA1, 0x01, // COLLECTION (Application) // Output Report (16 bytes)0x85, 0xE3, // REPORT_ID (227)0x09, 0x01,0x15, 0x00,0x25, 0x01,0x75, 0x08,0x95, 0x10, // REPORT_COUNT = 160xB1, 0x03, // FEATURE (Data, Var, Abs) // Input Report (16 bytes)0x85, 0xE4, // REPORT_ID (228)0x09, 0x02,0x15, 0x00,0x25, 0xFF,0x75, 0x08,0x95, 0x10, // REPORT_COUNT = 160x81, 0x02, // INPUT (Data, Var, Abs) 0xC0 // END_COLLECTION}; #define USBD_CUSTOMHID_OUTREPO
Hi, We are working on MMC with USB on the STM32H745I-Disco board but are unable to format the disk. using STM32CubeIDE version is 1.16.1 System Clock Configuration HSE Clock Source CM7 Core: 400 MHz CM4 Core: 200 MHz USB Frequency RC48 Clock: 48 MHz SDMMC CLK RCC SDMMC USB_OTG_FS configuration in middle firmware All these configurations were applied in the CM7 core. And the location D:\ Mass_storage\CM7\USB_DEVICE\App\usbd_storage_if.c we added below function int8_t STORAGE_GetCapacity_FS(uint8_t lun, uint32_t *block_num, uint16_t *block_size) { /* USER CODE BEGIN 3 */ // UNUSED(lun); // *block_num = STORAGE_BLK_NBR; // *block_size = STORAGE_BLK_SIZ; HAL_MMC_CardInfoTypeDef hmmcInfo; if(HAL_MMC_GetCardInfo(&hmmc1, &hmmcInfo) != HAL_OK) { return (USBD_FAIL); } *block_num = hmmcInfo.LogBlockNbr - 1; *block_size = hmmcInfo.LogBlockSize; return (USBD_OK); /* USER CODE END
Hi allI am trying to make project on LWIP & FreeRTOS on STM32f407vgtx board issue what I am facing is when code is getting stuck and no task is hitting .I am sharing my project can you please check once .note: in task I am have called Lwip_Init in my First task is getting hit but when I added TCP_Client or TCPserverinit it is getting stuck.Kindly checked attached project and guide meB.RAshish
I chose the Nx_SNTP_Client example through MX and created a STM32CubeIDE project. The board I'm using is STM32H747I-DISCO.When I run it on the board, I only get the message "The network cable is connected." and I can't get a DHCP IP. When I try to debug, Tx doesn't run even once.Please help.
Hello everyone, I have a lot (too much) question regarding code optimisation, the safety of a code and some return value of the HAL.Firstly, I am currently using HAL and CMSIS RTOS v2. I am using a spi bus protected with a mutexe. Assuming that I am correctly using the mutexe, is it possible for HAL_Transmit_IT or HAL_Receive_IT to actually return HAL_Busy?What I want to know is:1) Am I making too much verification? Afterall a if/else bloc is require some ressources from the core, even if it's very little.2) I read on various post that using assert was a good practice in embbeded system but I'm still strugling to know when to use it and when not. I also read that it was recommanded to always check a return value of a function when it has one. Am I using correctly the assert() function? Is there too much usage of it? Not enough? Where is it really required and when is it not?Here is a sample of a basic function for a driver I am currently working on. I'm following the same co
Hi,I have a STM32F7 and I use USB MSC without RTOS.When debugging with JTAG after connecting the USB memory, a hard fault occurs as follows.*Check Appli_state = APPLICATION_START in USBH_UserProcess() before f_mount()HAL version(MCU package): 1.17.2 FATFS version: R0.12CWhat am I missing or could I do more of?
Hi, I am working with STM32G0B1CETx for an application as a replacement of STM32F105VCTx. I want to use to USB as Custom Human Interface Device Class. I am using CubeMx with MDK-ARM. I have configured USB_DRD_FS as Device_only_FS and Middleware section -> USB_Device i configured the same params as STM32F105VCTx for STM32G0B1CETx . When USB is plugged to Laptop STM32F105VCTx recognizes device with product string i have configured. but STM32G0B1CETx its showing Device Descriptor Request failed.Any changes i missed? Can anyone help out? Thank you SPK
Hello,I am creating a CMake project using STM32CubeMX 6.13.0 for the STM32U575QGI6Q, but am having trouble with the following error: [1/10] Building ASM object CMakeFiles/rtm.dir/Middlewares/...x/ports/cortex_m33/gnu/src/tx_thread_context_restore.S.objFAILED: CMakeFiles/rtm.dir/Middlewares/ST/threadx/ports/cortex_m33/gnu/src/tx_thread_context_restore.S.objC:\ARM-NO~1\14EFD8~1.2RE\bin\AR19DD~1.EXE -DDEBUG -DSTM32U575xx -DTX_INCLUDE_USER_DEFINE_FILE -DTX_SINGLE_MODE_NON_SECURE=1 -DUSE_HAL_DRIVER -ID:/code/firmware/rtm/stm32/cmake/stm32cubemx/../../Core/Inc -ID:/code/firmware/rtm/stm32/cmake/stm32cubemx/../../AZURE_RTOS/App -ID:/code/firmware/rtm/stm32/cmake/stm32cubemx/../../Drivers/STM32U5xx_HAL_Driver/Inc -ID:/code/firmware/rtm/stm32/cmake/stm32cubemx/../../Drivers/STM32U5xx_HAL_Driver/Inc/Legacy -ID:/code/firmware/rtm/stm32/cmake/stm32cubemx/../../Middlewares/ST/threadx/common/inc -ID:/code/firmware/rtm/stm32/cmake/stm32cubemx/../../Drivers/CMSIS/Device/ST/STM32U5xx/Include
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.