Ask questions and find answers on STM32Cube packages, including HAL, LL and middleware, and expansion software.
Most recent activity
I’m working on a project with the Nucleo-L476RG. I want to perform a measurement, then put the microcontroller into Sleep Mode for 2 seconds, after which it should be woken up by the RTC clock.I followed the tutorial:How to configure the RTC to wake up the STM32 from Low Power modesUnfortunately, Sleep Mode is entered but not exited properly.Down below are my project settings: In my measurement function, I call a custom sleep() function.void start_measurement(hx711_t *hx711){ hx711->processed_reading = get_weight(active_hx711, 10); menu_refresh(); pack_data(hx711); if (HAL_UART_Transmit_DMA(&huart2, (uint8_t *)( active_hx711->tx_buffer), HX711_TX_BUFFER_SIZE) == HAL_OK){ active_hx711->measurement_count = 0U; active_hx711->tx_in_progress = 1U; } sleep(); }there's the call of the sleep function:void HAL_RTCEx_WakeUpTimerEventCallback(RTC_HandleTypeDef *hrtc) { //HAL_ResumeTick(); printf("Inside the HAL_RTCEx_WakeUpTimerEventCallback function")
I am trying to setup FreeRTOS for the new STM32N6 Nucleo board. Running into the following error `GCC/ARM_CM55_NTZ/non_secure/port.c:1814: undefined reference to `__privileged_sram_start__'`.Based on https://github.com/STMicroelectronics/x-cube-freertos/blob/main/Projects/NUCLEO-N657X0-Q/Applications/FreeRTOS_MPU/README.md#notes, it looks like I am missing some linker files. The example itself has it defined at https://github.com/STMicroelectronics/x-cube-freertos/blob/main/Projects/NUCLEO-N657X0-Q/Applications/FreeRTOS_MPU/EWARM/stm32n657xx_axisram2_fsbl.icf#L80 . But looks to be using EWARM whereas I am using CubeIDE. How can I define/find these linker files needed for the privileged calls?
Hi All,I'm using STM32G4 with TIM1 for motor control. The BKIN hardware protection works correctly - when I pull the BKIN pin (PB10) low, the motor stops, and when high, it runs again with AOE enabled. However, the break interrupt never fires and HAL_TIMEx_BreakCallback is never called. I've verified that TIM1_BRK_TIM15_IRQHandler exists in stm32g4xx_it.c, NVIC is enabled. The break flag never gets set even though BKIN is functioning. What could prevent the break flag from being set while the hardware break feature still works?I want to print diagnostic using BKIN callback routing but it doesn't work.I've attached IOC timer configurations.Best regards
Using Nucleo-U545RE-Q, SPI2 Full-duplex Master, default GPIO selected by STM32CubeMX v6.15.0 with LL selected for implementation.Config clock for max 160 MHz and prescale SPI by 8 for 20 Mbps. Add GPDMA Ch2/3 for SPI2 TX/RX.I double checked the output configuration code generated by the CubeMX against the Cube_FW_H5_V1.5.0 Examples_LL: SPI_TwoBoards_FullDuplex_DMA_Master_Init, and it matches exactly but for peripheral selection. Jumper-wire PC1-to-PC2 (CN7.36-to-CN7.35) for simple SPI loop-back test. With this configuration, the loop-back works when I implemented the SPI full-duplex transfer by LL blocking code. But trying to use the GPDMA channels results in no data, no DMA IRQ for TC or DTE, no SPI IRQ for anything. Below is the simple code to try to get a transfer going, there is initialization code that enables all SPI and DMA interrupt sources and handles the IRQ by clearing the flag and setting the local global booleans that you see below. Note that this is setup f
I believe there's a bug in the stm32h7rsxx_hal_dma code for dealing with repeated blocks in interrupt mode. This bug probably exists in other STM32H7 devices as well.With a typical repeating transfer, in *NON* interrupt mode, the DMA transfer completes successfully, and the DMA state ends up in HAL_DMA_STATE_READY, ready for another request. All is well.However, in interrupt mode, the DMA transfer completes successfully (all data is correctly transferred), but querying the DMA state in the DMA Transfer Complete callback, you'll get HAL_DMA_STATE_BUSY. In fact, it will remain in this state forever.Looking at the stm32h7rsxx_hal_dma.c code, the block starting at 1154 ("Transfer Complete Interrupt management"). There are really only two cases where the HAL_DMA_STATE_READY can be set:1) LinkedList mode (not relevant to us)2) "Normal transfer" where CBR1 == 0. (i.e. not a repeating block transfer) In a repeating transfer, CBR1 contains the repeating config, and is generally not 0 (it's call
Hello,I am new to STM32F746-Disco and I was trying to develop an application starting from TouchGFX.It went all good in developing a touchGFX app and use the generated .ioc and so on to configure a project but I've tried afterwards to configure the ethernet stack LWIP and so on but I was never able to communicate and ping the ethernet device.I've tried on my local to run the ethernet example and I was able to properly ping the device but never been able to do it in the project configured with touchGFX.The strange thing is that I can partially see some comunication such as ARP messages and so on but then the ethernet stack is not capable to reply to ping message. here a snapshot of the communication between my PC and the st board. Does anyone might now what could be wrong in my configuration?I've attached the .ioc
I'm re-using a sequential I2C library that worked on a couple other ST devices with different I2C devices, but it doesn't work on a STM32F030.They are functions for I2C register operations, where we always start with a write with the register address and then a write/read, depending on the operation: // Read register HAL_I2C_Master_Seq_Transmit_IT(peripheral, address, &registerAddress,1, I2C_OTHER_FRAME); HAL_I2C_Master_Seq_Receive_IT(peripheral, address, data,size, I2C_OTHER_AND_LAST_FRAME); // Write register HAL_I2C_Master_Seq_Transmit_IT(peripheral, address, &registerAddress,1, I2C_OTHER_FRAME); HAL_I2C_Master_Seq_Transmit_IT(peripheral, address, data,size, I2C_OTHER_AND_LAST_FRAME);The write doesn't work (read works fine). The first call to HAL_I2C_Master_Seq_Transmit_IT is successful, but not the second.I've tried the write with different I2C transfer options, but none seem to work. I don't have a scope on me so I don't know what frame is being produced.Anyone has ot
Hello,I am working on a custom board based on the STM32H747 to develop a Touchgfx application as User Interface, where I am using the same QSPI Flash device as the STM32H747I-EVAL kit (MT25TL01G 1Gbit), but with a different chip-select pin wiring.On the STM32H747I-EVAL board, the external loader (MT25TL01G_STM32H747I-EVAL.stldr) is configured to use:QSPI_BK1_NCS (PG6) as the common chip-select for both banks.On my custom board, the MT25TL01G device is wired as:QSPI_BK2_NCS (PC11) as the common chip-select for both banks.I updated my firmware, CubeMX configuration, pin assignments, and the QSPI initialization, and QSPI is now working correctly inside my application firmware.However, STM32CubeProgrammer cannot flash the external QSPI because the supplied stldr file still expects the original chip-select pin (PG6).The external loader obviously needs to be rebuilt with the new QSPI pin mapping.My questions are:Is it possible to modify or rebuild the .stldr external loader for the STM3
I think I have found a bug in the mentioned file (in my case the file comes from x-cube_azrtos-h7, but the problem seems to be present in other versions to).In the function fx_stm32_sd_driver() there is a check that the passed Databuffer (media_ptr→fx_media_driver_buffer) is 4 Byte alligned, if this is true then the function sd_read_data() uses directly the passed buffer otherwise it uses a local scratch buffer. But after the DMA the function needs to invalidate the cache (by calling invalidate_cache_by_addr), on the Cortex M7 a cache line is 32 Byte.This may overwrite data in the cache out side of the buffer.Correction:Set use_scratch_buffer to false only when fx_media_driver_buffer is 32 Byte aligned and a multiple of 32 Byte.
Hello,This is a general suggestion that I would like to make. While I think it's great that all HAL libraries are available on GitHub, I would like to suggest creating a github release for the official versions in addition to creating tags. This can be done on GitHub with just a few clicks. The reason for this is the use of component analysis platforms such as Dependency Track, which make it possible to automatically track the libraries used, a task that is becoming increasingly important. Unfortunately, Dependency Track requires a release in order to track the version. While it is also possible to track this using the commit ID, for example, a release would be the better approach here. I welcome feedback and the possible realization of this suggestion.For Example ARM is doing this with their CMSIS Package: https://github.com/ARM-software/CMSIS_5-Hannes
Hello I have a code use CAN on a stm32U585 he work fine if the CAN bus have not disturbance But if i have to many disturbance for exemple if i make a short circuit bethen CANH and CANL when i remove the short circuit the CAN no restart to send data. I need stop and restart CAN HAL_FDCAN_Stop(&hfdcan1); HAL_FDCAN_Start(&hfdcan1); After the disturbance, the return value of HAL_FDCAN_GetState() and HAL_FDCAN_GetError() remains unchanged. How can I immediately know when there is a problem with CAN
Greetings,I'm making a USB PD Sink device with a STM32G483 & TCPP01-M12, that will be able to take up to 15V@3A.I started implementing USB PD functionality using STM32CubeIDE 1.19.0 & FreeRTOS. Step by step.The current config is mostly stock, with only a custom BSP_USBPD_PWR_VBUSGetVoltage(uint32_t instance, uint32_t *pVoltage) implementation that reads VBUS voltage & writes it in mV to pVoltage.At init(), firstly MX_USBPD_Init() is called, after that, I'm applying power to TCPP01-M12 & disabling the Dead Battery resistors. Current FreeRTOS config: CMSIS_V2, 16000 bytes heap with heap_4 scheme, NEWLIB_REENTRANT enabledCurrent USBPD config: Full Stack, TIM2 timer, NVIC, DMA set, 2 fixed PDOs, 5V@3A & 9V@3A. Everythink else in Stack Port 0 config is not supported (except SOP). If I understand correctly, the stack should work as follows:At the cable attachment, the source presents 5V on VBUS and sends its capabilities to the sink
Hi Guys, I am completely new in the world of ST Microcontroller. I have worked with PIC Microcontrollers using MikroC Compiler. After studying various tutorials on this topic, I am getting it slowly. While going through code of generation of PWM, I came across a function " HAL_TIM_PWM_Start(&htim2, TIM_CHANNEL_1);" which, I assume, starts PWM. My question, Is it a library function? If so, how can it be accessed. Incidentally it is stated that I have installed STM32 CubeMX and STM32 Cube IDE.
This branches off from the second question I asked in here. Using the example code (Ux_Device_Audio2.0_PlayBack) right off the bat does not work, and this is what I've done so far.HardFault DiagnosisEncountered HardFault_Handler() when audio playback started.Fault analysis revealed:FORCED = 1IMPRECISERR = 1 (Imprecise data access violation)Fault occurred in _ux_utility_memory_copy() due to an invalid destination address: 0x3071BFBA.Buffer Pointer ResetThe destination address was out of bounds.Manually reset BufferCtl.wr_ptr = 0.This resolved the HardFault and allowed playback to start.However, pausing or stopping playback caused the last audio segment to loop indefinitely.Fixing Audio LoopingAdded BSP_AUDIO_OUT_Stop(0) inside the alternate_setting == 0 block of the stream change function.This stopped the looping but introduced a screeching sound mid-playback.This raised questions:Is the buffer not clearing properly?Is the screeching due to stale audio segments?Memory Layout Correc
Hi, I've got a STM32U5G9ZJ-DK2 Discovery kit.I'm trying to setup the ADC to work with GPDMA doing a continuous acquistion of two channels into a large buffer of samples. I got it working perfectly fine with ADC4, but I just don't get it work with ADC1.From what I can tell it looks like the DMA Request from ADC1 is not forwarded to the GPDMA.ADC1 itself works, too. It works well in interrupt mode (triggering an IRQ after the sequence of two channels).Is the a special trick to enable the GPDMA request from ADC1, like is there a certain clock or power domain that must be enabled? hdma_adcx.Instance = GPDMA1_Channel8; hdma_adcx.InitLinkedList.Priority = DMA_LOW_PRIORITY_LOW_WEIGHT; hdma_adcx.InitLinkedList.LinkStepMode = DMA_LSM_FULL_EXECUTION; hdma_adcx.InitLinkedList.LinkAllocatedPort = DMA_LINK_ALLOCATED_PORT0; hdma_adcx.InitLinkedList.TransferEventMode = DMA_TCEM_LAST_LL_ITEM_TRANSFER; hdma_adcx.InitLinkedList.LinkedListMode = DMA_LINKEDLI
Hello!I am trying to get an MQTT project to work, but having some issues. At some points randomly the program stops and does not respond to the remote server anymore. In hopes of figuring it out I tried to enable stack checking from ThreadX settings from CubeMX, and generated the code. BUT, whenever the stack checking was disabled, DNS was able to retrieve the IP address always. Now, it fails every time.The function "nx_dns_host_by_name_get" is called from the begging of SNTP thread. After calling the mentioned function, the return status is NX_DNS_QUERY_FAILED (0xA3). I have the DNS set up as to retry 3 times with a timeout of 10 seconds.Checking from WireShark I can see that the device did send out the query to get the IP address, and the router answered, but for some reason the packet was not received/saved on the device side. After that I get 3 different ARP packets from the router, which is trying to identify my device, but no responses. Finally, 2 more attempts are made by t
Hi,We're planning to integrate a file system with the VENC_SDCard example for the STM32N6x7:https://github.com/STMicroelectronics/STM32CubeN6/tree/main/Projects/STM32N6570-DK/Applications/VENC/VENC_SDCardWe found Revision 3 of UM1721 Developing applications on STM32Cube™ with FatFs dated February 2019 and were wondering if that's the most recent revision of the document?https://www.st.com/resource/en/user_manual/um1721-developing-applications-on-stm32cube-with-fatfs-stmicroelectronics.pdfWill
I am trying to start 6 virtual com ports over usb. I could start 4 using a USB composite pack made by a developer. From what I have read and tried, there are not enough endpoints for 6 com ports and only maximum for 4 (9 bidrectional EPs, 1 reserved for EP0; 2 IN EPs and 1 OUT EP per com port). Is it possible to start 6 com ports at all by reusing or bypassing an IN EP?
Hi,I'm looking for some guidance on configuring the STM32N6570-DK so i can use the screen and onboard mic / headphone out jack.It looks like everything i need is in stm32n6570_discovery_audio.h and stm32n6570_discovery_lcd.h, and i did manage to get the screen going with some configuration from this repo: https://github.com/jpcano/STM32N6-digits When I then try and enable audio the following calls succeed:void Audio_Setup(void){ AudioInit.Device = AUDIO_IN_DEVICE_DIGITAL_MIC; AudioInit.SampleRate = AUDIO_FREQUENCY_16K; AudioInit.BitsPerSample = AUDIO_RESOLUTION_16B; AudioInit.ChannelsNbr = 1; AudioInit.Volume = 80; if (BSP_AUDIO_IN_Init(0, &AudioInit) != BSP_ERROR_NONE) { Error_Handler(); } if (BSP_AUDIO_IN_Record(0, AudioBuffer, AUDIO_BUFFER_SIZE) != BSP_ERROR_NONE) { Error_Handler(); }}after this the transfer callbacks never get hit and any calls to drawing the screen, HAL functions like UART sending or blinking a led also stop working.I did try the STM
I am looking for any example project that uses Azure RTOS FileX and LevelX using onchip flash.I understand the programming flash can be segmented and used for general purpose file storage but I cannot find any example across any series packages which uses the on chip flash. Is this even possible?I am mostly looking on how to set the levelx configuration parameters in STM32CubeMX. I know how to integerate the low level flash drivers from the HAL.
I've set up my STM32U5A9J-DK to use ThreadX and connect to my PC via USBX and Audio Class.I'm correctly see the Audio Device on my PC and I can easily stream audio to it. The only thing is that, for some reason, the callback for new frame done is not fired audio_stream_parameter[0].ux_device_class_audio_stream_parameter_callbacks.ux_device_class_audio_stream_change = USBD_AUDIO_PlaybackStreamChange; audio_stream_parameter[0].ux_device_class_audio_stream_parameter_callbacks.ux_device_class_audio_stream_frame_done = USBD_AUDIO_PlaybackStreamFrameDone;The strage thing is that USBD_AUDIO_PlaybackStreamChange is correctly calledVOID USBD_AUDIO_PlaybackStreamChange(UX_DEVICE_CLASS_AUDIO_STREAM *audio_play_stream, ULONG alternate_setting) { /* USER CODE BEGIN USBD_AUDIO_PlaybackStreamChange */ /* Do nothing if alternate setting is 0 (stream closed). */ if (alternate_setting == 0) { return; } BufferCtl.state = PLAY_BUFFER_OFFSET_UNKNOWN; /* Start reception (stream opened).
I'm using an ov2640 camera. When I use HAL_DCMI_Start_DMA(&hdcmi, DCMI_MODE_CONTINUOUS, (uint32_t)camBuf0, (CAM_W * CAM_H) / 2);, HAL_DCMI_FrameEventCallback is called, but when I use HAL_DCMI_Start_DMA(&hdcmi, DCMI_MODE_SNAPSHOT, (uint32_t)camBuf0, (CAM_W * CAM_H) / 2);, HAL_DCMI_FrameEventCallback is never called. Why is this happening? Below are the relevant settings. I'm using an STM32H743 MCU. static void MX_DCMI_Init(void) { /* USER CODE BEGIN DCMI_Init 0 */ /* USER CODE END DCMI_Init 0 */ /* USER CODE BEGIN DCMI_Init 1 */ /* USER CODE END DCMI_Init 1 */ hdcmi.Instance = DCMI; hdcmi.Init.SynchroMode = DCMI_SYNCHRO_HARDWARE; hdcmi.Init.PCKPolarity = DCMI_PCKPOLARITY_RISING; hdcmi.Init.VSPolarity = DCMI_VSPOLARITY_LOW; hdcmi.Init.HSPolarity = DCMI_HSPOLARITY_LOW; hdcmi.Init.CaptureRate = DCMI_CR_ALL_FRAME; hdcmi.Init.ExtendedDataMode = DCMI_EXTEND_DATA_8B; hdcmi.Init.JPEGMode = DCMI_JPEG_DISABLE; hdcmi.Init.ByteSelectMode = DCMI_BSM_ALL; hdcm
Hi, @krastThe readme for the VENC_SDCard_ThreadX examplehttps://github.com/STMicroelectronics/STM32CubeN6/blob/main/Projects/STM32N6570-DK/Applications/VENC/VENC_SDCard_ThreadX/README.mdstates:"The output is raw since no file system is used for now"but the first slide of the STM32N6 demo workshop - 11 Video encoder (VENC) in practice workshophttps://www.youtube.com/watch?v=25lEF4GgN8Msays that this example uses a FAT32 file system.I was wondering if there might be an error in the readme where it states "The output is raw since no file system is used for now"?Thank you very much for these examples - they're very valuable.Will
I have an application where I have enabled TX_ENABLE_STACK_CHECKING. The application gets stuck in a do loop in the tx_thread_stack_analyze.c between lines 114 and 135. (H7.3.1.0) It is clear in the debugger that the loop will never complete. The loop is checking for the stack fill pattern 0xefefefef using a binary search after checking the pointer are not NULL. Here is the code: /* We need to binary search the remaining stack for missing 0xEFEFEFEF 32-bit data pattern. This is a best effort algorithm to find the highest stack usage. */ do { /* Calculate the size again. */ size = (ULONG) (TX_ULONG_POINTER_DIF(stack_highest, stack_lowest))/((ULONG) 2); stack_ptr = TX_ULONG_POINTER_ADD(stack_lowest, size); /* Determine if the pattern is still there. */ if (*stack_ptr != TX_STACK_FILL) { /* Update the stack highest, since we need to look in the upper half now. */ stack_highest = stack_ptr; } else { /* Update the stack lowest,
Hi,I am running the latest version of the VENC_SERVER application and am interested in the mode that uses no external memory. There is a define for 720p 30fps using internal memory only, but trying to compile it in debug mode results in a compile error with .bss data not fitting in memory.Could anyone advise on how to change the example or linker script to get the internal memory only version working?Thanks
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.