Join conversations with your peers and ST experts. Explore the full potential of STM32 microcontrollers for your embedded design.
Most recent activity
ADC1 clocked @ 65 MHz, prescalar 0 for divide by 1, continuous conversion, DMA circular mode, 640.5 cycle sampling time, 256x oversampling, 12-bit resolution, 3 channels per sequence. The channels in the sequence are: IN3, temp sensor channel, Vrefint channel. I would expect a sequence to be converted in (3 * 256 * (640.5 + 12.5)) / 65000000 => ~7.7 ms.HAL_ADC_ConvCpltCallback() increments a counter for TC and HT. In 120 seconds (used debugger to stop) I get 60102. TC count = 60102/ 2 = 30051 for 120 seconds or 3.9 ms average/sequence. HAL_ADC_ErrorCallback() never called.Why the discrepancy: 7.7 ms expected vs 3.9 ms observed?MX_ADC1_Init() looks like…static void MX_ADC1_Init(void) { /* USER CODE BEGIN ADC1_Init 0 */ /* USER CODE END ADC1_Init 0 */ ADC_ChannelConfTypeDef sConfig = {0}; /* USER CODE BEGIN ADC1_Init 1 */ /* USER CODE END ADC1_Init 1 */ /** Common config */ hadc1.Instance = ADC1; hadc1.Init.ClockPrescaler = ADC_CLOCK_ASYNC_DIV1; hadc1.Init.Resolution =
I need to calibrate STM32l431 RTC in software for using LSI clock. When I compare STM32 RTC with GPS reference I get the following GPS 1759492828 1759493307 => RTC 1759500022 1759500494Diff GPS: 479 secondsDiff STM32: 472 seconds=> 7 seconds = 1.48% difference andPrefered frequency to RTC 32473 I thought smooth calibration could be used for this kind of calibration but it seems it can only calibrate small changes for crystal.Any ideas how this can be done? I cannot modify PCB for external pulses, I need to correct in software. Clock will be syncronised 8, 16 and 24 hours interval, so accuracy does not need to be like a crystal.
Hello,I use a custom board based on STM32H750 (as Discovery board) with a 800*480 TFT (24 bit).I try using the Video widget with the sample_video_1_medium_480*272 but in portait mode it show bad image, not understandable.Next I try a custom video with 480*320 resolution: now i see the rows and columns are inverted.For the first video I think there is also a problem with number of rows (272) since is not divisible for 32.If I change setting in Touchgfx designer with landscape, both 2 video are correct.I need to work in portait mode: I have to modify something in the program or try to rotate the video before compile?Thanks.toma Fabio
I have created a singletone class CommonUtils.cpp because I needed various functions to be used in various part of the code.It is a very simple class like:.cpp#include <gui/common/CommonUtils.hpp> CommonUtils& CommonUtils::getInstance() { static CommonUtils instance; return instance; }.hpp #ifndef COMMONUTILS_HPP #define COMMONUTILS_HPP #include <touchgfx/hal/Types.hpp> #include <touchgfx/Unicode.hpp> #include <gui/model/ModelListener.hpp> class CommonUtils : public ModelListener { public: // Get singleton instance static CommonUtils& getInstance(); // Delete copy constructor and assignment operator CommonUtils(const CommonUtils&) = delete; CommonUtils& operator=(const CommonUtils&) = delete; private: // Private constructor CommonUtils() = default; ~CommonUtils() = default; protected: Model* model = nullptr; };The class has various public function that can be call in various part of the code with CommonUtils::getIn
The reference manual mentions that data swapping can be used when e.g. processing ASCII, but I'm not clear on exactly what it does. If I set it to byte mode, does that mean I can write single byte values padded to 32 bits with zeros into the FIFO? And with the bit mode, can I write single bits padded to 32 with zeros? What if I don't pad with zeros and just write 31 random bits plus the 1 bit I care about?Obviously I can gather the bits together into a 32 bit word and write it in one go, but that will involve the CPU. If I can write bits, or even just bytes, with DMA, it will improve performance considerably.
Spoiler (Highlight to read)Hi,When using ZbZclWriteReq to write Zigbee attributes remotely, it works OK if I write one attribute at a time, but I am not able to write several at once. Shouldn't the following code work with two attributes? Is there any limitation in the implemented stack?memset(&writeReq, 0, sizeof(writeReq));writeReq.dst.mode = ZB_APSDE_ADDRMODE_SHORT;writeReq.dst.endpoint =SW1_ENDPOINT;writeReq.dst.nwkAddr = 0x0000; writeReq.count = 2U;writeReq.attr[0].attrId=MY_ZCL_DEV_TEMP_CURRENT ;writeReq.attr[0].type=ZCL_DATATYPE_SIGNED_16BIT; writeReq.attr[0].value= (const uint8_t*) val;writeReq.attr[0].length = 2; writeReq.attr[1].attrId=MY_ZCL_DEV_PRESS_CURRENT ;writeReq.attr[1].type=ZCL_DATATYPE_SIGNED_16BIT;writeReq.attr[1].value= (const uint8_t*) val2;writeReq.attr[1].length = 2; if(ZbZclWriteReq(zigbee_app_info.device_temp_client, &writeReq, APP_ZIGBEE_Write_cb,NULL) != ZCL_STATUS_SUCCESS){APP_DBG("Error, ZbZclReadReq failed (SW1_ENDPOINT)"
I generally don't open threads, but one recurring frustration I've had with Keil on CM0(+) platforms is with printf() going off the rails with "%.2lf" "%.3lf" type formats.I've seen more often than I care for, a situation where code working elsewhere fails with massive format failures, where it wants to prints tens of digits before/after the decimal point, and where it seems it trashes it own environment.It's gone away for the moment, with me making the stack as large as possible, I think I had a 1500 byte stack, it was using less the 940 bytes according to the high/low water mark analysis I did. So I'm a little skeptical that is the underlying issue.I'm using a G031 today, but seen on L011 too. Have seen in past issues with locale, heap and stack collide.Another annoyance is with "unsigned long" becoming 64-bit on the v6 compiler, and also with structure size alignment. Anyway, looking to read the temperature in the room (figuratively), and see if others have seen this beha
Hi In the past 6 months, I created a project for an STM32H755. For middleware, I selected CMSIS RTOS v2 (using FreeRTOS underneath).I noted that the header file is cmsis_os.h, which at first seemed wrong. I (maybe naively) asked the "AI", and with it's usual confident tone, suggested I change them (however, this is hard to maintain if you change your .ioc file).Looking at past posts on these forums, and inside cmsis_os.h, I confirmed that cmsis_os2.h is indeed included within it (despite the AI not finding this).So, I challenged the "AI", stating what I had found. Of course, in it's somewhat complimentary way, it agreed with me, but still insisted that if I am using entirely v2 APIs, I should change the headers.Of course, such responses derive from human content written elsewhere, and I fear it may not backed by actual facts. I have left the headers as they are for now. I have a bad feeling about changing them as ST might have reasons to do things the way they have. So, is it
Hi everyone, first, our setup: We're currently developing a custom-made board using STM32U375CGU6Q. We've configured the ADC1 for continuous scan conversion of 9 channels - VSENSE (int. temp. sensor) being one of them - and use the GPDMA to transfer the data into a buffer array. Using FreeRTOS, we have a task that regularly checks the temperature. VDD is supplied by a 3.3 V regulator, VDDA/VREF+ via a 2.048 V reference with up to 20 mA output current, VDD11 is using the SMPS (circuitry for SMPS is basically a copy-paste from the NUCLEO-U385RG-Q). Since there is currently a bug in CubeIDE regarding U3 PWR, we start up with the internal LDO enabled, then switch to SMPS using HAL_PWREx_ConfigSupply(PWR_SMPS_SUPPLY)straight after /* Reset of all peripherals, Initializes the Flash interface and the Systick. */ HAL_Init(); /* Configure the system clock */ SystemClock_Config(); The problem is this: The temperature readout will work properly for some time after power up
In X-CUBE-MATTER, how are the Basic Information Cluster attributes NodeLabel, ManufacturingDate, and UniqueId configured? Are they fixed values, or does the user need to implement their setting? Also, are these set using the ZAP Tool?Regarding UniqueId, I believe a truly unique value should be used. Is it implemented that way currently, or does this functionality need to be added?
Hi all, STM32 start executes the following during startup in main.c:HAL_Init();SystemClock_Config();Initialize all configured peripherals (e.g., MX_GPIO_Init())Enter the main while loopHowever, I've observed a cold-start issue:If the power supply is disconnected for 3–5 seconds or more, the system hangs and never reaches the main while loop after reboot.If the supply is disconnected for a short interval or a manual reset is applied, the system boots normally.While debugging, I suspected that the LSE/LSI/HSI oscillators might need more time to stabilize.Looking into HAL_RCC_OscConfig(), it waits for the HSI to be ready by checking RCC_FLAG_HSIRDY with a timeout mechanism: /* Get Start Tick */ tickstart = HAL_GetTick(); /* Wait till HSI is ready */ while(__HAL_RCC_GET_FLAG(RCC_FLAG_HSIRDY) == 0U) { if((HAL_GetTick() - tickstart ) > HSI_TIMEOUT_VALUE) { return HAL_TIMEOUT; } } When I set a breakpoint here, I noticed:tickstart is always 0HAL_GetTick() always returns
Reading STM32U5A5 Rev. ID returns 0x3003 using STM32Cube HAL API that is not listed in Reference Manual (RM0456). What is the revision of this product? The Reference manual lists only 0x3001 as revision X and 0x3002 as revision W.Thanks.
Hello, I'm using WinUSB and I'd like to program the flash memory at address 0x0800c0000 in 256-byte increments. This works fine the frame but every frame after this gets written to blocks in increments of 1024. It seems that if one needs to push more than 1024 bytes then I must use 1024byte pages. Does this sound correct? I'm testing this on a Nulceo H7A3ZI-Q
I've spent some time recently trying to prototype a small project based on the STM32H503 which would need to have the ADC and DAC running simultaneously with multiple channels of analog I/O via DMA. I was able to get this all coded up but discovered that sometimes on reset the DAC outputs were not as expected. Cycling power or asserting NRST would sometimes fail and sometimes operate properly. A quick look through the H503 errata revealed that this is a known issue - "2.2.21 Invalid DAC output voltage for several DAC kernel clocks".The problem is that the DAC requires both a bus clock and a kernel clock, and likely because of a synchronization issue between them the kernel clock and bus clock must be the same. Ordinarily this wouldn't be a huge problem except that the DAC and ADC share their kernel clock and the ADC is limited to a maximum 125MHz for its kernel clock. This results in the derived requirement that the AHB bus clock cannot exceed 125MHz when both the DAC and ADC are used
We have developed a custom board based on an eval board that has a LoRa transceiver and an RFID tag reader connected to two UARTs of the MCU. A serial console is also connected to a third UART. DMA streams are configured for the LoRa and RFID UARTs, and for Ethernet. The software application uses FreeRTOS and has an Ethernet stack implemented using LwIP. The app responds to UDP commands received by the device, which trigger interactions with the LoRa or RFID devices.The application works as expected when a USB J-Link JTAG interface is connected to the board, whether using the debugger, or just running. However, if the board is powered on without the USB J-Link attached, Ethernet does not work. The board does not receive any UDP packets or even respond to pings. The LEDs still flash, indicating that the main thread is still running.Any suggestions?
After solving my issue with reading the USER1 button (thanks to everyone who helped me on this forum :folded_hands:), I am now trying to handle USER1 button detection using interrupts.My project is running in FSBL mode, so I’m using NVIC FSBL. I’m trying to configure the USER1 button (EXTI13) with a pull-down in CubeMX. …but unfortunately without success.what is wrong ? in my configuration in CubeMX ? Cheers Emmanuel my code stm32n6xx_it.c : with void EXTI13_IRQHandler(void)/* USER CODE BEGIN Header */ /** ****************************************************************************** * @file GPIO/GPIO_IOToggle/Src/stm32n6xx_it.c * @author MCD Application Team * @brief Main Interrupt Service Routines. * This file provides all exceptions handler and * peripherals interrupt service routine. ****************************************************************************** * @attention * * Copyright (c) 2024 STMicroelectronics. * All
Hello everyone! I'm working on an application using AzureRTOS and FileX, however, I'm getting a hard fault that I can't pin down.Here is a screenshot of the variable states when entering _fx_directory_search (in middleware fx_directory_search.c) which causes the hard fault. It seams to occur as the function is called. (Not sure why the resolution is bad but don't think there is anything I can do about it I'm sorry!)I'm seeing a lot of 0x0 in the function arguments.media_ptr FX_MEDIA * 0x0 name_ptr CHAR * 0x0 entry_ptr FX_DIR_ENTRY * 0x0 last_dir_ptr FX_DIR_ENTRY * 0x0 last_name_ptr CHAR ** 0x200012a8 <fx_byte_pool_buffer+408> i ULONG 4025479151 n ULONG 1627389952 found UINT 134272988 status UINT 4025479151 v UINT 134276061 j UINT 10 cluster ULONG 536875464 next_cluster ULONG 4025479151 directory_size ULONG64 2305863900471563680 And a screenshot of the states before entering the above function: I take note of:name_ptr CHAR * 0xffffffff <error: C
Hi,I'm using an STM32H7 microcontroller and need to get the RTC working.I set RTC_OUT to 1Hz and set the LSE to a 32.768Hz crystal, and inserted the CR2032 battery.When the microcontroller is powered (VDD 3V3), I see the waveform oscillating at a frequency of 1Hz.My question is: should the signal on the RTC_OUT pin remain when I remove the power?Thanks
Hello everyone We successfully designed a custom board using the STMCSDK V6.4.1 and here is its specifications:MCU: STM32F030K6T6POWER BOARD: Based on STEVAL-IPM10Bwe successfully got a motor running and its nominal values are as follows:Pole Pairs: 5Vbus = 400V, Current = 2Amps, Speed = 1500rpm.We used the same board with another motor:Pole Pairs: 40Vbus = 400V, Current = 2Amps, Speed = 500 rpmThe First one runs smoothly and everything is fine, but the second one is making some annoying audible noise inside the motor. We tested it with a commercial board and its totally fine, so the motor isn't the problem.I have taken these steps so far and none of them have worked:1: decreasing and increasing the pwm frequency 2: decreasing the pi coefficients for the PLL3: decreasing the G2 coefficient for the observer 4: decreasing both kp and ki for torque and flux control loops5: decreasing and increasing deadtime for switching 6: decreasing and increasing the sampling cycles
The goal of my program is to: 1. Set low power time that runs off HSI for 10 seconds 2. Enter stop2 WFI 3. Wake up from low-power interrupt 4. Advertise for 5 seconds 5. Stop advertising 6. Repeat StepsDuring stop2 at the beginning of program my system is using ~ 74uA (which seems high but is reasonable), and when I wake up to start advertising and call aci_gap_set_discoverable(). This raises the current to ~3.4mA while advertising but when I call aci_gap_set_non_discoverable() it only lowers the current draw to ~3mA.I would expect the system to go back to the ~74uA it was drawing before advertising was turned on but it is not. I am able to connect to the chip over bluetooth successfully just want to know what needs to be done to get the power draw wher
Hello everybody,I'm trying to get from a pulled up state / driven up state to a tristate pin without losing the charge that is on that pin.It seems to me, that whenever a pullup is deactivated (PUPDR), that STM32 will first discharge the pin and then enter the tristate.The same happens when changing the mode (MODER) from (high-)driven output to tristate input. Also the pin gets discharged first and then floats from 0V to some 120mV or so within some seconds... I've tried STM32F401, STM32F103, STM32L152 ... they all behave the same, unfortunately. Do you know of any way to get from a high pin to a tristate pin without the pin being discharged first? So that the pin floats at 3V ? Thank you and best regards
I would like to ensure that I can use HAL_FDCAN_GetRxFifoFillLevel() function in HAL_FDCAN_RxFifo0Callback() like this: void HAL_FDCAN_RxFifo0Callback(FDCAN_HandleTypeDef *hfdcan, uint32_t RxFifo0ITs) { if (RxFifo0ITs & FDCAN_IT_RX_FIFO0_NEW_MESSAGE) { // used loop to read all messages from FIFO while (HAL_FDCAN_GetRxFifoFillLevel(hfdcan, FDCAN_RX_FIFO0) > 0) { can_msg_t rx_msg = {0}; if (HAL_FDCAN_GetRxMessage(hfdcan, FDCAN_RX_FIFO0, &rx_msg.hdr, rx_msg.data) != HAL_OK) { break; } rx_msg.data.data_len = (uint8_t)dlc_to_bytes(rx_msg.hdrDataLength); // put rx msg to queue osMessageQueuePut(rx_queue_handle, &rx_msg, 0, 0); } } } When I googling more whether I can use HAL_FDCAN_GetRxFifoFillLevel() in ISR CalIback I got:HAL_FDCAN_GetRxFifoFillLevel is not guaranteed to be ISR-safe because it's a read operation on a peripheral register that doesn't automatically handle atomic operations, which are required in interrupt contexts to preven
Hello Team,We are Looking to select MCU Which has High Speed SPI and QSPI in a Single Device ,High Speed SPI - 50 Mbps to 90 Mbps ( One channel ) to interface External Ethernet Controller QSPI - ( One channel ) - to interface with External Motion UnitBoth above interface work Independently and simultaeneously. Device from MCU Series U5 and H5 Would be preeferable. However , Our application is not batttery powered , so no power saving Headache.
Hello,I am working on a display using an 8-bit grayscale TFT LCD.The LCD panel itself is grayscale, but the driver IC is a hybrid designed for RGB.Because of this, pixels are grouped in sets of three, each driving RGB subpixels. For example, if the LCD resolution is 36×36, it actually needs to be controlled as 12×36.Currently, I am converting images into hex codes and managing them manually using a hex code editor.Is there a more convenient way to implement this using TOUCH GFX?As far as I know, TOUCH GFX does not provide a way to configure it like this.Thanks in advance.
Hello @Jocelyn RICARD , @D.Botelho I am trying to enable debug authentication on a stm32h573 mcu following this example: https://community.st.com/t5/stm32-mcus/how-to-enable-rdp-like-product-state-flash-protection-in-stm32h5/ta-p/708082.I was able to generate the obk file and to transition the device to provisioning state:This my xml file and the current product state: But when trying to provision the obk file, i got this error:Do you know what could be the problem and how to recover from this state and provision the device ?Thank you!
ST Community highlights – April to June 2026
Already have an account? Login
No account yet? Create an account
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.