Ask questions on STM32CubeMX. Discuss code generation and configuration challenges, among other topics.
Most recent activity
I'm trying to use the LL interface to read 2 ADC channels (0 & 1) using DMA. They're configured pretty much as default, 12-bit samples into 16-bit memory variables. I don't see any errors. The transfer completes, as does the EOS. There's data in the DR. However only a single byte makes it into memory. (There should be 4 bytes.)Any thoughts on where the misconfiguration might be?adc.c generated codevoid MX_ADC1_Init(void) { LL_ADC_REG_InitTypeDef ADC_REG_InitStruct = {0}; LL_ADC_InitTypeDef ADC_InitStruct = {0}; LL_GPIO_InitTypeDef GPIO_InitStruct = {0}; /* Peripheral clock enable */ LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_ADC); LL_IOP_GRP1_EnableClock(LL_IOP_GRP1_PERIPH_GPIOA); /**ADC1 GPIO Configuration PA0 ------> ADC1_IN0 PA1 ------> ADC1_IN1 */ GPIO_InitStruct.Pin = TUBE_I_Pin; GPIO_InitStruct.Mode = LL_GPIO_MODE_ANALOG; GPIO_InitStruct.Pull = LL_GPIO_PULL_NO; LL_GPIO_Init(TUBE_I_GPIO_Port, &GPIO_InitStruct); GPIO_InitStruc
I have a problem trying to install an embedded software pack with STM32CubeMX. I follow the following steps:Help→ Manage embedded software packages→ STMicroelectronics tab → From Local…→ Open file_name.packI tried to run the program as Admin but it does not solve the problem.Does anyone know how to solve this? I need it for the "Implementing Neural Networks on STM32 MCUs hands-on workshop," of November 14th.
I have a fairly simple STM32F051R8 system reading an ADC sequence with two channels. I configured the system using CubeMX (v5.1.0, linux) with continuous and discontinuous modes disabled. I am polling the ADC in the simplest way imaginable. At times (5-10 seconds), I get the value for the first channel when reading the second. I have never seen the opposite (but it could be happening without me catching it). To test this, I am placing different DC values on each channel and logging the read values.I have tried various modes (continuous, discontinuous), EOC vs. EOS, without too much success. I found that the most stable sampling was performed this way (for polling at least).Any ideas why the ADC is not behaving as expected? What am I doing wrong with this simple ADC polling method?Thanks for the help!Here is my ADC config generated from CubeMX: hadc.Instance = ADC1; hadc.Init.ClockPrescaler = ADC_CLOCK_ASYNC_DIV1; hadc.Init.Resolution = ADC_RESOLUTION_12B; hadc.Init.DataAlign = AD
The Data sheet indicated Host mode is available on the Stmf107C as does the documentation for the USB Host Library.
I am trying this ADC configuration created by STM32CubeMX'''''''''''''''''''''''''''''''''''static void MX_ADC1_Init(void){ /* USER CODE BEGIN ADC1_Init 0 */ /* USER CODE END ADC1_Init 0 */ ADC_ChannelConfTypeDef sConfig = {0}; /* USER CODE BEGIN ADC1_Init 1 */ /* USER CODE END ADC1_Init 1 */ /** Configure the global features of the ADC (Clock, Resolution, Data Alignment and number of conversion) */ hadc1.Instance = ADC1; hadc1.Init.ClockPrescaler = ADC_CLOCK_SYNC_PCLK_DIV2; hadc1.Init.Resolution = ADC_RESOLUTION_12B; hadc1.Init.ScanConvMode = DISABLE; hadc1.Init.ContinuousConvMode = DISABLE; hadc1.Init.DiscontinuousConvMode = DISABLE; hadc1.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_RISING; hadc1.Init.ExternalTrigConv = ADC_EXTERNALTRIGCONV_T2_TRGO; hadc1.Init.DataAlign = ADC_DATAALIGN_RIGHT; hadc1.Init.NbrOfConversion = 1; hadc1.Init.DMAContinuousRequests = ENABLE; hadc1.Ini
I have a concern with the MX generator regarding `SystemClock_Config()` in that it's Visibility option can't be enabled, nothing happens when it's clicked. I'm using the "Separate .c/.h files per peripheral" option and the "Don't generate main()" option for better portability and c++ compatibility where I write my own `main.cpp` that doesn't interfere with the autogenerated files in any way other than importing them.When these options are enabled, `SystemClock_Config()` remains in the autogenerated `main.c` file, non-static, but the `main.h` does not contain the declaration so it's unreachable unless it's declared somewhere. I find making the declaration in my `main.cpp` quite ugly as from my perspective it's the job of the generator to provide usable header declarations. I'm also quite surprised that the function remains in `main.c` when the "Don't generate main()" option is used, I would expect a pair of `rcc.c` and `rcc.h` files to house this function.For this reason, I've "hac
Posted on October 12, 2017 at 02:45Details: STM32CubeMX v4.22.1, firmware library for the STM32F7xxx family v1.8.0.Created project for SW4STM32 using (nearly) default pin configuration for the Nucleo-144 with STM32F767ZI (rev Z).If it matters, the project is configured to generate files for AC6 (sw4stm32).The code generated in 'Src/main.c' has some problems: USART3 is initialized after the Ethernet MAC or USB devices (minor problem)The generated function 'MX_ETH_Init()' calls 'HAL_ETH_Init()'. If 'HAL_ETH_Init()' returns status other than 'HAL_OK', 'MX_ETH_Init()' calls '_Error_Handler()', which (of course) does not return. If there is no Ethernet link present when 'HAL_ETH_Init()' is called, it returns the status 'HAL_TIMEOUT', and does so without fully configuring the PHY for auto-negotiation per the configuration passed in.Because USART3 has not yet been initialized, attempts to print failure over USART3 fail for things like the Ethernet and USB initializa
Hello!Can anybody explain to me why the following code is not writing to the TIM2 and TIM3 CR1 register: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 */ /* timers will only generate an UI when the counter wraps around */ TIM2->CR1 |= TIM_CR1_URS; TIM3->CR1 |= TIM_CR1_URS; /* USER CODE END SysInit */ /* Initialize all configured peripherals */ MX_GPIO_Init(); MX_DMA_Init(); MX_ADC1_Init(); MX_OPAMP1_Init(); MX_OPAMP2_Init(); MX_TIM2_Init(); MX_TIM15_Init(); MX_USB_DEVICE_Init(); MX_TIM3_Init(); /* USER CODE BEGIN 2 */but when I move the register writes after the periph
Hi,I have a Project which is about data transfering and storaging. I use STM32H750VB micro processor, MT29F32G08CBADBWP-12IT:D Nand Flash and LAN8742A Ethernet Chip for my application. I configure and run Ethernet, ADC, I/O, UART etc. functions with using CubeMX. However I had some problems on Nand Flash application while was trying tu run it. I did run the Nand Flash application correct when I used STM32F407 Discovery MB997B development kit.I couldn’t find yet any example about H743ZI development kit.1- Do you have any experience about programming Nand Flash application with using H743ZI development kit.2- Do you have any idea "MPU - Memory Protection Unit" inside micro processor.
No red errors, here is a screen shot,Thanks, Mike
I am using NUCLEO-H743ZI2 and STM32CubeMX embedded firmware v1.5.0 .
Hello, After studying different issues on forum I still do not see anyone who solved this problem in a proper way. When using UART DMA transfer it suppose to trigger TCIE interrupt, /* Disable the DMA transfer for transmit request by resetting the DMAT bit in the UART CR3 register */ CLEAR_BIT(huart->Instance->CR3, USART_CR3_DMAT); /* Enable the UART Transmit Complete Interrupt */ SET_BIT(huart->Instance->CR1, USART_CR1_TCIE);that switch peripheral to state READY. in HAL_UART_IRQHandler, /* UART in mode Transmitter (transmission end) -----------------------------*/ if (((isrflags & USART_ISR_TC) != 0U) && ((cr1its & USART_CR1_TCIE) != 0U)) { UART_EndTransmit_IT(huart); return; }and static void UART_EndTransmit_IT(UART_HandleTypeDef *huart) { /* Disable the UART Transmit Complete Interrupt */ CLEAR_BIT(huart->Instance->CR1, USART_CR1_TCIE); /* Tx process is ended, restore huart->gState to Ready */ huart->gState = HAL_UA
Hi,When choosing USART2 as "Uart Trace Source" for the TRACER_EMB the generated tracer_emb_conf.h file contains a Java backtrace, and the generated project cannot be built.#define TRACER_EMB_USART_IRQHANDLER USART2_IRQHandler #define TRACER_EMB_TX_AF_FUNCTION LL_GPIO_SetAFPin_0_7 Error: on line 185, column 6 in tracer_emb_conf_g0.ftl Expecting a number here, found: valueNotSetted The problematic instruction: ---------- ==> if-else [on line 185, column 1 in tracer_emb_conf_g0.ftl] ---------- Java backtrace for programmers: ---------- freemarker.core.NonNumericalException: Error: on line 185, column 6 in tracer_emb_conf_g0.ftl Expecting a number here, found: valueNotSettedI have attached the full STM32CubeMX project file, and the generated tracer_emb_conf.h. As a workaround I use the LPUART, code generation works in this case.Best regards,Christoph
Hello everybody,I think I have stumbled accross a configuration and initialization error when using STM32CubeIDE and the CubeMX peripheral initialization:I am using a NUCLEO-L476RG board and want to use TIM2 to trigger TIM3 as a slave and start both timers simultaniously. As for TIM2 I use the following settings:for TIM3 the following:I also have acitvated the global interrupt on both timers since I want to use TIM3 to trigger the ADC and convert samples as long as TIM3 runs. TIM2 is the period at which I will send the avareged ADC samples to an external host.So I normaly thouight that the code generator would uses the HAL_TIM_SlaveConfigSynchro_IT(&htim3, &sSlaveConfig)function. But instead I get the following initialization which I then manually change in the interrupt driven slave configuration function:void MX_TIM3_Init(void) { TIM_ClockConfigTypeDef sClockSourceConfig = {0}; TIM_SlaveConfigTypeDef sSlaveConfig = {0}; TIM_MasterConfigTypeDef sMasterConfig = {0};
Hello, After update the CubeMX from 5.3 to 5.4, and I change the IOC and generate a new code, a error appear and debug is disconnected. Before the update:After the update:I doesnt change nothing in the code, just change a GPIO_Input to Output.I install the cubemx 5.3 and start work again.Can you help me with this?
Hi, I have a STM32CubeMX project where I use the UCPD1. When I disable the dead battery signals, save the project and reopen the project, the dead battery signals are activated again.Best regards,Christoph
It seems the clock configuration is not generated correctly by the Cube.Used STM32CubeMX Version 5.2.1 for STM32G070RBT deviceThe root cause seems to be the RCC_CCIPR_TIM1SEL is not defined.As a consequence the RCC_PERIPHCLK_TIM1 is not available and the PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_USART1|RCC_PERIPHCLK_ADC does mot enable the TIM1 clock in the generated SystemClock_Config()
MUC: STM32G031G8UxSTM32CubeMX version: 5.4.0Package version: STM32Cube FW_G0 V1.3.0Keil version: v5.28--------------------------------------------------------------------void MX_USART1_UART_Init(void){ huart1.Instance = USART1; huart1.Init.BaudRate = 38400; 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_TXINVERT_INIT|UART_ADVFEATURE_RXINVERT_INIT; huart1.AdvancedInit.TxPinLevelInvert = UART_ADVFEATURE_TXINV_ENABLE; huart1.AdvancedInit.RxPinLevelInvert = UART_ADVFEATURE_RXINV_ENABLE; if (HAL_HalfDuplex_Init(&huart1) != HAL_OK) { Error_Ha
Hello,everybody Nice to meet you,My trouble is "STM32F070RB USB MSC on internal Flash can not format " ..I have try some idea in community but did not help,so I decided to ask for help,Here are my code on usbd_storage_if.c.Thank you so much !#define STORAGE_LUN_NBR 1 #define STORAGE_BLK_NBR 128 #define STORAGE_BLK_SIZ 0x200 /* USER CODE BEGIN PRIVATE_DEFINES */ #define FLASH_START_ADDR 0x08010000 #define FLASH_PAGE_NBR 32 uint8_t cache[STORAGE_BLK_SIZ]; FLASH_EraseInitTypeDef USB_ZONE; /* USER CODE END PRIVATE_DEFINES */ /** * @} */ /** @defgroup USBD_STORAGE_Private_Macros * @brief Private macros. * @{ */ /* USER CODE BEGIN PRIVATE_MACRO */ /* USER CODE END PRIVATE_MACRO */ /** * @} */ /** @defgroup USBD_STORAGE_Private_Variables * @brief Private variables. * @{ */ /* USER CODE BEGIN INQUIRY_DATA_FS */ /** USB Mass storage Standard Inquiry Data. */ const int8_t STORAGE_Inquirydata_FS[] = {/* 36 */ /* LUN
Hello, I would like to know when CubeMX will support lwIP 2.1.0.
..
I have created a simple app using stm32cubemx and cubeide that waits for a GPIO signal to go low, then plays a canned stream of I2S data to the port. The function call to HAL_I2S_Transmit() is causing the system to reset. Specifically the statement: __HAL_I2S_ENABLE(hi2s) causes the i2C output signals to transition into the active state, then the chip resets.I've generated the init code with MX and get no compile errors or warnings. I've attached the project.Thanks,Scott
Hi,I'm using STM32CubeIDE, Version: 1.1.0, Build: 4551_20191014-1140 (UTC) under Linux.Until date I've found two issues at least concerning the NUCLEO-L432KC development board.Having both UART1 and UART2 configured with DMA, the generated initialization is wrong. UART2 is initialized before DMA. My understanding is that without an enabled DMA clock, the DMA registers can't be configured. It is mandatory to have DMA initialized before any other peripheries using and configuring DMA.Although I2C is unused and disabled, still the drivers for I2C are copied into the project and HAL_I2C_MODULE_ENABLED is defined.
My current development environment is as follows.STM32CubeMX v5.4.0, STM32CubeIDE 1.1.0, SW4STM32 1.17.0, Windows 10 1903.STM32CubeIDE Font SettingSTM32CubeMX Encording SettingGarbled C source code Japanese comments after code generationThank you in advance.
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.