Ask questions on STM32CubeMX. Discuss code generation and configuration challenges, among other topics.
Most recent activity
Hello, I am working with a custom board, using STM32F105VC. The board has some LED drivers, which they use I2C1 and I2C2. I2C1 works fine but I2C2 doesn't work. Configuration for both I2C are the same. hi2c2.Instance = I2C2; hi2c2.Init.ClockSpeed = 100000; hi2c2.Init.DutyCycle = I2C_DUTYCYCLE_2; hi2c2.Init.OwnAddress1 = 0; hi2c2.Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT; hi2c2.Init.DualAddressMode = I2C_DUALADDRESS_DISABLE; hi2c2.Init.OwnAddress2 = 0; hi2c2.Init.GeneralCallMode = I2C_GENERALCALL_DISABLE; hi2c2.Init.NoStretchMode = I2C_NOSTRETCH_DISABLE; if (HAL_I2C_Init(&hi2c2) != HAL_OK) { Error_Handler(); }Do I need to enable something else?In clock configuration, there is no setting for I2C1 and I2C2 peripherals. Why? (picture is attached)Anyone can help me?Thank you.
I have this odd behaviour, where the ADC1 works with a fresh .ioc configuraion but does not when I configure additional peripherals.The working case: (see attached f373rb_playground.ioc)Where I configure 4 channels of the ADC1 to work in scan mode together with the DMA in circular mode./* USER CODE BEGIN PV */ volatile uint16_t ADC_Buf[4 * 16]; /* USER CODE END PV */ /* USER CODE BEGIN 2 */ HAL_ADC_Start_DMA(&hadc1, ADC_Buf, 4*16); HAL_ADC_Start_IT(&hadc1); /* USER CODE END 2 */ while (1) { /* USER CODE END WHILE */ /* USER CODE BEGIN 3 */ printf("%d\t%d\t%d\t%d\n", ADC_Buf[0], ADC_Buf[1], ADC_Buf[2], ADC_Buf[3]); HAL_Delay(100); }This is working and I get a continuous stream of ADC values like:1615 313 0 23701615 314 0 23691615 313 0 23681612 313  
I recently upgraded CubeMX to latest v6.3.0 and I have my project based on STM32H743IIT6 microcontroller. If I try to open my project which is made using H7 firmware v1.8 without migrating it to latest v1.9 then CubeMX gets hanged and its not able to open the .ioc file.
Please check my ico and code,What is wrong with my configuration?TIMA and TIMB must be updated simultaneously with the master timer repetition event.
Please see attatched image of functions specified in datasheet.Please see image attatched of functions avalailable on cube MXThanks for your help !
I have downloaded the new H7 package as previously suggested and the issue still remains.Please see attatched image of functions specified in datasheet.Please see image attatched of functions avalailable on cube MXThanks for your help !
First time try ADC Dual Interleaved on STM32H750VB.The problem is when I try to split the 32bit result from DMABuff into 16bit master and slave, some of the reading is zero and it's random. Can anyone show me anything wrong on my code?If disable DCache and allocate DMABuff on RAM_D1.Without calling the SCB_InvalidateDCache_by_Addr, then there is no issue.Below is my code:__IO uint32_t DMABuf[BuffSize]; __IO uint16_t Master[BuffSize]; __IO uint16_t Slave[BuffSize]; int main(void) { /* USER CODE BEGIN 1 */ /* USER CODE END 1 */ /* Enable I-Cache---------------------------------------------------------*/ SCB_EnableICache(); /* Enable D-Cache---------------------------------------------------------*/ SCB_EnableDCache(); /* MCU Configuration--------------------------------------------------------*/ /* Reset of all peripherals, Initializes the Flash interface and the Systick. */ HAL_Init(); /* USER CODE BEGIN Init */ /* USER
..
I use STM32H750XB microcontroller for my project. I am able to configure clock for 480Mhz without using "Resolve Clock Issues" help. But if I use "Resolve Clock Issues" even once, then I get problem like the attached image. There is a calculation error right? Output of PLL give consistently 483Mhz and gives such error for different prescale numbers. I am new with STM uCs, I appreciate any help. Thank you.
void user_pwm_setvalue(uint16_t value){ TIM_OC_InitTypeDef sConfigOC; sConfigOC.OCMode = TIM_OCMODE_PWM1; sConfigOC.Pulse = value; sConfigOC.OCPolarity = TIM_OCPOLARITY_HIGH; sConfigOC.OCFastMode = TIM_OCFAST_DISABLE; HAL_TIM_PWM_ConfigChannel(&htim4, &sConfigOC, TIM_CHANNEL_1); HAL_TIM_PWM_Start(&htim4, TIM_CHANNEL_1); sConfigOC.Pulse = 95; HAL_TIM_PWM_ConfigChannel(&htim1, &sConfigOC, TIM_CHANNEL_1); HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_1);}int main(void){ /* USER CODE BEGIN 1 */ /* USER CODE END 1 */ /* MCU Configuration--------------------------------------------------------*/ /* Reset of all peripherals, Initializes the Flash interface and the Systick. */ HAL_Init(); /* USER CODE BEGIN Init */ /* USER CODE END Init */ /* Configure the system clock */ SystemClock_Config(); /* USER CODE BEGIN SysInit */ /* USER CODE END SysInit */ /* Initialize all configured peripherals */ MX_GPIO_Init(); MX_TIM4_Init(); MX_TIM1_Init(); /* USER CODE BEGIN 2 */ HAL_TIM
The define O_NONBLOCK exists twice. Once in:...\ST\STM32CubeIDE_1.6.0\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.9-2020-q2-update.win32_2.0.0.202105311346\tools\arm-none-eabi\include\sys\_default_fcntl.h:#define _FNONBLOCK 0x4000 /* non blocking I/O (POSIX style) */ .... #define O_NONBLOCK _FNONBLOCKand at in: <ProjectFolder>\Middlewares\Third_Party\LwIP\src\include\lwip\sockets.h:#ifndef O_NONBLOCK #define O_NONBLOCK 1 /* nonblocking I/O */ #endifNow a call like this fails:fcntl(socket_handle, F_SETFL, fcntl(socket_handle, F_GETFL, 0) | O_NONBLOCK);as the define in _default_fcntl.h is not compatible with lwIP.Please remove this define in _default_fcntl.h
Hey!I'm trying sending message over UART with DMA with following code and CubeMX configuration (attached pictures)char welcome[] = "hi!\r\n"; HAL_UART_Transmit_DMA(&huart2, (uint8_t*) welcome, strlen(welcome));Nothing else is changed. MCU doesn't send anything. The "HAL_UART_Transmit_IT" & "HAL_UART_Transmit" functions work.I'm using NUCLEO-L010, tried exact same configuration with another NUCLEO-F303 board and "HAL_UART_Transmit_DMA" works as expected.Code doesn't stuck or give any error messages during debug. What did I miss?
Hi,I am currently using the STM32L4 SPI generated from the CubeMX.I am receiving the slave data on MOSI line (instead MISO) everytime the read function is called.I selected the direction to 2 lines.hspi2.Init.Direction = SPI_DIRECTION_2LINESAll 0x00 in the side of MISO. Is this a normal behavior? Thanks for your reply
BTW, Errata says nothing about this mess.
ADC3 is broken when using the LL interface.1) This is because it gets initialized with invalid resolution bits:CubeMX currently generates: ADC_InitStruct.Resolution = LL_ADC_RESOLUTION_12B; ADC_InitStruct.LowPowerMode = LL_ADC_LP_MODE_NONE; LL_ADC_Init(ADC3, &ADC_InitStruct);But this needs to be: ADC_InitStruct.Resolution = __LL_ADC12_RESOLUTION_TO_ADC3(LL_ADC_RESOLUTION_12B);This results in bogus values.2) Initialization delay is broken: uint32_t wait_loop_index; wait_loop_index = ((LL_ADC_DELAY_INTERNAL_REGUL_STAB_US * (SystemCoreClock / (100000 * 2))) / 10); while (wait_loop_index != 0) { wait_loop_index--; }This is because the whole wait loop is doing exactly nothing and there is no reason for the compiler to not optimize it out. This can be easily fixed by declaring the loop index as "volatile
Hello,the documentation says that MBED TLS can be implemented without LwIP. If I enable LwIP usage in CubeMX, it only supports NetConn API and therefore requires also FREERTOS to be used...But I'd like to do it without FREERTOS using raw API for LwIP.I could probably add LwIP manually, but I need the way for CubeMX not to delete those files when regenerating project.Any solution, example, doc on this?Are there any other options for non-RTOS TCP protocol addition to MBED TLS ?Thanks in advance,regards,Bulek.
hi i am using STM32L071KZT6 chip in my board and using Cube ide for initialization and code development. in the datasheet it says KZT6 chip has 1 clock input and is configurable as HSE/LSE/HSI/MSI/LSI but in the Cubeide clock config page or System Core/RCC page, i cant select HSE external xtal option.
Hello, I want to connect the op-amp built into the microcontroller directly to the ADC input in a non-inverting mode, without outputting the negative input (VINM0) outside, but I cannot find this configuration in CubeIDE.For some reason, in the mode I need, a negative input is also displayed. It is written that it is for filtering, but it is completely incomprehensible to me what is meant, despite the fact that VOPAMP_OUT does not come out on the pin.
I have two Input Capture. One at channel 1 at TIM16 and one at channel 1 at TIM17.But only TIM17 calls sevral times. TIM16 only calls one time. Then it seems that it stops.Only call one time is a sign of the DMA is in normal mode. If I can call DMA servral times, that means that the DMA is in cirular mode.What happens:For input_capture0 (TIM17) array, it works like a charm. Every time I pulse 3.3v onto the input, I get a different value.But for input capture1 (TIM16) array, the function compute_frequency always return 0.153186 and the value never changes any more. No matter how much I pulse 3.3v onto the input.Can it be that even if I have selected cirular mode for TIM16...it's still normal mode?Because if I have normal mode on DMA for TIM17, the the same behaviour occurs, with a different value of course.The MCU is STM32F373VBTx and STM32CubeIDE 1.7.0My code:volatile static uint16_t input_capture0[2] = {0}; volatile static uint16_t input_capture1[2] = {0}; void STM32_PLC_Start_
Hello,I'm using STM32CubeMX 6.3.0 with the bundled version of STM32CubeF4I create a new project by selecting my STM32F769I-DISCO board and letting Cube initialize all peripherals to their default modes. I generate the project into an SW4STM32 toolchain. I then open the project and deploy or debug, and it fails on stm32f7xx_hal_rcc.c line 675. I think this is due to a bug caused by a few coding issues when trying to fix https://github.com/STMicroelectronics/STM32CubeF4/issues/17Notably, it's comparing single bits instead of multiple bit fields, the PLLP logic is wrong, and it isn't bit-shifting the PLLSource or PLLM fields. It's just a mess.If I bypass that broken check by having it return HAL_OK, it fails on HAL_PWREx_EnableOverDrive() with a timeout. Here's the SystemClock_Config(void) that STM32CubeMX generates:void SystemClock_Config(void) { RCC_OscInitTypeDef RCC_OscInitStruct = {0}; RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};
Hi!I have a STM32F373 processor and I have 2 Encoders and 3 Input Captures.I have enabled DMA for input capture.Timer 4:Timer 19: And I have this code.My questions are:Can I use Encoder together with Input Capture if Input Capture has DMA?What will DMA store inside the arrays input_capture[2]? Is it the counter value? I'm assuming it will be some kind of a counted value, right?Will this work?static TIM_HandleTypeDef* tim4_handle; static TIM_HandleTypeDef* tim19_handle; volatile static uint32_t input_capture0[2] = {0}; volatile static uint32_t input_capture1[2] = {0}; volatile static uint32_t input_capture2[2] = {0}; static uint32_t pulse_count[4] = {0}; void STM32_PLC_Start_Counters(TIM_HandleTypeDef* htim4, TIM_HandleTypeDef* htim19) { /* Encoder - Prescaler does not effect encoder */ if(HAL_TIM_Encoder_Start(htim4, TIM_CHANNEL_ALL) != HAL_OK) Error_Handler(); if(HAL_TIM_Encoder_Start(htim19, TIM_CHANNEL_ALL) != HAL_OK) Error_Handler(); /* * Input capture
Hello,I have generated code for STM32F7 using STM32CubeMX with firmware package version 1.16.1 and lwIP version 2.1.2.In ethernetif_init function of ethernetif.c file, I have changed default value of netif->hostname.(LWIP_NETIF_HOSTNAME is already enabled) But when I search the active nodes on network using "arp-scan --localnet" I see the hostname of my STM32 as "STMicroelectronics SRL" and not the one which was set in code.How can the default hostname be changed?Thanks.Abhijeet
I had several projects running, created with STM32CubeMX. Among them also the example H743ZI_LwIP_test1. Things were fine with firmware 1.3.0 and 1.3.2 but after upgrading to 1.4.0 , I can no longer connect to the network. No ping, no nothing. Currently I test with the NUCLEO-H743ZI board.I compared .ioc files and various code source, but couldn't find any Any help welcome,thanks in advancePeter
I've attached the core log file.I also have a workaround.sudo dnf install java-11-openjdk-1:11.0.12.0.7-0.fc34.x86_64 delete the jre directory that's packaged with STM32CubeMXln -s /usr/lib/jvm/java-11-openjdk-11.0.12.0.7-0.fc34.x86_64 jreInstall the software according to the directionsspecific versions may vary over time, but the general workaround approach should remain valid. With this I was able to successfully install and use STM32 without the installer crashing on me.
I used STM32G070 with LL instead of HAL!If I enter the value "x - 1" into the TIM Prescaler or Period, then the cube generates "TIM_InitStruct.Prescaler = x - LL_TIM_IC_FILTER_FDIV1_N2"CubeMX Ver: 6.3.0
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.