Ask questions on STM32CubeMX. Discuss code generation and configuration challenges, among other topics.
Most recent activity
I'm trying to use the timer interrupt to blink some LEDs while my main is running, but when I run the code I can't achieve the interruption.
Hello, I'm programming using STM32H753. But I realized that the chip I chose when I was creating the project was STM32H743. Is there any way to change the chip settings in a project that has already been created? Should we re-create a new project unconditionally? Answer me. Thank you.
Hello , I am a student and want to understand the basic terminologies of the files being generated from the STM32CubeMX. Any document/Video to it will also be helpful.When I generate the code say for Nucleo-F401RE from the STM32CubeMX , I get these files in the project :stm32f4xx_hal.msp.c , stm32f4xx_hal_conf.h in the src and inc respectively.But if I see any CUBE MX project we have files like : stm32f4xx_nucleo.c , stm32f4xx_nucleo_bus.c and corresponding header file as wellapart from what we get in the STM32Cube code generation like hal_msp and conf header. Why cant we have these two files also get generated.I see that we have BSP_inits defined in the bus.c and then from that we call MX_<method> for any given peripheral ( i2c,uart) and this MX is what is generated inside the hal_msp.c.why to have files like nucleo and nucleo_bus when we can do with the hal_msp.c files?Thanks for reading this !!Regards,Ped
I have attached the .IOC file that will not migrate. Any help would be great.
With STM32CubeIde 1.9.0, open and change some settings in the IOC file, save your changes, and then click yes when a popup asks you to generate the code. At the end of the code generation, the IOC file is marked again as an unsaved file!
The sequence used to enable vrefbuf in HAL_MspInit() is not working.It calls HAL_SYSCFG_EnableVREFBUF() before switching from input to output (HAL_SYSCFG_VREFBUF_HighImpedanceConfig(SYSCFG_VREFBUF_HIGH_IMPEDANCE_DISABLE)), so HAL_SYSCFG_EnableVREFBUF() always returns a timeout error incase systick is running or blocks forever in case systick is not running. PS:In my opinion HAL_MspInit() should also return a HAL_STATUS instead of void.
Hello all, I have a STM32L552MEY6P. I am using it as a slave and setting an address. Using the MX cube set the speed for 400kHz. I have a Rasberry pi trying to do an address detect. Whenever I turn on the clock stretch, I get a read at address 0x50. Otherwise when the pi sends out 0x50, the data pin goes low on the ack bit and remains there.The pi is set to 40kHz. It seems to be a timing issue. Any thougts?
The prototype of the generated function by STM32CubeMx when using FATFS is:int32_t MX_FATFS_Process(void) This cannot be used with FreeRTOS as a task entry function since it has the wrong return and argument type. The function prototype should be :void MX_FATFS_Process(void *argument)So that it could be accepted while creating FATFS task: FatFsTaskHandle = osThreadNew(MX_FATFS_Process, NULL, &FatFsTask_attributes); In the example project provided in STM32Cube MCU Package for STM32L5 series, the function prototype is correct. The code generated by STM32CubeMX does not match this example.
See attached log.
I ran the routine, but it failed.Does anyone tell me about the connection of the hardware ?Thanks.
Initially I used version 6.5 of stm32cubemx to generate my project for stm32h743 and as I use the ADC module which I cannot get to work with this version, I switched to version 6.4, I So the problem of the ADC is solved, it works very well except that If I activate the LSE for the RTC instead of the LCI, using version 6.4 of stm32cubemx , the "SystemClock_Config()" function generates an error.
We have to make minimal changes to parts of the HAL code, which would be overwritten by code generation.Is there a recommended way to implement such changes, such that they don't get reverted by generation?The two ways I can think of both have their problems:patch the firmware pack files (i.e. in our case the extracted stm32cube_fw_g0_v151.zip files). This way, the changes would be part of the generated code. This would have to be part of the workspace setup for each developer, and would have to be repeated when the pack is updated.patch the generated code after generation. This would be an additional manual step after code generation. Lacking a "post-generation" hook (see my other post), this is easily forgotten by developers.Is there anything obvious that I'm missing to achieve modifying the HAL code?
I setup a project in CubeMX (STM32F302C6), activated CAN (and other peripherals) and did everything. I generated the code and opened it in eclipse. However, in the HAL_CAN library the functions like HAL_CAN_Transmit are missing. I have these control functions:/* Control functions **********************************************************/ HAL_StatusTypeDef HAL_CAN_Start(CAN_HandleTypeDef *hcan); HAL_StatusTypeDef HAL_CAN_Stop(CAN_HandleTypeDef *hcan); HAL_StatusTypeDef HAL_CAN_RequestSleep(CAN_HandleTypeDef *hcan); HAL_StatusTypeDef HAL_CAN_WakeUp(CAN_HandleTypeDef *hcan); uint32_t HAL_CAN_IsSleepActive(CAN_HandleTypeDef *hcan); HAL_StatusTypeDef HAL_CAN_AddTxMessage(CAN_HandleTypeDef *hcan, CAN_TxHeaderTypeDef *pHeader, uint8_t aData[], uint32_t *pTxMailbox); HAL_StatusTypeDef HAL_CAN_AbortTxRequest(CAN_HandleTypeDef *hcan, uint32_t TxMailboxes); uint32_t HAL_CAN_GetTxMailboxesFreeLevel(CAN_HandleTypeDef *hcan); uint32_t HAL_CAN_IsTxMessagePending(CAN_HandleTypeDef *hcan, uint32_t TxM
I have set the clock for the ADC to 51.2MHz by PLL2P with the DIV set as seen below. Without reprogramming the STM32H7A3 I would like to change DIVN2 to x16 and DIVP2 to /32 to give me 4MHz clock to the ADC, but I can not seem to find where these are set in the code.I Have checked the auto-generated code within main.c and there are no options for x32 and /5. Are DIVN2 and DIVP2 set outside of main.c, and if so where?Also is there anything else I need to know/do when changing the clock division via the code?Thank you for any helpCurrent clock configuration that is uploaded to the microcontroller, but DIVN2 and DIVP2 will needed to be changed.
Hi,I am using a TIM3 configured in OPM mode, trigger source set to TI1FP1.The COMP1 and COMP2 outputs are configured as internal connection to TIM3IC1. If I turn on only one comparator everything works, if both are on, it doesn't work. Configuration is done via CubeIDE. Maybe CubeIDE is setting something wrong. Is the simultaneous operation of the comparators possible? Do I need to find another solution?regards
I use the CubeMX in batch mode on a "nightly buid machine" without an internet connection. Now with CubeMx version 5 there is always a dialog box "Proxy Error" popping on which prevents the further processing of the batch file so that the code could not be created and tested. Is there a way to get off that dialog box ?
I have a custom board with STM32F302C8T6. I generated a custom HID project by CubeMX(STM32Cube_FW_F3_V1.11.3), and found that only two packets could be received if "USBD_CUSTOM_HID_SendReport" is used to send data back to host.Here are some more details:1. 0.zip is the original code generated by CubeMX. 305dea60e57af8b78b4e49039b6e2bd1fcf512cc.zip is the modified version. You can compare to see the difference. Also, you could see diff.diff to difference.2. In windows10 x64, I use a modified version of hid_test to test custom HID read/write. Please see "test.c" for details.3. In CUSTOM_HID_OutEvent_FS, if "USBD_CUSTOM_HID_SendReport" is called, the first two hid_write and hid_read_timeout will succeed. The following hid_write will fail. Also CUSTOM_HID_OutEvent_FS will be called only twice.4. If "USBD_CUSTOM_HID_SendReport" is not called, hid_write from host will always succeed (and CUSTOM_HID_OutEvent_FS will be called successfully also).5. So it looks that if USBD_CUSTOM_HID_SendRepor
Enable both USART1 and USART2.The code generated for initialization of the GPIO looks like this:void HAL_UART_MspInit(UART_HandleTypeDef* uartHandle) { GPIO_InitTypeDef GPIO_InitStruct = {0}; RCC_PeriphCLKInitTypeDef PeriphClkInit = {0}; if(uartHandle->Instance==USART1) { /* USER CODE BEGIN USART1_MspInit 0 */ /* USER CODE END USART1_MspInit 0 */ /** Initializes the peripherals clocks */ PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_USART1; PeriphClkInit.Usart1ClockSelection = RCC_USART1CLKSOURCE_PCLK1; if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK) { Error_Handler(); } /* USART1 clock enable */ __HAL_RCC_USART1_CLK_ENABLE(); __HAL_RCC_GPIOA_CLK_ENABLE(); /**USART1 GPIO Configuration PA9 ------> USART1_TX PA10 ------> USART1_RX */ GPIO_InitStruct.Pin = GPIO_PIN_9|GPIO_PIN_10; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; HAL_GPIO_I
Hey,I am trying to include X-CUBE-IRREMOTE for stm32g030f6p6 but it doesnt show up in software packs in cubeMXif i try to manually install it it gives an error of invalid packet
My Firmware Package name and version: STM32Cube FW_F1 v1.8.4Bug detail: After code generates, the code order is:In this order, receiving message of the usart will get some bugs, eg: only can receive the last byte...I let `the MX_DMA_Init();` become the first one solve the problem, but when I genearted code next time, this order will appear again...
When I set up the USB_OTG_FS peripheral in CubeMX I get the following error: Looking at CubeMX I can't see anything wrong. The only thing I noticed is that I can't enable VBUS Sensing. The only option is "disabled". It has a pin assigned for it, the box is ticked, but the drop down (highlighted above) only has "disabled" as the single option.Edit: I should add that I have the correct 48MHz clock. This is the NUCLEO board.Is the lack of VBUS detection the issue? The device is self powered. How can I figure out what the error message is referring to?
I have a random strange delay on SPI2 callback function on my SPI slave application.Normally the function is called regular after interrupt handling without delay but casually is affected by 1ms delay before its execution!void HAL_SPI_TxRxCpltCallback(SPI_HandleTypeDef *hspi) { if(hspi->Instance==SPI1) // SPI MASTER { ACC_ADXL_355.wTransferState = TRANSFER_COMPLETE; ACC_ADXL_345.wTransferState = TRANSFER_COMPLETE; ACC_MA_352.wTransferState = TRANSFER_COMPLETE; ACC_ADIS_16209.wTransferState = TRANSFER_COMPLETE; } else if(hspi->Instance==SPI2) // SPI SLAVE { SamplingData.SPI_Slave.wTransferState = TRANSFER_COMPLETE; } }This make an error on SPI slave response and the master receive a wrong data packet.Do you have any suggestion to avoid this condition and call this function wiyhout delay?uP part number: STM32L071CBTxSTM32CubeIDEVersion: 1.9.0Build: 12015_20220302_0855 (UTC)OS: Windows 7, v.6.1, x86_64 / win32Java vendor: AdoptOpenJDKJava runtime version: 11.0.11+9Ja
Hello,I seem to be having some problems with the code generated via STM32CubeMX on the NUCLEO-H743ZI development board. I want to configure it to run on LwIP/RAW API. I can create such a configuration for its close relative: the NUCLEO F767ZI development board. In the latter case I take the following steps: Set the HCLK to 216 MHz (clocked from the HSI);Enable the ETH peripheral, set it to RMII mode, and set ETH_TXD0 and ETH_TX_EN pins to PG13 and PG11 (others are mapped appropriately); Set the PHY address to 0 in ETH Configuration>General: Ethernet Configuration Enable the LwIP middleware;Enable ICMP (LWIP_BROADCAST_PING and LWIP_MULTICAST_PING in LwIP Key Options>IPMP Options). This step is not necessary, although it helps to determine if all is well with the device.After I generate the code, I add an extern variable to my main.c to be able to track whether the device has obtained an IP address:/* USER CODE BEGIN PV */ /* Private variables ----------------
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.