Ask questions on STM32CubeMX. Discuss code generation and configuration challenges, among other topics.
Most recent activity
Hello, I bought the STEVAL-IDP003V1D evaluation board and I want to create a "custom" IO-Link slave device that, I can hook up to an existing IO-Link Master. Then write commands from the master and receive a response from my slave. I found the IO-Link device stack https://www.st.com/content/st_com/en/products/embedded-software/evaluation-tool-software/stsw-io-link.html#resource and downloaded the device stack.Im trying to import that stack into MXCube and building the project, so I can debug it on my evaluation board. I just can't get to the point where I can actually build the project. I'm i not importing the file system correctly ? Am I missing some setup? I tried setting up my debugger via STLink but without any luck.
..
I see that the PLL's can be set to much higher clock than 72MHz rating. What will be the impact of overclocking it to say 100MHz or 144MHz ? What kind of impact are we looking at? I need more clock cycles per second for processing but i also need a 5+ MSPS ADC for my application. So I am exploring overclocking the part. In any case, please do explain overclocking impact and possibilities.
Setup:Project, generated by CubeMX and compiled by arm-none-eabi-gcc-9.2.0 toolchain. CubeMX firmware package version: STM32Cube FW_L4 V1.14.0CPU: STM32L432KCY (and others)Toolchain: arm-none-eabi-gcc-9.2.0 (and others)Compiler options: -mcpu=cortex-m4 -mthumb -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -O3 -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -fno-inline-functionsProblem:Usb not working properly.Solution:FunctionUSB_WritePMA, not working properly when project compiled using -O3 optimization option. Let's look at the file stm32l4xx_ll_usb.c. Pls. look at the function /** * @brief Copy a buffer from user memory area to packet memory area (PMA) * @param USBx USB peripheral instance register address. * @param pbUsrBuf pointer to user memory area. * @param wPMABufAddr address into PMA. * @param wNBytes: no. of bytes to be copied. * @retval None */ void USB_WritePMA(USB_TypeDef *USBx, uint8_t *pbUsrBuf, uint16_t wPMABufAddr, uint16_t wNBytes) { uint32_t n =
Hello,We are using STM32H743ZIT6 revision V.This is connected to an ethernet PHY device via RMII. The PHY outputs the 50MHz RMII REFCLK to drive the RMII on the STM.According to the following sources, the RMII TX data lines (TXD0 and TXD1) should be sampled by the PHY on the rising edge of the REFCLK, and thus should transition around the falling edge:official RMII specSTM32H7 datasheets Table 112. Dynamics characteristics: Ethernet MAC signals for RMIIthe timing diagrams from the PHYThis is not what I am seeing. The STM seems to be transitioning the TX data lines on (or near) the rising edge of REFCLK. We are getting CRC errors detected at the PHY on the RMII interface side.The trace attached shows a packet going out on the RMII. The scope resolution is 2ns, so it's possible the data lines do transition just before the clock edge, but according to the timing diagrams the transition should be at least 2ns before a clock rising edge.Any idea how to solve this? I didn't manage to find a
I have a CubeMX project that I started with the STM32L010K4, and due to hitting the limits of flash memory I wanted to update to use the (identical but with 64k flash) L010K8... however I can't see any way to achieve this in CubeMX.If I search for pin-compatible MCU's it offers L011, L021, L031... but not the other L010 in-series, and I can't find any way (short of re-starting the project or fiddling with the XML project files) to migrate across.If I switch the project to (for example) a compatible L011 and then back to L010 it only offers the K4 (16k) not the K8 (64k) variant.If I start a new project and select the K8, CubeMX then offers me a huge list of compatible micros including the L010K4... seems like some sort of bug in the way it decides what's compatible?
I am trying to create a project with the STM32 CubeMX for Eclipse 5.1.0 - Latest version i could findI have enabled the STM32G0 Package in the Software managerThis works in the standalone application under 5.4.0
I have followed the links and the latest version I can find is 5.1.0. The standalone application is version 5.4.0. The output is incompatible with 5.1.0 in the Eclipse version. The reason why this is causing me an issue is that I could not get the Eclipse 5.1.0 to allow me to build a project for the STM32G031KUx
I am initialising the ADC2 w/DMA via STM32CubeMX. Scan conv. = enabledcontinuous conv. = enabledDMA cont. requests = enabledoverrun behaviour = data preservednumber of conversions = 2 (channel 1 and channel 2)sequence of program (specific to DMA):1 - uint32_t adc_val[2] (variable created for DMA)2 - MX_DMA_init3 - HAL_ADC_Start_DMA_ (passed adc_val)4 - while(1) (using UART to send the adc data)I tried the same program using adc polling (HAL_ADC_getvalue) and it did give me some data. But the DMA doesnt seem to work.
I am trying to include the CMSIS/DSP Library into a uVision 5 Project generated by STM32CubeMX.I went to "Runtime Settings" and included checked the DSP checkbox.http://stm32f4-discovery.net/2014/10/stm32f4-fft-example/fft-enable-dsp-library-keil/In main.c I added the include line <arm_math.h>In the preprocessor settings I added the Symbol "ARM_MATH_CM4".STM32F412Re / Keil uVision 5What am I missing?The compiler throws 30 errors like:compiling main.c... C:\Keil_v5\ARM\PACK\ARM\CMSIS\5.6.0\CMSIS\DSP\Include\arm_math.h(645): warning: #47-D: incompatible redefinition of macro "__PKHBT" (declared at line 852 of "../Drivers/CMSIS/Include/cmsis_armcc.h") #define __PKHBT(ARG1, ARG2, ARG3) ( (((int32_t)(ARG1) << 0) & (int32_t)0x0000FFFF) | \ C:\Keil_v5\ARM\PACK\ARM\CMSIS\5.6.0\CMSIS\DSP\Include\arm_math.h(647): warning: #47-D: incompatible redefinition of macro "__PKHTB" (declared at line 855 of "../Drivers/CMSIS/Include/cmsis_armcc.h") #define __PKHTB(ARG1, ARG2, ARG3) ( (((
I think the issue lies within SPI not working correctly. I'm using the following function to transmit data using SPI.void RFM_Write(unsigned char RFM_Address, unsigned char RFM_Data) { uint8_t spiData[2]; spiData[0] = RFM_Address | 0x80; spiData[1] = RFM_Data; //Set NSS pin Low to start communication HAL_GPIO_WritePin(GPIOA, GPIO_PIN_4, GPIO_PIN_RESET); //Send Address with MSB 1 to make it a writ command and send data HAL_SPI_Transmit(&hspi1, &spiData[0], 1,10); HAL_SPI_Transmit(&hspi1, &spiData[1], 1,10); //Set NSS pin High to end communication HAL_GPIO_WritePin(GPIOA, GPIO_PIN_4, GPIO_PIN_SET); }I've generated all the initiating code using CubeMX, so unless CubeMX isn't functioning correctly, all the setting up should be correct. I've checked by connecting the MOSI to an oscilloscope if data is being sent, and it doesn't seem to be the case. I've also checked if the clock or slave select is working, but they also don't seem to function properl
I created a new project on STM32CubeMX and I started the project with MCU Selector. I selected the STM32F411VETx mcu and I started the project. All pins were reset. GPIOD Pin 15 I made an output. The RCC I chose High Speed Clock (HSE): Crystal/Ceramic Resonator. In the SYS I chose Debug: Serial Wire. Next I generated the code for MDK Keil 5 with the default settings. When I open the project in Keil MDK 5 and build it everything is perfect. When I try to download the code onto the board I get the Error: "No-STlink was found". I have ST-LINK on my board and it works fine since I have used it before. How can I fix this problem. Thanks
Hello community.There was a problem with sending data via SPI. After the successful transmission of the first package, the second and further package arrive shifted by one bit. The whole package shifts. Now I fixed the problem by reinitializing the SPI after sending the package, but this is a bad solution to the problem.I also noticed that after shifting the most significant bit, the MISO bus changes (seen in the video 4 sec and 28 sec). I tried changing CPOL and CPHA, but it did not produce results.I generate the code on CubeMX. I use the HAL_SPI_Transmit function for maximum simplicity.Board stm32f030f4p6.I attach a video demonstrating the displacement, also a project on CubeMX.sample code:... #define CS_in_Pin GPIO_PIN_7 #define CS_in_GPIO_Port GPIOA SPI_HandleTypeDef hspi1; static uint8_t isTransmiteFinish = 0; ... void Func_SPI_Trans() { HAL_StatusTypeDef hal_res; static uint16_t data = 1; static uint16_t dataSize = 1; static int timing = 500; hal_res = H
I have had a problem getting DMA TX for USART1 to work, no errors, stream gets enabled nut nothing is transferred, stream never complets. I am using LL driver for USART1.I finally found the problem is that generated usart.c code inits DMA without enabling the CLK. Init of DMA is done after USART1. Eventually I found the "hidden" up/down arrows in CubeMX (scroll down the window) and could move call to MX_DMA_Init() up before other peripherals.I am note sure if CubeMX is supposed to leave such detals to the user - I would not misssed it not using CubeMX but one assumes CubeMX has the brains to handle this dependency, or?I have CubeMX 5.4.0 and STM32F413 MCU.
Dear ST,Do we have a functionality to generate main.cpp from CubeMX? HAL supports C++ and it is possible to make project C++ by renaming main.c to main.cpp, but after regeneration you just get new main.c without your code, so again need to merge it manually with existing main.cpp. This is very annoying and would be very useful to be able to generate file main.cpp in CubeMX and CubeIDE directly.Do we have an easy solution to fix it? If not, is it planned to be implemented in user friendly way in CubeMX?Thank you.
CubeMx version 5.4.0., STM32Cube_FW_H7_V1.5.0ADC Oversampling Ratio EditBox doesn't allow to enter 1024, max value 1023. But it should, HAL_ driver makes subtraction -1, so 1024 is correct value.
Hi, I am new user to ARM Cortex world. I have purchased a new kit Nucleo having F411RE. I have installed STM32CubeMX ver 5.4 and OpenSTM32 workbench ver 2.9 in my Windows 10 Laptop. Everything is installed successfully. I have tried to generate code in STM2CubeMX but it gets stuck. I have tried multiple times but does get through. Please see the attached pic. Pics of Configuration inside Cube are attached. No other configuration has been changed by me. Attached is also ioc file. What could be the reason and remedy for it. Could it be related to Java. I have Java installed with Version No. 1.8 enabled in my Laptop. Do I need KEIL to be installed in my Laptop ?
I have try to use the USB-VCP (Virtual COM Port) on the STM32L412KB (32-pin) but I have an issue that the code which is generated from the CubeMX got stuck at MX_USB_DEVICE_Init() and I try to debug in the Atollic TrueStudio, it causes the hard fault on HAL_PCD_init() function in USBD_Init process.Issue: MX_USB_DEVICE_Init() got stuckMCU: STM32L412KB (NUCLEO-32 Board)Firmware Package Name and Version: STM32Cube FW_L4 V1.13.0CubeMX version 5.1.0Toolchain/IDE: Atollic TrueStudio Version 9.1.0Please suggest, thank you very much.P.S. I have used the USB-VCP via CubeMX on the another chip such STM32F072, STM32L053, STM32L476 with no problem.
I'm starting to get comfortable with CMSIS-RTOS (and the STM32 implementation "uniqueness's" :) ), and next phase is adding LwIP support to my project. My IP needs are fairly simple, so was originally planning on using the Raw API. I see using CubeMX that if FreeRTOS is enabled, it forces the RTOS-based LwIP implementation.I'm only using the RTOS for some high level stuff, so it's timer tick is 10ms instead of 1ms. I was trying to keep it mostly out of the way. Is trying to ignore the RTOS mode a bad idea given it is there already? Should I just use RTOS mode and deal with the overhead? I am concerned about flash space, I'm on an H750 with only 128KB of flash and it's almost 50% used in early stages of the project.Any insights appreciated, thanks in advance.will
Hello,i am making a simple project for STM32L151C6 using Cube. I am using as timing source the TIM2 and i just use the below code to toggle a LED:/* USER CODE END Header_StartDefaultTask */ void StartDefaultTask(void const * argument) { /* init code for USB_DEVICE */ MX_USB_DEVICE_Init(); /* USER CODE BEGIN 5 */ /* Infinite loop */ for(;;) { HAL_GPIO_TogglePin(LED_GPIO_Port, LED_Pin); //Toggle the state of pin osDelay(50); } /* USER CODE END 5 */ }The problem is that HAL_GPIO_TogglePin() is executed not every 50 mSec but every 6-7 seconds.Is there something is missed out during configuration? I am attaching the Cube file.
The H747I-DISCO specs say 2MB Flash and 1MB RAM. From that, I am trying to understand what the start addresses of both areas are.I see that for both processors (M7 and M4) two .ld files get created:STM32H..._FLASH.ld and STM32..._RAM.ld, for a new STM32 project, with default peripheral settings, generated by CubeIDE 1.1 with CubeMX 5.4In the FLASH file, I see a MEMORY structure that contains{ FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 1024K RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K ITCMRAM (xrw) : ORIGIN = 0x00000000, LENGTH = 64K }My questions:1) If 0x08000000 is in fact the start address of FLASH, why is the length only 1024K. Similarly for RAM - if 0x20000000 is the start address, why is the length 128K.More to the point, if I change the LENGTH values to 2048 and 1024 to correspond to what is supposedly on the board, is that valid, and is that the way to use all memory available?2) Why is there a separate RAM.ld file, which has completely different values for FLASH and RAM:MEMO
I have trying for two weeks but cant solve an error can you help me about the receive error.It is in stm32f4xx_hal_can.c at line 1136. The conditions given below;if ((hcan->State == HAL_CAN_STATE_READY) || (hcan->State == HAL_CAN_STATE_LISTENING)) { /* Check the Rx FIFO */ if (RxFifo == CAN_RX_FIFO0) /* Rx element is assigned to Rx FIFO 0 */ { /* Check that the Rx FIFO 0 is not empty */ if ((hcan->Instance->RF0R & CAN_RF0R_FMP0) == RESET) { /* Update error code */ hcan->ErrorCode |= HAL_CAN_ERROR_PARAM; =======> STACK IN HERE return HAL_ERROR; } }Its about software or hard ware ??(NOTE: The transmission process is executed successfully by another node in same line. )
Hello!I work on 10KHz dual PWM (CH, CHN) generation with dead time implemented.In error handle I want to stop the timer, and now I do it like this:if(HAL_TIM_PWM_Stop(&htim8, TIM_CHANNEL_2) != HAL_OK) { //Error_Handler(); } //Stop channel xN if(HAL_TIMEx_PWMN_Stop(&htim8, TIM_CHANNEL_2) != HAL_OK) { //Error_Handler(); }--------------------------------------------------------------------------------------------------------------------(duty cycle 50%)The first osci picture looks like its a good stop, but the second osci picture is totally bad.The thing, if I use the firt cube picture config, and change the time when I execute the STOP function, it create a peak on Negative channel.The main problem is when the N channel output is high, when it doesn't need to be.I does'nt really understand, why it switch pin to HIGH at the moment of STOP.So my question is, how to stop properly the timer?Do I miss some other configuration in CubeMX?I have tried to change PWM mode 1, 2 and
I'm using two STM32 controllers and the CubeMX-HAL. The two controllers can communicate trough SPI (STM32L476 as Master, STM32F410 as Slave).The master sends the data correctly (this has been proved with a logic analyzer), but the slave is receiving something very different.Has anyone an idea what can be the purpose of this behavior?Hardware-Setup:Both controllers are powered via 3.3V. GND is connected. SPI1 is used on both controllers.MOSI is connected to MOSI (Master PA7 -> Slave PA7)MISO is connected to MISO (Master PA6 -> Slave PA6)SCLK is connected to SCLK (Master PA5 -> Slave PA5)CS is connected, but currently used for another purpose (Master PA4 -> Slave PA4).There is no other device on the SPI, therefore CS is not needed from my point of view.Master SPI-Init:SPI_HandleTypeDef hspi1; GPIO_InitTypeDef GPIO_InitStruct = { 0 }; //Enable Clocks __HAL_RCC_SPI1_CLK_ENABLE(); __HAL_RCC_GPIOA_CLK_ENABLE(); //Init SPI-Pins GPIO_InitStruct.Pin = GPIO_PIN_5
Hey ST & All,As others have mentioned for other peripherals, the DMA initialization (e.g. MX_DMA_Init) is called after the ADC peripheral is initialized (i.e. MX_ADC1_Init), preventing proper configuration. Please fix in the next rev!! This cost me more time to debug than I am willing to admit. =)Thanks!
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.