Ask questions and find answers on STM32Cube packages, including HAL, LL and middleware, and expansion software.
Most recent activity
I have problems saving data at just under 1Mbit per second to SD, when the SD clock is 25Mbits per second, using the FatFS library. Data is lost, and it is because of the time consumed in performing the ‘f_write’ function for saving data to SD.Could this be due to some limitation of the FatFS library? And if so, do you know of a more reliable library for SD management?
Originally a reply to this thread:https://community.st.com/t5/stm32-mcus-embedded-software/how-generate-hex-file-without-link-files-hal-drivers/td-p/723141Split as it seems to be a different issue.Hi,I have same issue tooI am using STM32F051R8 with STM32CubeIDE Version: 1.18.0There is limited Flash memory. So when I am checking the memory I found some library names etc definition strings on my hex file. I tried to change some setting according to topics above but no success at allPlease let me know which settings is this. Also I am using optimization "Optimize for size -s"RegardsMurat
Hello,I am currently using the Hal library to do send and receive I2S signals over DMA. I am constantly calling the DMA receive and transmit functions, because I cannot figure out how to work it in circular mode. I am struggling because whenever I stop calling the functions, it becomes impossible to resume. Even without calling the stop and resume functions. For example, when I press a button on my device it triggers an interrupt. This immediately stops all audio output from the device, even if the interrupt doesn't do anything. What's even stranger is that when I use it in debug mode, running straight through plays audio just fine, but as soon as I pause it, it stops never to be resumed again. I've attached screenshots of my while loop, DMA configuration code, and the interrupt handler. I use 2 different I2S1 and 2 for receiving and transmitting, and their DMA config is the same apart from the direction.
Hello,I designed a BLDC motor driver for myself and I am currently in the software phase.I am using the 1st, 2nd and 3rd channels of the TIM8 timer for 3 phases, but I do not have any information about how to create SPWM in stm32 or how to trigger these 3 phases and their configuration. I wrote a sample code from the internet, but the motor draws very high current and rotates with vibration. #define PI 3.14159265359 uint16_t SINE_A = 0; uint16_t SINE_B = 120; uint16_t SINE_C = 240; void generateSPWM() { // Add 1 so the rotation will continue 1 by 1 SINE_A = (SINE_A + 1) % 360; // Sine Wave A SINE_B = (SINE_A + 120) % 360; // Sine Wave B, 120 derece faz farkı SINE_C = (SINE_A + 240) % 360; // Sine Wave C, 240 derece faz farkı // Calculate the PWM values for creating a sine wave (SPWM) int SINE_A_PWM = (int)(sin((double)SINE_A * PI / 180) * 499.5 + 499.5); // Convert to PWM range int SINE_B_PWM = (int)(sin((double)SINE_B * PI / 180) * 499.5 + 499.5); // Convert to PW
I am using an STM32G473 with FreeRTOS and am having issues with some interrupts sometimes causing an NMI, making the processor hang in the NMI_Handler (until the watchdog resets it if enabled).The issue occurs sometimes, and I can always eventually trigger it when doing CAN Block Transfers, leading to many CAN Rx interrupts in quick succession.From what I can see in the Call Stack, every single time I detect the issue, the interrupt seems to arrive/trigger when I am inside of a task switch. Example of the call stack:So, here we have a task that has called vTaskDelay. The code pointed to in the delay function is portYIELD_WITHIN_API. My understanding is that this will cause a jump to xPortPendSVHandler. My port of xPortPendSVHandler looks like this: void xPortPendSVHandler( void ) { /* This is a naked function. */ __asm volatile ( " mrs r0, psp \n" " isb \n" " \n" " ldr r3, pxCurrentTCBConst \n"/* Get the location of the current TCB.
THIS IS URGENT.I have had Ux_Device_CDC_ACM (and an enhanced version of it) working for months, and it has since BROKEN. I use the NUCLEO-U5A5ZJ-Q to baseline.Here is what I did:1) Created a new Ux_Device_CDC_ACM project.2) Used STM32CubeIDE Version: 1.18.0 Build: 24413_20250227_1633 (UTC), compiled it and ran it successfully.3) Exited the IDE4) Used STM32CubeMX Version 1.14.0 and regenerated the code.5) Exited STM32CubeMX6) Used the aforementioned STM32CubeIDE, cleaned and and recompiled. The build failed with the following messages:THIS HAS BEEN AN ISSUE THAT WILL DIRECTLY IMPACT A LARGE CLIENT. PLEASE RESPOND QUICKLY.12:05:31 **** Build of configuration Debug for project Ux_Device_CDC_ACM **** make -j24 all arm-none-eabi-gcc "C:/Projects/snip/fw/recorder/rw_sandbox/Ux_Device_CDC_ACM/Middlewares/ST/usbx/common/core/src/ux_device_stack_alternate_setting_get.c" -mcpu=cortex-m33 -std=gnu11 -g3 -DDEBUG -DUSE_FULL_LL_DRIVER -DTX_INCLUDE_USER_DEFINE_FILE -DTX_S
Dear,I'm trying to use the ETH with Zephyr RTOS 3.5.99. It was built the samples/net/dhcpv4_client sample, however, I tried to build others examples from samples/net/socket, such as echo and echo_client, but was impossible.I would appreciate it if anyone could provide information on how to set up ETH on Zephyr.Thanks.
float read_internal_temperature(void) { uint32_t adcValue; float temperature; // Configure ADC channel for temperature sensor ADC_ChannelConfTypeDef sConfig = {0}; sConfig.Channel = ADC_CHANNEL_TEMPSENSOR; sConfig.Rank = ADC_REGULAR_RANK_1; sConfig.SamplingTime = ADC_SAMPLETIME_640CYCLES_5; HAL_ADC_ConfigChannel(&hadc1, &sConfig); // Start conversion and wait for it to complete HAL_ADC_Start(&hadc1); HAL_ADC_PollForConversion(&hadc1, HAL_MAX_DELAY); // Read ADC value adcValue = HAL_ADC_GetValue(&hadc1); // Retrieve calibration values from system memory uint16_t ts_cal1 = TS_CAL1; // Calibration value at 30°C uint16_t ts_cal2 = TS_CAL2; // Calibration value at 110°C // Calculate the slope between TS_CAL1 and TS_CAL2 float slope = (float)(ts_cal2 - ts_cal1) / (110.0f - 30.0f); // Calculate the temperature temperature = 30.0f + ((float)(adcValue - ts_cal1) / slope); // Stop ADC to save power HAL_ADC_Stop(&hadc1); ret
While experimenting[*] with the USART_WakeUpFromStop1 example on my NUCLEO-L496ZG I noticed that repeatedly entering STOP1 mode leads to dropped character if running with a baudrate > 4800 bps. I'm using STOP1 mode in a different project and I hoped to find a way to correctly communicating on 115200.Any pointers on how to achieve this? [*] I had to some minor modifications to STs example* Rewrote the reception callback to store the received bytes in an array and printout in main() instead of echoing them in the handlervoid USART_CharReception_Callback(void){ /* Read Received character. RXNE flag is cleared by reading of RDR register */ ubReceivedChar = LL_USART_ReceiveData8(USART1); rx_buff[rx_buff_i++] = ubReceivedChar; /* Check if received value is corresponding to specific one : S or s */ if ((ubReceivedChar == 'S') || (ubReceivedChar == 's')) { ...* Removed everything not related to STOP mode from the main loopwhile (ubFinalCharReceived == 0){ PrepareUSARTToStopMode();
I am writing this post in case anybody encounters a similar problem. I had a problem with assigning IP address to STM32F769I-DISCO devboard and communicating with it via Ethernet while using LwIP and FreeRTOS. The solution to this problem was disabling D-Cache in Cortex_M7 settings in STM32CubeMX. I don't know if I would ever think about trying this out if not for the old forum thread I found.
here i generate pulse using pwm generation.. where i need to stop at n th pulse.. so i use RCR register to stop it..where my mcu handle only 8 bit data to the RCR register.. so i split the data into array "RCR_Data" and stores as source destinationi call the DMA to get the value from Source to destination as "&htim1.Instance->RCR" address... once DMA complete the processit should says to end the timer generation.. but here i can't get the interrupt handling to call the callback function and stop the timer... Thanks for advance.. please lets us help to solve this problem... void MyDMA_TransferComplete(DMA_HandleTypeDef *hdma) { if (hdma->Instance == hdma_tim1_ch1.Instance) { // Disable everything in sequence __HAL_TIM_DISABLE_DMA(&htim1, TIM_DMA_UPDATE); TIM1->CR1 &= ~TIM_CR1_CEN; // Force disable timer TIM1->CCER &= ~TIM_CCER_CC1E; // Force disable channel output // Standard cleanup HAL_TIM_PWM_Stop(&htim1, TIM_CHANNEL_1);
STM32H7S78-DKlinker error occured.estimated minimum size of 0x1'3456 bytes ...Using IAR EWARM 9.60.2.What should I do?
Hi,I am reviewing the Safety Manual to utilize the Self-Test Library provided by ST, and I have questions about the RAM Test method.It is mentioned that STL provides RAM Test using the March C-algorithm, and its verified diagnostic coverage can satisfy 'Medium (90%)'.I want to develop a product targeting SIL3 of IEC 61508, and if the HFT is structured to satisfy 1, there will be no problem in claiming SIL3 even if the DC is 'Medium (90%)'.According to Table A.6 of IEC 61508-2 that I checked, the maximum diagnostic coverage that can be achieved with the simple march algorithm is confirmed to be 'Low'. I am curious as to how DC was verified as 'Medium (90%)' in STL.If there is anything I misunderstand, please give me feedback.
Hi,I need to initialize a display by calling my function in main.c. This function uses the I2C4 channel and requires implementing some delays.Since it uses I2C4, it must be placed after the CubeMX Init functions, specifically in /* USER CODE 2 */. Doing so ensures that the I2C4-related part of the function works correctly. However, the delay mechanism does not function as expected.TimeBase is already set to TIM6 (instead of SysTick which is used by FreeRTOS).I initially tried using HAL_Delay(), which should work because the OS kernel has not yet started.While it works well when I place it in the /* USER CODE BEGIN SysInit */ section but not in the /* USER CODE BEGIN 2 */ section.It gets stuck inside HAL_Delay(). The HAL_GetTick() function within HAL_Delay() continuously returns the same value, meaning uwTick is never updated.I also attempted using osDelay(), but since the kernel is not yet running at that point, it does not work either. How can I resolve this issue
Hello, I would like to get more info on Errata ES0392 Rev 13 - section 2.25.3:the errata states:I'm confused with the wording of this errata. Can someone from ST describe the meaning of this errata?I currently have USB0 connected to the USB Hub directly, and USB0 is configured as Host Only - High Speed:When I saw this errata, I uploaded a patch to the USB-Hub and instructed it to do speed conversion on the hub before transmitting the data to the STM processor. I'm able to connect to all the devices attached to the hub (mouse, keyb, storage) and it seems relatively reliable.However, the problem that I'm having is that the USB Hub goes offline periodically. When I probe the Hub it doesn't like the signals from the STM host. When I checked on the scope, it seems the signals are out of spec. If I look at the STM32H743 data sheet, it states:It appears that instead of using these dedicated USB drivers, it is using the standard GPIO drivers as shown in Cube
Is there any effort underway to develop a package to support gRPC on embedded systems or more specifically STM32 ?
Hello, ST experts HAL_UARTEx_ReceiveToIdle_DMA works well in our project, it can get idle interrupt or uart data stream interrupt. But when STM32's partner power down and up again, I think that means UART_RX line to STM32 goes low during this period, the call of HAL_UARTEx_ReceiveToIdle_DMA always returns an error code. How can I restore in such situation? BRYang
I traditionally use a volatile type for my schedulers. Very simple like so volatile uint8_t myflag; uint8_t ticks; void Func(void){ ++ticks; if(!(ticks % 5)){ myflag = true; } } void User(void){ if(myflag) { myflag = false; //DO Something } }I'm trying to update my knowledge. The online thought seems to be that this isn't really the safe way as this does not have any memory barrier. So the proper way is to use an atomic. So I tried an atomic.atomic_bool myflag = ATOMIC_VAR_INIT(false); uint8_t ticks; void Func(void){ ++ticks; if(!(ticks % 5)){ atomic_store(&myflag ,true); } } void User(void){ if(atomic_load(&myflag)) { atomic_store(&myflag ,false); //DO Something } }However, this definitely does not work. The User misses flag settings regularly. Its not just a delay. But per the scope its like a complete flag setting is missed. What have I done wrong here? I even tried to make it volatile and also tried atomic_flag but they both miss settings but the
I am using TIM2 to create PWMs for LEDs. When I enter STOP mode I expect the PWM to stop. Yet it does not. From the manual TIM do not have wakeup capability from stop mode. So they should not be requesting the HSI to operate.What could possibly cause the HSI to continue to operate in STOP mode. I am waking in 5s from RTC. during this whole time and continuously uninterrupted as far as I can tell the PWM keep going. Shouldn't they stop?HSIKERON is 0.
I have 2 STM32F407 Discovery boards sending data back and forth to each other using usart2. Usart3 on one is just a monitor so I can see the output on a USB comm port. I'm using DMA on the receive for both and the HAL_UART_RxCpltCallback for both just sends the data back for both boards. I have to have a transmit in one of the tasks before it will work. I have a counter that advances in each callback that spins the 4 LED's so I can see if it's working because it goes too fast to spit it out to the comm port. Is there any way to slow it down? I tried putting a vTaskDelay in one of the callbacks but I don't think you can do that. I'm using STM32CubeIDE and FreeRTOS.I have attached both freertos.c files from the Core/Src/ directory. The lights spin incredibly fast and then slow down and pause once in a while.
Hi, my current issue is that after implement Self test library for a stm32h5 the basic things like STL_SCH_Init() works fine but when i try to run the flash test the STL_SCH_ConfigureFlash fails, the status says STL_ERROR.How i run the test:I define STL_MemConfig_t FlashRangesVar (with the right memory ranges inside a STL_MemSubset_t struct).STL_SCH_Init() ->works fine.STL_SCH_InitFlash(&StatusVar) -> works fine an statusVar is STL_NOT_TESTED.STL_SCH_ConfigureFlash(&statusVar,&FlashRangesVar) -> this works but statusVar says STL_ERROR and not STL_NOT_TESTED like the documentation says.I also use the CRC tool that is required for the test with the full flash range.So my question is why the configureFlash fails?, because even if i define small ranges for the test it still fails the configuration and i check and re-check the ranges.Thanks for reading.
I am trying to create a project with FreeRTOS using CMSIS RTOS V2 without configuring it in the ioc file. I am trying to turn ON/OFF the LED using thread and timer. I can build and run the same project if I configure the freeRTOS in STM32CubeMX. But I want to configure it independently. I included all the files required by freeRTOS and CMSIS RTOS V2 for the project. Attached is .ioc file and error message.
I'm currently using a STM32L433RCT3 and the L4 HAL library. My goal was to read back a configured RTC alarm, increment it, and restart the alarm. I created a:RTC_AlarmTypeDef sAlarm;I read back the RTC alarm using,HAL_RTC_GetAlarm(&hrtc,&sAlarm,RTC_ALARM_A,RTC_FORMAT_BIN);I set the RTC alarm again using,HAL_RTC_SetAlarm_IT(&hrtc, &sAlarm, RTC_FORMAT_BIN);Setting the alarm fails due to,assert_param(IS_RTC_ALARM_SUB_SECOND_MASK(sAlarm->AlarmSubSecondMask));If I don't initialize the sAlarm to {0}, the AlarmSubSecondMask is undefined and the HAL_RTC_SetAlarm() may fail. It seems like the HAL_RTC_GetAlarm() should also be retrieving & setting the AlarmSubSecondMask as well.
(found using STM32H723 NUCLEO board) Hi,When trying to implement a USG OTG application, where the USB port is required to switch backwards and forwards many times between device and host mode, there appears to be an error in the USBH_DeInit function in usbh_core.c: The function does not call USBH_LL_DeInit and as a result a subsequent re-initialisation of the host stack fails because the host state is not set back to RESET and the peripheral clock does not then get re-started.Compare this with the equivalent function in the device stack (USBD_DeInit in usbd_core.c). This correctly calls the equivalent function USBD_LL_DeInit at the end of the function and as a result the device stack can be de-initialised and re-initialised many times.The fix is simply to add the call to USBH_LL_DeInit at the end of USBH_DeInit and the host stack can then be de-initialised and re-initialised many times without issue.Thanks,Steve
Hi!with cube IDE i'm trying to develop a USB device with 3 classes using a STM32H523 with USBX and threadX.If i select USB HID,USB MSC and USB ACM (virtual com port) the code is succesfully generated but if i close and reopen the .ioc GUI i have this message error:the value of UX_MAX_DEVICE_ENDPOINTS can't be less then number of endpoints used.(used endpoints: 7). it will be set to 6.what does it mean? is not possible to have 3 classes? or i have to change something in the endpoints and it can be done?there is an example like this? or a guide to understande the endspoint managethank you
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.