Ask questions on STM32CubeMX. Discuss code generation and configuration challenges, among other topics.
Most recent activity
Hi, I have a STM32F767 project I recently updated to new software release: CubeIDE 1.12, CubeMX6.8 (both from previous versions 1.11.x and 6.7). CubeMX code generator now adds a check for flag VOSRDY after setting regulator voltage scaling in SystemClock_Config():LL_PWR_SetRegulVoltageScaling(LL_PWR_REGU_VOLTAGE_SCALE1); while (LL_PWR_IsActiveFlag_VOS() == 0) { }Before CubeMX 6.8 this was only the set function:LL_PWR_SetRegulVoltageScaling(LL_PWR_REGU_VOLTAGE_SCALE1);But the flag is never set at this stage. When I remove the check, my program runs fine again.I also created an emtpy project based on my .ioc (just deactivated ETH, USB, FreeRTOS, TouchGFX, USB and lwIP). No additional code, just the CubeMX generated code: Same behaviour! I can provide the project when needed.My observation of the PWR->CSR1->VOSRDY flag: It starts as 0 and gets only set to 1 later in the SystemClock_Config() function when calling LL_RCC_PLL_Enable();Can someone have a look at this please? ;)
Hi,The same as the title, I'm confused that why NOT just use systick as the tick of RTOS.The aim of the systick is for good portability of the RTOS, yes?
Hello, Is it possible to add these in the CubeMX?1. FDCAN filters, like: sFilterConfig.IdType = FDCAN_STANDARD_ID; sFilterConfig.FilterIndex = 0; sFilterConfig.FilterType = FDCAN_FILTER_DUAL; sFilterConfig.FilterConfig = FDCAN_FILTER_TO_RXFIFO0; sFilterConfig.FilterID1 = 0x444; sFilterConfig.FilterID2 = 0x555; if (HAL_FDCAN_ConfigFilter(&hfdcan2, &sFilterConfig) != HAL_OK) { Error_Handler(); }and similar to ADC conversion, you can specify the number of filters 2. Transmit messages, like: TxHeader.Identifier = 0x444; TxHeader.IdType = FDCAN_STANDARD_ID; TxHeader.TxFrameType = FDCAN_DATA_FRAME; TxHeader.DataLength = FDCAN_DLC_BYTES_12; TxHeader.ErrorStateIndicator = FDCAN_ESI_ACTIVE; TxHeader.BitRateSwitch = FDCAN_BRS_ON; TxHeader.FDFormat = FDCAN_FD_CAN; TxHeader.TxEventFifoControl = FDCAN_STORE_TX_EVENTS; TxHeader.MessageMarker = 0x52; if (HAL_FDCAN_AddMessageToTxFifoQ(&hfdcan2, &TxHeader, TxData0) != HAL_OK) { Error_Handler(); }also, the numbe
Hi,I use STM32L496ZGT6.I want to know why are HFRDY and THREAD set after running MX_USB_DEVICE_Init() ?HFRDY and THREAD are part of the FPCCR register.I configured MCU as USB device.Best regards.
I named one pin aLoadcell- and another aLoadcell+ in STM32CubeMx (v6.6.1). They both got the same C #define in the code, as both the '-' and the '+' were replaced by a '_'.#define aLoadCell__Pin GPIO_PIN_2 #define aLoadCell__GPIO_Port GPIOC #define aLoadcell__Pin GPIO_PIN_3 #define aLoadcell__GPIO_Port GPIOCSTM32CubeMx should check on uniqueness of all (pin) labels.
What do the green (pharmacy) crosses in the GPIO pin popup mean?
Hi. I have recently updated to latest version 1.12.0 and there seems to be some problem with code generator.There is no handler for RTOS systick or for HAL timer. in stm32g0xx_it.cThis was broken for F072 family in the past, but now it is also broken for G071 which is a problem for me.you can see here that system tick (rtos timer) does not have handler enabled and can not be checked from gui. The os tick is not called either. There is also a HAL timer feature but if I enable it it shows checked state while neither handler appears in stm32g0xx_it.c.It results in default intr handler crushBoth seem like a bug in generator.If i select systick as HAL timer it does generate the handler code, but IDE warns me that it should not be shared with rtos and it still not working correctlyIn neither of these cases the empty rtos project works.I can also attach the empty project if for some reason you cannot replicate it.Is this a known bug? will it be fixed soon? should I revert to version 11.x?(upd
Created a project template via CubeMX: STM32G030 is SPI slave and uses circular DMA bufs for transfers.As SPI master I'm using an ESP32 running micropython. This, though, should be irrelevant, as I don't rely on its output but what the Logic Analyzer says. And what the ESP32 = SPI Master = micropython says equals the output of the LA.Back to the STM32:Everything appears to be working, except changes to the MISO-buffer are not /fully/ reflected in the final transfer.I'm using a 4 byte array as MISO-buffer (called `spi_tx_tst_buf` in the project's source posted below), which I set initially to `XXXX`, modify right after boot to `!!!!` and then modify every 5 seconds in the mainloop - setting all 4 bytes to the same (random) character (e.g. 'AAAA', 5s later to 'BBBB' and so on).After boot up of the stm32 I trigger a full-duplex SPI transfer every 2s from the SPI master.When triggering the SPI transfer the first time after boot of the stm32 - let's say 1s after power-up - the stm32 a
Hi,I'm using Nucleo-l476RG and try to get an Interrupt with RTC accuarcy every second.My plan is to use the RTC WakeUp in Internal WakeUp mode with "RTC wake-up interrupt through EXTI line 20"However the problem is that the interrupt is fireing only once and then the WUTF in the RTC_ISR cannot be reset.I'm using the cubemx generated code and implement the interrupt with the following code:void HAL_RTCEx_WakeUpTimerEventCallback(RTC_HandleTypeDef *hrtc) { HAL_Delay(1); }and activate the time with the following:HAL_RTCEx_SetWakeUpTimer_IT(&hrtc, 10, RTC_WAKEUPCLOCK_CK_SPRE_16BITS);What am I missing?Regards
I've been trying to get a virtual COM port working on my NUCLEO-L073RZ for a couple of days now. I've used STM32CubeMX to set up my chip in USB Device mode and configured the USB_DEVICE middleware to act as a VCP with default settings. I also made sure to fix the clock configuration so it can drive the USB peripheral at the proper speed. I've left Minimum Heap Size at 0x200 and Minimum Stack Size at 0x400. In my main.c, I included #include "usbd_cdc_if.h"and I added the following to my main infinite loopuint8_t buffer[] = "Hello, World!\r\n"; CDC_Transmit_FS(buffer, sizeof(buffer)); HAL_Delay(1000);I then hooked up PA12 to USB-DP and PA11 to USB-DM, as described in the chip pinout. When I compile and download the code to my board, Linux cannot enumerate the USB device. In dmesg, I get the following prints. [ 9157.764155] usb 3-10.4.3: new full-speed USB device number 66 using xhci_hcd [ 9157.864133] usb 3-10.4.3: device descriptor read/64, error -32 [ 9158.072148] usb 3-10.4.3: device
I am working with a new design which includes a STM32H7A3IGT6 with a connected SDRAM, IS42S16320F-7.I've followed advice from this article:https://community.st.com/s/article/How-to-set-up-the-FMC-peripheral-to-interface-with-the-SDRAM-IS42S16800F-6BLI-from-ISSIWhen I pause the program after initialization, I can use the memory viewer to view and modify memory at 0xC0000000 with no issues. However, when I hit any code that attempts to view or modify that same memory range I get a memory fault.CFSR shows MMARVALID and DACCVIOL. MMFAR points to 0xC0000000.Here is my configuration: SDRAM Init Function:/** * @brief Perform the SDRAM external memory initialization sequence * @param hsdram: SDRAM handle * @param Command: Pointer to SDRAM command structure * @retval None */ static void SDRAM_Initialization_Sequence(SDRAM_HandleTypeDef *hsdram, FMC_SDRAM_CommandTypeDef *Command) { volatile HAL_StatusTypeDef result; __IO uint32_t tmpmrd =0; /* Step 1: Configure a clock configuration
Hi, I'm developing some firmware having in mind a possible future need for portability. Being so, I thought about labeling pinouts on the Device Configuration Tool (DCT) and generate code (in the future, giving the same pin names to different pin groups should work). However, I can't see a way to do the same with peripheral instances. For example, if I choose TIM6 on some uC and would like to choose (for whatever reason) TIM2 on another uC and with the same configuration, I would like to label them the same (MY_TIMER, or so) so I could adapt the firmware more easily. In short, I wanted to generate from DCT or Cube MX the same peripheral configurations, with the ability to change the peripherals without changing the label. Is this possible? Thanks in advance
A very strange things happened when trying to browse (open a project) on most of the directories located on my MAC (OS Monterey on Apple M1 MAX):I cannot see the folders structure when accessing DocumentsI can see folders when accessing PicturesThe directories informations looks identical (see the pictures)Can you please explain what is the reason? I use the latest STM32CubeMX.Thanks,Andrei
I have installed Xcode and tried to run the instructions "In case of error, try one of the following fixes: - $sudo xattr -cr ~/SetupSTM32CubeMX-6.8.0.app."
Hello,I want to know if there is a way to set the GPIO output level for an output at runtime before it will be initialized by the CubeMX generated MX_GPIO_Init() function?In other words: The MX_GPIO_Init() function writes the in CubeMX configured value to a GPIO output before intializing it:/*Configure GPIO pin Output Level */ HAL_GPIO_WritePin(***_GPIO_Port, ***_Pin, GPIO_PIN_SET);Can I somehow get CubeMX to insert a variable name/value instead of the define 'GPIO_PIN_SET' which would allow me to change the value before calling the MX_GPIO_Init() function?My intention is to decide at runtime if this pin should be initialized to high or low. I could copy&paste the generated MX_GPIO_Init() and adapt it to my needs, but then I am not in sync with the CubeMX project anymore. Also changing the pin value after the initialization is not an option for me because I don't want a wrong value at the pin.Thanks,JensEdit: Tried to clarify the 'runtime' aspect of the question.
So here Usart1 is shared in the code generated though we have defined in the CM7 and CM4 main.c files:UART_HandleTypeDef huart1;The uart is setup in the CM4 main:static void MX_USART1_UART_Init(void) { /* USER CODE BEGIN USART1_Init 0 */ /* USER CODE END USART1_Init 0 */ /* USER CODE BEGIN USART1_Init 1 */ /* USER CODE END USART1_Init 1 */ huart1.Instance = USART1; huart1.Init.BaudRate = 115200; huart1.Init.WordLength = UART_WORDLENGTH_8B; huart1.Init.StopBits = UART_STOPBITS_1; huart1.Init.Parity = UART_PARITY_NONE; huart1.Init.Mode = UART_MODE_TX_RX; huart1.Init.HwFlowCtl = UART_HWCONTROL_NONE; huart1.Init.OverSampling = UART_OVERSAMPLING_16; huart1.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE; huart1.Init.ClockPrescaler = UART_PRESCALER_DIV1; huart1.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT; if (HAL_UART_Init(&huart1) != HAL_OK) { Error_Handler(); } if (HAL_UARTEx_SetTxFifoThreshold(&huart1, UART_TXFIFO_TH
Hello,I followed a tutorial on how to generate a SINE wave using DAC and DMA that was really good. Logically it makes sense, you set up the DAC, set it to be triggered by a timer, then set up the DMA channel, set it to circular, and set it to use a table of values. Start the time and the DAC DMA, should work, right? Not working for me unfortunately, no output on the PIN PA4. Here are some screenshots of my CubeMX and a snippet of my MAIN Code:/* Private user code ---------------------------------------------------------*//* USER CODE BEGIN 0 */#define NS 128uint32_t Wave_LUT[NS] = { 2048, 2149, 2250, 2350, 2450, 2549, 2646, 2742, 2837, 2929, 3020, 3108, 3193, 3275, 3355, 3431, 3504, 3574, 3639, 3701, 3759, 3812, 3861, 3906, 3946, 3982, 4013, 4039, 4060, 4076, 4087, 4094, 4095, 4091, 4082, 4069, 4050, 4026, 3998, 3965, 3927, 3884, 3837, 3786, 3730, 3671, 3607, 3539, 3468, 3394, 3316, 3235, 3151, 3064, 2975, 2883, 2790, 2695, 2598, 2500,&n
I am struggling with the configuration of LwIP stack for my NUCLEO ST32F767 over FreeRTOS. I have read some articles and followed several tutorials, but everyone got me to a dead end. I tried different versions of the sw and fw as weel, cause I read some libraries were a bit buggy, but still I cannnot put it into work.Sometimes the OS gets frozen, others the UDP services simply do not seem to work.I would appreciate if you could provide me some step-by-step, in addition with a reference of the versions recommended for that, Thanks in advance.-
I recently upgraded from StM32CubeMX 6.6.1 to 6.8.0. The coloring of the TABS in Configuration are switched from darkblue and lightblue to something gray( hard to see).Is there a way to change it back?
On the NUCLEO-G474RE board I have tested the QSPI interface with a flash memory. The interface seems to work properly but the read transfer in quad mode is slower than expected.To analyze the issue I have reduced my test program to two calls: HAL_QSPI_Command and HAL_QSPI_Receive. There are no devices connected to the QSPI interface. I try to read 32 bytes, the CPU clock is set to 170MHz and the QSPI is working with 10MHz. On the oscilloscope I can observe the following behavior (yellow: QSPI_NCS, blue: QSPI_CLK):There are 3 breaks in the clock generation: A, B and C (2 + 8 + 8 clocks). In the phases (1), (2), (3) and (4) the data will be transfered:(1): 46 clocks = 8 (instruction) + 38 (19 data bytes)(2): 8 clocks (4 data bytes)(3): 8 clocks (4 data bytes)(4): 10 clocks (5 data bytes)The total number of transfered bytes (32) is correct. What is the reason for the breaks in the clock generation?My test program has been generated with STM32CubeMX 6.6.0 / STM32Cube FW_G4 V1.5.2. As
Hi,I setup a fresh project with STM32CubeIDE 1.12.0 (CubeMX 6.8.0) based on the iperf example for NUCLEO-H563 board. The project build and runs correctly. Fine!Then I opened the ioc file that comes with the example and did a small modification (add PF4 as GPIO output). Then I regenerated the code.As a result the project outline changed and the project did not build anymore due to lots of undefined references by the linker (SystemInit(), _tx_timer_interrupt(), many HAL_* functions).Questions:1) Can I expect that regenerated code by CubeMX is working on "original" examples?2) How Can I fix this? 3) The project folder structure in the IDE does not reflect the file structure on disc (e.g. Application/User only exists in IDE). How can I create such structure by hand, e.g. to fix this? Will this withstand a further regeneration of the code?Cheers,MatthiasOriginal project structure:Structure after code has been regenerated:
Hi,last Friday I updated to TouchGFX 4.21.3, STM32CubeIDE 1.12.0 and STM32CubeMX 6.8.0. At the first compilation I had an error telling that cmsis_os2.h was missing. For I couldn’t fix the problem instantly I totally deinstalled these 3 programs and reinstalled them. For testing I coded a simple demo in TouchGFX and imported it into CubeIDE without any problems. When opening CubeMX I got following messages (image 4a + 4b). This project was definitely set up with TouchGFX 4.21.3 and should be encluding STMCubeMX V6.8.0. There should not be a message to ‘continue’ or ‘migrate’. A message that TouchGFX 4.21.3 is unknown is not o.k..Further more it is impossible to install CMSIS-Pack by the 'embedded software manager'. Those packages are missing - at least for STM32F7 (image 5a + 5b).How can I install these packages by hand or when you will have fixed this problem? I’m working with Windows 10 and with STM32F769 Disco.Thanks for your replyThilo
Hi, when I use the cubemx to config the stm32h743iit6 project, the clock system shows some error as below. But I try it on another PC, and the same config can work well.I don't know why?
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.