Ask questions on STM32CubeMX. Discuss code generation and configuration challenges, among other topics.
Most recent activity
The error is "The code is successfully generated under C:/users/pc/documents/.....path.... but MDK Arm v5.27 project generation have a problem
Hi, I'm trying to use HAL_UART_Receive_IT with a fixed size buffer, but only the first element changes its value.I'm using CubeMX over NUCLEO-STM32F446REThe only things I do:main.c I declare the buffer like this:uint8_t rx_buffer[5];The UART initilization:static void MX_USART2_UART_Init(void) { /* USER CODE BEGIN USART2_Init 0 */ /* USER CODE END USART2_Init 0 */ /* USER CODE BEGIN USART2_Init 1 */ /* USER CODE END USART2_Init 1 */ huart2.Instance = USART2; huart2.Init.BaudRate = 115200; huart2.Init.WordLength = UART_WORDLENGTH_8B; huart2.Init.StopBits = UART_STOPBITS_1; huart2.Init.Parity = UART_PARITY_NONE; huart2.Init.Mode = UART_MODE_TX_RX; huart2.Init.HwFlowCtl = UART_HWCONTROL_NONE; huart2.Init.OverSampling = UART_OVERSAMPLING_16; if (HAL_UART_Init(&huart2) != HAL_OK) { Error_Handler(); } /* USER CODE BEGIN USART2_Init 2 */ /* USER CODE END USART2_Init 2 */ }and inside the main function, just before the while loop:HA
No assembly code is generated for UART initialize call function.
Hello everyone, at the beginning of this year I bought a microcontroller, it was a version with 400MHz clocking, at the moment CubeMX allows you to change the frequency to 480MHz, can I change it, will everything work properly. Best Regards
I'm using the STM32F103RBT6 to counter a external pulses with TIM3. But the counter is always ZERO. I can check the pulse with oscillometer. It is about 1KHz. Here is the code. Could any one tell me what is the issue ? Thank you.int main(void) { /* USER CODE BEGIN 1 */ u16 valComp,Tests; /* USER CODE END 1 */ /* MCU Configuration--------------------------------------------------------*/ /* Reset of all peripherals, Initializes the Flash interface and the Systick. */ LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_AFIO); LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_PWR); NVIC_SetPriorityGrouping(NVIC_PRIORITYGROUP_4); /* System interrupt init*/ /** NOJTAG: JTAG-DP Disabled and SW-DP Enabled */ LL_GPIO_AF_Remap_SWJ_NOJTAG(); /* USER CODE BEGIN Init */ /* USER CODE END Init */ /* Configure the system clock */ SystemClock_Config(); /* USER CODE BEGIN SysInit */ /* USER CODE END S
Im using an F4 and modified my code to support an analog input using CubeMX. It messed up my project directory so i copied the new adc files to my unharmed project. I now get an "Error[Lp015]: section placement failure: overcommitted content in [0x802'0000-0x803'ffff]" and "Error while running Linker". Part of the code in the auto generated adc.c file is a function called MX_ADC1_Init();If i call this function i get the above error. If it is commented out, it builds successfully. If i call that function but comment everything out it builds successfully. If I incrementally add things in until i get the error then it fails within the HAL_ADC_Init() function (which is within the MX_ADC1_Init() function). Within the HAL_ADC_Init() function it fails when I uncomment hadc->Lock = HAL_UNLOCKED;The code below shows the hadc->Lock = HAL_UNLOCKED as uncommented. Has anyone seen this before? What could cause it? How do I fix it?Edit: worth noting is that many other unlock statements work co
Error 1:MX version: STM32CubeMX 5.4.0Firmware: STM32Cube_FW_F0_V1.11.0Compiler: IARMCU: Any in F0 seriesCompiling error:Error[Pe147]: declaration is incompatible with "__interwork __softfp void assert_failed(uint8_t *, uint32_t)" (declared at line 308 of "… main.c�?Analysis:The function, assert_failed(), generated by STM32CubeMX in main.c is defined as follows: void assert_failed(char *file, uint32_t line) {}The protoypte of this function should be below as mentioned in Release notes: void assert_failed(uint8_t *file, uint32_t line) {}Error 2:MX version: STM32CubeMX 5.4.0Firmware: STM32Cube_FW_F0_V1.11.0Compiler: IARMCU: STM32F042Compiling error:Error[Pe136]: “… stm32f0xx_hal_crc.h has no field "DefaultPolynomialUse�? “Analysis:On the one hand, the generating Polynomial in CRC peripheral of STM32F042 is not programmable, the macro CRC_POL_POL is undefined, as a result, DefaultPolynomialUse is not a member of struct CRC_InitTypeDef. On the other hand, the code generated by STM342CubeMX
I want to send audiodata from STM32f401 MCU to PCM5102A audio codec through I2S interface. Here are my settings in CubeMX:Code I used is:const uint16_t wavedata[] = { /* Random data, length 1024 */ }; void beep_blocking() { HAL_I2S_Transmit(&hi2s2, wavedata, sizeof(wavedata)/sizeof(wavedata[0]), HAL_MAX_DELAY); } void beep_dma() { //__HAL_DMA_ENABLE(&hdma_spi2_tx); // No difference HAL_I2S_Transmit_DMA(&hi2s2, wavedata, sizeof(wavedata)/sizeof(wavedata[0])); }When I use beep_blocking() function - everything is ok and I hear small peace of noise. But when I use beep_dma() function - nothing happens. What I am doing wrong?P.S. I do not want to use this as "beep" actually, I want to send data continuously. This is just a test.
Dear CommunityI am not able to glow Green LED on Nucleo Board. I have generated code through STM32CubeMX. I have attached files. Kindly help.
..
I want to measure speed of motor precisely with encoder pulses and for that I saw this topichttps://community.st.com/s/question/0D50X00009fDstgSAC/can-you-combine-encoder-and-input-capture-both-from-the-same-pin@Werner D�hn @akosodry and from what I understand here , encoder mode internally triggering another input capture timer My questions is ;my encoder has 360 line but multiplex by 4 because of two channel ,so it becomes 1440 puls for one revolution.I get 1440 puls from timer 4->CNT register but captured2 value from tim5 callback function give 360 puls is it correct ? or is it missing someting ?and also my rpm measurement range 10-100 RPM so I'm deal with very low frequencies and I'm okay with any suggestions for precise speed measurement in that frequencie range.Thanks in advance for any solution/* USER CODE BEGIN 0 */ void HAL_TIM_IC_CaptureCallback(TIM_HandleTypeDef *htim) { if (htim->Channel == HAL_TIM_ACTIVE_CHANNEL_1) { PPMValue_Prev = PPMValue; PPMV
Hi!I'm trying to get STM32F722RE USB_OTG_HS to work with internal phy as Full Speed device. No matter what I'm doing, configuring it through CubeMX, I can't get anything to show up in OS device manager. Already struggled with same problem ~1 year ago and gave up on it until today.I've been using similar configuration with F429 on Discovery board and it worked fine, so I tried to move it to F722, saving important pins needed for OTG_FS.Hardware is fine & triple checked, PB14 (Pin 35), D- wired to Micro-B Pin 2 and PB15 (Pin 36), D+ wired to Micro-B Pin 3 and VBUS on PB13.Nothing found in Errata, nothing special in USB application note.Do anyone got HS interface to work in FS mode on this MCU? Is anyone aware of some simple bug fix?I'm close to give up on this thing totally... as i also found that there is no bootloader mode with HS using BOOT0 ( I'd probably implement my own bootloader If i didn't loose all the hope on HS), but I'm affraid that this is some obvious bug, as it USB al
Hi All,I continually have problems with the HAL drivers and CubeMX. ST Doesn't seem to have a proper bug tracking and reporting system. If they have, I haven't been able to find it. I have posted bugs to the support system, but never seem to get any response.Yesterday I built a SPI to Ethernet interface with a simple LCD display for use as a data server interface to a real time power monitor. I used CubeMX to do this.When I built it I had errors when compiling lwip.c. Vizcompiling lwip.c... ../LWIP/App/lwip.c(85): error: #55-D: too many arguments in invocation of macro "osThreadDef" osThreadDef(EthLink, ethernet_link_thread, osPriorityNormal, 0, configMINIMAL_STACK_SIZE *2); ../LWIP/App/lwip.c(85): error: #20: identifier "EthLink" is undefined osThreadDef(EthLink, ethernet_link_thread, osPriorityNormal, 0, configMINIMAL_STACK_SIZE *2); ../LWIP/App/lwip.c(85): error: #144: a value of type "void (*)(void *)" cannot be used to initialize an entity of type "osPriority_t" osThreadDef(Et
Hi all,I have already built a project with STM32CubeMX ,and tried to read & write files in eMMC storage using FATFS. And now I can read the SDcard information & files by using FATFS, but for eMMC just can not and always return FR_DISK_ERR. I have used the USB function to connect to eMMC and it can format and open like disk , but using FATFS just return FR_DISK_ERR.Is there anything need to be set or corrected for eMMC storage?By the way, Is eMMC and SDcard using the same function and same method on read & write?Detail Information : MCU : STM32H743XIeMMC storage : Micron 4GBThanks for anyone can help, just need a little tips or some suggests !Wish you have good day!
STM32CubeIDE with STM32F3 HAL Library version 1.11.0.Using HAL library to set up timer (TIM6) driven ADC (ADC1) trigger with DMA (DMA1) capture. DMA does not configure correctly.The Cube Generated code in main.c configures the hardware as: /* Initialize all configured peripherals */ MX_GPIO_Init(); MX_RTC_Init(); MX_TIM6_Init(); MX_USART3_UART_Init(); MX_USB_PCD_Init(); MX_ADC1_Init(); MX_DMA_Init(); /* USER CODE BEGIN 2 */Unfortunately this is problematic because MX_ADC1_Init() code configures the CCR DMA register. These writes are ignored because the DMA has not be initialized and its clock is off. DMA behaves as if all the CCR bits are Zero. Quick fix is to exchange the order of MX_ADC_Init() and MX_DMA_Init(). A more permanent fix is to place a call to MX_DMA_init(); is the user code section prior to the Cube generated code so that when the code is regenerated, the DMA is initialized before the ADC.
Hi allI'm new in implementing SD-Card, however i've managed to run the example from the repository. I am using STM32429i-Eval Board with cubeMX and CubeIDE.Question is that when I run the example code on the board it works fine but when I create a new project (code generated by cubeMX) and copy the example code in it, the function f_mkfs() returns FA_NOT_READY error. All the hardware pin configurations are according to the schematic provided by the Eval-Board. Have a look at my code please.#include "main.h"#include "fatfs.h"/* Private includes ----------------------------------------------------------*//* USER CODE BEGIN Includes *//* USER CODE END Includes *//* Private typedef -----------------------------------------------------------*//* USER CODE BEGIN PTD *//* USER CODE END PTD *//* Private define ------------------------------------------------------------*//* USER CODE BEGIN PD *//* USER CODE END PD *//* Private macro -------------------------------------------------------------
HOW to set spi mode 3 in stm32cubemx.SPI Mode 3 CPOL = 1 (polarity), CPHA = 1 (phase), how to set these setting in spi stm32cubemx
I am trying create drivers for LCD using 8080 interface and STM32F765II cpu. In order to config the cpu I use STM32CuBeMX and I can select line A25 to switch command/data even when I set 16 bits data bus. But also I found next text in the datasheet: "In case of a 16-bit external memory width, the FMC will internally use HADDR[25:1] to generate theaddress for external memory FMC_A[24:0]. In case of a 32-bit memory width, the FMC will internally useHADDR[25:2] to generate the external address" So my questions are:Can A25 address line be used to switch command/data in case of 16 bit width? If yes how I can switch its state?
If i want to use external loader and not in basic list,how can i write a custom external loader?I only use cubeIDE and cubeMX,can I write the file(*.stldr)?I find the W25Q256.flm but can't use it.
Hi everyone,I'm trying the get the following setup working for a F767 nucleo board:Matlab/Simulink R2019bSTM32MAT/Target v5.1.0STM32CubeMX v5.4.0SW4STM32(All latest versions)I've set up the model settings in Simulink to use the STM32.TLC, and pointed Simulink to the directory that contains Cube.I've created the .IOC, and generated the project code, which opens nicely in SW4STM32 Building via simulink (simple model of GPIO in and GPIO out to turn LED on and off), seems to work, but leaves the folder structure below:The project builds without error in SW4STM32, but resulting .ELF has no mention of the simulink generated code anywhere in it, and so does nothing when downloaded to the Nucleo board:It seems to me that although the STM32-MAT/Target is creating code, Cube just ignores it when doing its thing.Does anyone have any ideas please?
Hi. Let me remind you this "easy to reproduce" problem which hits all Nucleo F722 user is still remain "not responded", during last one year. https://community.st.com/s/question/0D50X00009sWYPBSA4/cubemx-generated-stm32f722-code-gives-broken-character-on-uart-tx
Hellosome LL DMA commands do not work correctly.CubeMX generates the following SPI/DMA init code:... GPIO_InitStruct.Pull = LL_GPIO_PULL_NO; GPIO_InitStruct.Alternate = LL_GPIO_AF_5; LL_GPIO_Init(GPIOB, &GPIO_InitStruct); /* SPI2 DMA Init */ /* SPI2_TX Init */ LL_DMA_SetPeriphRequest(DMA1, LL_DMA_CHANNEL_5, LL_DMA_REQUEST_1); LL_DMA_SetDataTransferDirection(DMA1, LL_DMA_CHANNEL_5, LL_DMA_DIRECTION_MEMORY_TO_PERIPH); LL_DMA_SetChannelPriorityLevel(DMA1, LL_DMA_CHANNEL_5, LL_DMA_PRIORITY_LOW); LL_DMA_SetMode(DMA1, LL_DMA_CHANNEL_5, LL_DMA_MODE_CIRCULAR); LL_DMA_SetPeriphIncMode(DMA1, LL_DMA_CHANNEL_5, LL_DMA_PERIPH_NOINCREMENT); LL_DMA_SetMemoryIncMode(DMA1, LL_DMA_CHANNEL_5, LL_DMA_MEMORY_INCREMENT); LL_DMA_SetPeriphSize(DMA1, LL_DMA_CHANNEL_5, LL_DMA_PDATAALIGN_HALFWORD); LL_DMA_SetMemorySize(DMA1, LL_DMA_CHANNEL_5, LL_DMA_MDATAALIGN_HALFWORD); ...I figured out that these commands don't do anything:LL_D
hi i work on two MCU 743 and 745. for H743Vi additional software in Cube mx is ok and i can use it but for other MCU H745Zi Nothing appear i check it and find for H7X5 series additional software not available :pensive_face: that is a BUG ?!!! :|
I've never had a error like this before. The error is as in the picture. Could it be related to version 5.4 of Cubemx? Because I formatted the computer. I downloaded the latest version of Cubemx, 5.4.0 Maybe if you give me the download link of the previous version 5.3.2, I can try it. So We can understand that error is related to the release.
Hello, I have been trying to download en.STM32Cube_FW_F7_V1.15.0.zipfor here https://my.st.com/content/my_st_com/en/products/embedded-software/mcu-mpu-embedded-software/stm32-embedded-software/stm32cube-mcu-mpu-packages/stm32cubef7.htmlWhen it reaches to 90% of the download i get download error and it fails .I tried with different PCs same problem persists Please help me to download this
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.