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 try to create a new project, nothing is written in main.c! It is a first check after setting up 'LWIP', 'SDIO' and Freertos in the GUI and got this mistake!multiple definition of `errno'; ./Middlewares/Third_Party/LwIP/system/OS/sys_arch.o:/home/denis/STM32CubeIDE/workspace_1.9.0/FreeRtos_SDIO_Web/Debug/../Middlewares/Third_Party/LwIP/system/OS/sys_arch.c:45: first defined hereSTM32CubeIDE Version: 1.9.0 PS - This error not appear then I was on STM32CubeIDE Version: 1.8.0
Hello!I am writing a program that uses FreeRTOS and LwIP libraries. I would want to check ARP table, but functions from ip4 directory are not considered thread-safe. How can I check ARP table when using FreeRTOS or how can I make sure calling thread-unsafe functions won't break my program?I saw that there is an LwIP mutex that can be used to lock the stack via LOCK_TCPIP_CORE() and UNLOCK_TCPIP_CORE() macros, but I am not sure how to use them properly or if it is even a good approach. Thank you in advance!
Hi everyone,I'm currently working on a project to turn an STM32 microcontroller into a USB printerdevice. I have spent a considerable amount of time searching for a comprehensive guideor a complete implementation for the classic USB printer device class on the STM32platform, but unfortunately, I haven't found a solution yet.I did find this valuable ST Community post that provides a walkthrough for setting up aUSB Communications Device Class (CDC): LINK, This has led me to a few specific questions:1. CDC vs. Printer Class: For those experienced with both, how significant is thedevelopment effort to move from a CDC implementation to a compliant USB PrinterClass (Class Code 07h) device? I understand the Printer Class has its own setof specifications, but I'm trying to gauge the complexity of adapting the existingCDC examples.2. Successful Implementations: Has anyone in the community successfully configuredan STM32 as a USB printer device? I've come across a few forum posts where this hasb
I've got an STM32G491RE on a NUCLEO-G491RE board and I'm driving the DAC using TIM4's TRGO and pulling values out of a memory buffer using DMA. It was a bit of a challenge getting set up, but now that it's running it's beautiful.What's weird is that I've got TIM4 initialized with both prescaler and counter set to 4, and since that board is running at 72 MHz that means I'm triggering the DAC every 347 ns but it's supposed to have a max of 1 Msps.Am I correct in assuming it's just ignoring those extra timer triggers? Are there any error bits set when you "overdrive" a DAC like this?
Good afternoon Team,I am working on a project where I need to interface two SPI peripherals with an ST microcontroller (STM32G070RBT6).One peripheral (ADS124S06) operates in SPI Mode 1 (CPOL=0, CPHA=1), and the other (64128L FC BW-RGB Display) in SPI Mode 0 (CPOL=0, CPHA=0).Both peripherals must operate concurrently to ensure real-time data visualization.Is it possible to use a single SPI interface for both peripherals, even though they require different modes?If yes, what is the best way to handle this? ---Should I reconfigure the SPI mode dynamically before communicating with each device?Are there any potential timing or synchronization issues to consider?Thank you in advance for your support!
Dear all,I'm working on an custom hardware project using the STM32G0B1 MCU running ThreadX. My goal is to use/port the USBPD stack for both source as sink device, but I'm failing to do so partly because the stack provided is closed source.The CubeMX skeleton code generated for my project does not offer a working solution and all example code nor documentation available is not targeting ThreadX.Also I'm somewhat confused about which PD stack to use since X-CUBE-USB-PD is no longer recommended? Then what would be the alternative stack to use?Does anyone have practical experience, can provide meaningful documentation or example code porting USBPD to ThreadX? I would be forever thankful.Thanks and looking forward to your replies.With regards,Peter
Hi. I have a NUCLEO-N657X0-Q board with MB1854B. Yes, exactly nucleo, not discovery one. Im trying to recreate RTSP example fron discovery board. As netxduo from cubemx is kinda buggy, i manually added it along with other necessary middlewares from github repo. After configuring all peripherals according to VENC RTSP example for disco board on video side and UDP ECHO Server example for nucleo board, i copied application files from VENC RTSP example.Application starts but fails to get IP by dhcp. I have tripple-checked all the things. ETH configuration and driver are correct for my board and my PHY(lan8742). ETH is inited without errors, memories for descriptors and buffers are marked as non-cached in MPU. Pin assignment also correct. Netxduo creates DHCP packets and descriptors for them. Then _nx_driver_packet_send is triggered. But i checked with my oscilloscope TX lines on the RMII interface, and there are no activity. I also checked, UDP Echo exam
As the title says, I've got a (circular) buffer of uint16_t values that I want to send to the DAC every time the timer updates. It seems like it's 95% working, in that if I manually trigger the DAC:for (int i = 0; i < 10000; ++i) { LL_DAC_TrigSWConversion(DAC1, LL_DAC_CHANNEL_1); HAL_Delay(1); }I can see my waveform on the output pin. But when I try to have the DMA send the values to the DAC, the output never changes.One complication is that I need to run in two modes - in one mode I'm taking the ADC input, processing it, and sending that to the DAC, in the other mode (I'm calling "inject" mode) the ADC is ignored and the DAC values come from my memory buffer.The code to switch between modes looks like this:if (inject && !Inject) { // Turn on inject mode // HAL_DAC_Start_DMA(&hdac1, DAC_CHANNEL_1, (uint32_t*)Transfer, 4096, DAC_ALIGN_12B_R); LL_DMA_DisableChannel(DMA1, LL_DMA_CHANNEL_3); while (LL_DMA_IsEnabledChannel(DMA1, LL_DMA_CHANNEL_3)); // Wait till of
Hi as part of my project I am trying to integrate the mentioned parts in subject to control modbus eth relay over tcpip.What I have done so far.1. Integrated Lan chip driver to stm32 library and initalization done.2. Integrated LwIP stack from online resources and confirmed LwIP integration succeeded. (Since i'm using STM32H563RGT6 MCU and it doesnt have inbuilt LwIP stack with in it).3. Initially tried to establish a connection with my PC and try a ping test.4. I'm facing ARP Resolution initally but somehow it resolved and now i can find my MCU ip and mac address on my PC, but still ping is not reachable.5. My POV is that if its capable of handling etherent packets then i can start work on with modbus packets to trigger the relay module.Pls help me with this case...
Hello, I’m trying to drive LEDs using all four PWM channels of TIM8 on a NUCLEO‑H755ZI, but I’m running into this issue:CH1 (PC6) and CH2 (PC7): When I measure with a multimeter, I see the expected voltage fluctuations/average corresponding to the configured frequency and duty cycle.CH3 (PC8) and CH4 (PC9): I’ve removed the LEDs and measure the pins directly with a multimeter; they always read 0 V. I’m attaching the project archive, which includes the CubeMX .ioc file, tim.c , gpio.c , the driver layer, and all HAL settings. I’d appreciate any suggestions or insights you might have. Thanks in advance!
Hello,From my understanding in FreeRTOS, there is a defined highest priority one should set for interrupts whose ISRs may call RTOS APIs (configMAX_SYSCALL_INTERRUPT_PRIORITY).For the same reasons, I would expect ThreadX to have a similar limitation, and to that extent I have found other ST forums posts suggesting one should set lower priorities for any interrupts whose ISRs may call RTOS APIs, but I can't find any documentation that explicitly states what the highest safe/allowable priority is, similar to FreeRTOS.How do I know what's the highest interrupt priority I can safely set in such cases? Is there any documentation from ThreadX that I'm missing, because I can't seem to find any mention of this.For context, I am using a U5 series MCU and I want to call queue related APIs in my CAN Rx callback.
Good day folks!I trust you are well.Do you know where I can find the example that was used to take the VENC power measurements as outlined on this Wiki page ?I can't seem to find it under the Applications and Examples in the STM32CubeN6 v1.2.0 Specifically I want to see how the part was configured to support the 1080p resolution.Warm regards
Hi, gents, I have some need to use SPI slave mode instead of working SPI master mode. I'm tranferring 22 16-bit words from Infineon slave board at 6Mhz clock rate, once per 100 ns, and have 4-line interface including CS line. Due to noisy lines I prefer to reset communication before each 22x16 bit transfer. The picture is attached - the 4th line represents CS signal, the 2nd line - data sent from STM32, line 3 is zero as zeros are sent. After some attempts to write the code I came to solution, when I'm attaching a low-priority EXTI interrupt to SPI5 NSS pin (PF6 GPIO pin), and this interrupt has the following code (this code worked OK for master mode):if (GPIO_Pin == GPIO_PIN_6) { if (hspi5.State != HAL_SPI_STATE_READY) { HAL_SPI_DMAStop(&hspi5); } HAL_StatusTypeDef td = HAL_SPI_TransmitReceive_DMA(&hspi5,(uint8_t*)spi2CAT, (uint8_t*)CAT2spi, CAT_PACK_SIZE*(sizeof(int32_t)/2)); tdd = td; SPI_cnt++;
Hello,It took few days to find what is wrong with network, and why I can't get it to work, finally I found what libraries have wrong definitions for heth and eth_handle in file nx_stm32_eth_config.h:extern ETH_HandleTypeDef heth; #define eth_handle hethFor N6 MCU correct definition is heth1 defined in main.c, and still, even if you replace heth to heth1 you will not get ethernet to work, I am not sure why, only one way how I get it to work is to replace all heth and eth_handle variables to heth1 in nx_stm32_eth_config.h file !But the worst moment is then you regenerate code from cubeMX all the replacements is gone and network will not work again.And for STM team - dont change structures in examples, include IOC files, because cubeMX generates code totally differently, you are not only causing problems for users, but you are also struggling to solve customer issues yourself.
Hello everyone, I'm currently working on a FOTA (Firmware Over-The-Air) system for my STM32-based project, and I’d love to get your insights or validation from the community regarding the architecture I'm considering. My Goal: To ensure safe firmware updates and enable a rollback mechanism in case something goes wrong during or after the update (e.g., power failure, invalid firmware, etc.). My Current Design: I’ve divided the Flash memory into three main sections: Region Description Bootloader Located at 0x08000000 — always runs first. Handles firmware updates and boot decision logic. Update Space A dedicated Flash section (e.g., at 0x08020000) where the new firmware is written and validated before execution. Application The main app firmware runs from here (e.g., 0x08080000). Update Workflow I'm Considering: The new firmware is received via UART/Wi-Fi and written directly to the update space in Flash. Once fully received, I compute the CRC on the update spa
Hello,I am developing a RAM-based bootloader on STM32H5, to update my firmware application.Application and bootloader resides on different flash areas, and the bootloader code is copied into RAM at startup.[0x8000000 - 0x801FFFF] bootloader[0x8020000 - 0x803FFFF] reserved[0x8040000 - 0x80FFFFF] application First, the bootloader erases all the application sectors.Then the bootloader receives code fragments via fieldbus, and program the flash memory 16 bytes (flash-word) at time, at correctly aligned addresses:int16_t HW_FLASH_Program(uint32_t addr, int32_t len, uint8_t *buff_p) { HAL_StatusTypeDef status; uint8_t flash_word[FLASH_WORD_LEN]; uint32_t aligned_addr; uint32_t offset; uint32_t chunk; HAL_FLASH_Unlock(); while (len > 0) { // back-align the address to 16 bytes aligned_addr = addr & ~(FLASH_WORD_LEN - 1); if ((addr == aligned_addr) && (len >= FLASH_WORD_LEN)) { status = HAL_FLASH_Program(FLASH_TYPEPROGRAM_QUADWORD, addr,
Hi everyone,I have successfully deployed the VENC_SDCARD example on the board and can see its feed on my laptop. Now, I want to record it at 480x480 resolution instead of the default 800x480 provided in the example.I have modified the buffer size, DCMIPP, LTDC configurations, and made a few additional changes. I’m attaching my main.c and stm32n6570_discovery_lcd.c files for your reference.The following is my camera feed.and these are the debug statements in the uart terminal.which looks fine to me with no errors.However, after recording in microSD card and decoding using the ffmpeg command provided in the project's README, I get the following error:kartikkhandewal@atl-hpzg14-99:~$ ffmpeg -f h264 -framerate 30 -i dump.bin -vf "fps=30" -c:v libx264 -preset veryfast -crf 23 output_fixed.mp4 ffmpeg version 4.4.2-0ubuntu0.22.04.1 Copyright (c) 2000-2021 the FFmpeg developers libavutil 56. 70.100 / 56. 70.100 libavcodec 58.134.100 / 58.134.100 libavformat 58. 76.100 / 58. 76.100 libavdev
I am trying to run a loopback test with 2 i2c's on the same board. The onboard leds need to light up on successful transmission and reception, the problem is the leds light up when in debug mode, going line by line, but not in stand#define I2C1_ADD (0x15<<1) #define I2C2_ADD (0x42<<1) uint8_t I2C1_tx='1'; uint8_t I2C2_tx='2'; uint8_t I2C1_rx,I2C2_rx; HAL_I2C_Slave_Receive_IT(&hi2c2,&I2C2_rx,sizeof(I2C1_tx)); HAL_Delay(100); HAL_I2C_Master_Transmit(&hi2c1,I2C2_ADD,&I2C1_tx,sizeof(I2C1_tx),1000); HAL_I2C_Slave_Receive_IT(&hi2c1,&I2C1_rx,sizeof(I2C2_tx)); HAL_Delay(100); HAL_I2C_Master_Transmit(&hi2c2,I2C1_ADD,&I2C2_tx,sizeof(I2C2_tx),1000); while(1) { if(I2C2_rx==I2C1_tx) { HAL_GPIO_WritePin(GPIOG,GPIO_PIN_13,SET); HAL_Delay(100); } if(I2C1_rx==I2C2_tx) { HAL_GPIO_WritePin(GPIOG,GPIO_PIN_14,SET); HAL_Delay(500); } }alone. Can someone plz suggest what might be wrong.
Hello,I’m trying to measure temperature using NTC sensors on four different ADC channels of my STM32 Nucleo‑H7 board. I could previously connect potentiometers to the same pins and get flawless ADC readings with the same code and CubeMX settings. I only added a function to convert NTC readings to temperature and didn’t change any other configuration.I connected the NTCs to PA6, PA7, PC4, and PC5. In my loop, I call HAL_ADC_Start(), then four times HAL_ADC_PollForConversion() and HAL_ADC_GetValue() to retrieve the raw ADC values. When I measure the sensor output directly with a multimeter, I see about 1.65 V, but the ADC reads ~0.03 V, resulting in completely unrealistic temperatures.I never had this issue with potentiometers on the same pins and code. Why am I getting such low readings with the NTCs? Is my channel assignment wrong, the pin mode incorrect, or could hardware jumpers/shielding be affecting it?Has anyone experienced something similar or have suggestions? Thanks!
Split from this thread as it has been solved, and this is a new question: How to access eMMC through OTG on STM32H750B-DK kit.?
Hi Team,we are currently developing a product using the STM32U5 series. In our previous version, we used the STM32U5A5VJT6Q, and for size optimization, we have migrated to the STM32U5A5QJI6Q. Both MCUs are functionally similar, and we have updated the pin configurations accordingly. We are successfully reading data from a radar sensor using the new MCU. However, we are facing an issue where the RTOS thread does not stop properly, and the record number reaches its maximum count. Upon comparing the old and new firmware, we noticed that the Configure the Systick function is present in the old version but missing in the new one. We suspect that the absence of this function might be causing the RTOS timing issues. We also found a similar unresolved query on the ST Community forum from 2018 regarding CubeMX and SysTick behavior(CubeMX and SysTick - STMicroelectronics Community). Could you please confirm: If so, what is the recommend
hello.I am using STM32F407VGT6 chip and trying to send data to PC with USB CDC function.But in the below function, the TrySendUsbPacket() function is not executing due to queue full phenomenon.void EnqueueUsbPacket(const uint8_t* data) { uint16_t next_tail = (usb_queue_tail + 1) % USB_QUEUE_SIZE; if (next_tail == usb_queue_head) { // Queue full: handle accordingly (error, framedrop, etc.) return; } memcpy((void*)usb_queue[usb_queue_tail].data, data, USB_FRAME_SIZE); usb_queue_tail = next_tail; TrySendUsbPacket(); // Add to queue and try to send immediately }I've put my full function as an attachment, can anyone tell me why the USB transfer doesn't happen until the queue is full?
Hi there,I would like to control WS2812B LEDs with a PWM timer and DMA.There are various tutorials on this, but they have not helped me and I am now asking you. Because it requires slightly different configurations depending on the model (F3, F4, G4, G0), I'm a bit overwhelmed.I start a DMA transfer, wait for the last pulse with an interrupt and stop the DMA transfer. So far so good in theory. I still have problems with the implementation.Even the simplest DMA example without WS2812B protocol does not work for me.Clock SYSCLK/HCLK: 170 MHzTIM1 CH4 configuredPrescaler: 170-1 => 1 MHZCounter Preiod: 100-1 => 10 kHzDMAMemory -> PeripheralData Width: Word (32 bit)6 PWM pulses (= 600 us) should be sent outTIM1 Mode + ConfigurationDMA SettingsSource:TIM_HandleTypeDef htim1; DMA_HandleTypeDef hdma_tim1_ch4; /* never used?! */ uint32_t data[] = { 30, 80, 20, 60, 10, 50 }; void HAL_TIM_PWM_PulseFinishedCallback(TIM_HandleTypeDef *htim) { HAL_TIM_PWM_Stop_DMA(&htim1,
I was trying to build a flight controller with this board. I was using rizacelik's repo for this project. At first, i was using the 3.0.1 firmware .hex file but then later wanted to switch to the newer 8.0.0 firmware so i flashed the newer .hex file (e.g , inav_8.0.0_STM32F411CE.hex) because the MPU6050 module wired correctly would hang my board for some odd reason. after the flash it didn't necessarily hang the board, but didn't get proper reads yet. the gyro was detected, but not the accelerometer. I was tweaking all in the configuration tab and maybe the uart1 and usb in ports tab (i don't remember clearly what was my last action in the Inav program), then suddenly the board stopped working. i disconnected everything and came to see that the USB Type-C direct connection with my pc was not working anymore. i tried multiple other working cables, no clue. Then I used my ST-Link V2 programmer, and it connected the board. I used the Cube programmer to erase the chip memory and refla
I used Cude IDE version 1.18.1. successfully then upgraded and wrote the second project (timer). I'm using Nucelo-64 STM32 F411RE with clock rate 84Mhz. My new project is to use the TIM4 with the settings: PSC: 8399, CP: 10000 to toggle the LED per second. The LED doesn't turn on/off whatsoever. (My prior project - to use the user button - doesn't work either!)My files: lib.hpp: #ifndef INC_LIB_HPP_ #define INC_LIB_HPP #if __cplusplus extern "C" { #endif void run(); void HAL_GPIO_EXTI_Callback(uint16_t); void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *); #if __cplusplus } #endif #endiflib.cpp:#include "main.h" #include "lib.hpp" #include <stdio.h> auto pressed = 0u; auto flag = false; void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) { if(GPIO_Pin == B1_Pin) flag = true; else flag = false; } void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim) { HAL_GPIO_TogglePin(LED_GPIO_Port,LED_Pin); } void run() { while (1) { if(flag){ pres
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.