Ask questions on STM32CubeMX. Discuss code generation and configuration challenges, among other topics.
Most recent activity
hi i have a problem with sd card, i am trying to write a file.txt using the fats libraryi am using cube mx old version and sdio reader data0, clk, cmd ....here the code: MX_GPIO_Init (); MX_USART2_UART_Init (); MX_SDIO_SD_Init (); MX_FATFS_Init (); / * USER CODE BEGIN 2 * / / * USER CODE END 2 * / UINT testbyte; / * USER CODE BEGIN 2 * / FATFS myFATFS; FIL myFILE; if (f_mount (& myFATFS, SDPath, 1) == FR_OK) { HAL_GPIO_TogglePin (LD2_GPIO_Port, LD2_Pin); char mypath [] = "test1.txt"; char myData [] = "hello world"; if (f_open (& myFILE, mypath, FA_WRITE | FA_CREATE_ALWAYS) == FR_OK) { HAL_GPIO_TogglePin (LD2_GPIO_Port, LD2_Pin); if (fwrite (& myFILE, myData, sizeof (myData), & testbyte) == FR_OK) { HAL_GPIO_TogglePin (LD2_GPIO_Port, LD2_Pin); } f_close (& myFILE); }the problem tha
Stm32f407ve used ADC+DMA used 1KHz sin is not read evenly when reading the reasonExternal 8MHz crystal and UART asynchronous use
HelloI used CubeMX Ver.4.25.0 to run STM32F030R8T6.One day, I decided to update the version of CubeMX, so I updated it to Ver.5.6.0.After that, when using Ver.5.6.0, it takes about 250ms to process the code (HAL_Init () to MX_TIM16_Init ()) automatically generated by CubeMX compared to when using Ver.4.25.0. It turned out to be slow.As I proceeded with the confirmation, I found that the following source code takes time.--------------------- (Drivers / STM32F0xx_HAL_Drivers / Src / stm32f0xx_hal_rcc.c) ------------------ --- while (__ HAL_RCC_GET_FLAG (RCC_FLAG_LSERDY) == RESET) { if ((HAL_GetTick () --tickstart)> RCC_LSE_TIMEOUT_VALUE) { return HAL_TIMEOUT; } } -------------------------------------------------- -------------------------------------------------- ----It turns out that the time it takes to exit this While () is about 250ms slower.As I proceeded with the confirmation, I found that in CubeMX Ver.5.6.0, __HAL_RCC_PWR_C
Hi!We are currently developing firmware on the stm32f429zi Nucleo board. In our development, we configured an Ethernet connection and SPI connection separately. Both works independently. However, once we added the SPI configuration to CubeMX to the ethernet connection, we experienced some issues. With both configurations, the SystemClock configuration failed. The trouble seems to be with the PLL. While debugging we see that the system tries to read the register configuration of the PLL and the values read do not match what should be configured. After seeing this issue, we reverted the changes and rolled back to having only the Ethernet configured and the issue persisted. This was tested on two different boards, which both are now "broken" and unable to run previously working code. The system still works with only SPI configured. The difference we observe between the two configurations is that with only SPI, on the PLL configuration step, the PLL is used as the system clock and not with
I would like to use static allocation, but the template in CubeMx use fix malloc and free.It would be at least good to have a user code block below the memory managment macros, so a own redefine will not be overwritten during a new CubeMx code generation.
I have the Nucleo-F446RE. And when I ran the MX it set USART3_TX to Pin PB10. Looking at table 11 in DS10693 Rev 10 STM32F446xC/E It says USART3_TX can be on PB10, PC10, and PD8.It looks like PD8 is not on the STM32F446 Nucleo-64 board. PB10 is on CN9-7 and CN10-25PC10 is on CN7-1How do I tell the USART3 Mode and Configuration -> GPIO Settings to use PC10 and not PB10?No combination of keystrokes/mouse clicks let me change it that I know of.
Hi All,In a hardware architecture where there are multiple I2C slaves running the same code base, each slave must determine their own address. The code generated by Stm32Cube hard codes the OwnAddress so it is impossible to insert a unique address in its place. There are two undesirable workarounds the programmer can use:Replace the Stm32Cube initialisation MX_I2C1_Init() function with their own (risks missing out of future changes to MX_I2C1_Init()HAL De-Init I2C, insert the new unique address into structure and re-initialise using HAL Init that has the updated address. (can still use cube but Nasty).I propose there is a new HAL function to set OwnAddress that can be called sometime after the MX_I2C1_Init(). The programmer can then set their unique address at run-time.What do you think?CheersDavid
Dear ST; I found bug for generate with SUBG2. I can export file to STM32CubeIDE but it can't be use with other MCU .This photo. I can generate with STM32L010.This photo. I compile source code. I found error in middleware from ST.Thank you,Best regards.
..
A project (STM32H743 with FreeRTOS + TouchGFX) works perfectly on STM32CubeIDE 1.4.2 with MX6.0.1.Trying to migrate it on STM32CubeIDE 1.5.1 with MX6.1.1. stucks during the execution of the first task with the hard fault "Bus,memory managment or usage fault (FORCED)" .We compared the two .ioc files of MX (the one of 6.0.1 with the other of 6.1.1) and we found that NVIC priorities had changed (0 turn to 5 and "uses FREERTOS functions" check boxes turned checked in almost all NVICs). We change the NVIC settings manually in .ioc MX file of 6.1.1 in order to be identical with the ones of 6.0.1 but the problem remains.Are there any suggestions ?
Hi,I´m trying to involve STM32 MCU´s within a rapid prototyping process using Simulink and have some problems regarding the external mode. I used code geneation and external mode with PLC´s and Simulink Desktop Real-Time so far and like the workflow very much.First of all my setup:Matlab/Simulink R2018bCubeMX 5.6 µVision V5.22STM32-MAT/Target 5.6STM32F3Dicovery BoardBasically, the entire toolchain (modelling, build, generate code, compile, flash, run) works fine and observing digital and analog inputs in external mode seems to behave as expected at first glance. But the problems raise when I tried to implement a closed loop control (aggressive PI controller + RC-Lowpass approx. 50ms time constant) running at 1ms sampling rate. Without external mode the control performs nicely, but when I connect Simulink the system output starts oscillating. For testing purposes, I tried to only show one digital on a Simulink-Scope with sufficient heap size and approx. 1MBaud serial communication
Hi,I was hoping that this will be fixed in 5.6.1, but it's still there.In function "DRESULT SD_read" is this part of code:#if defined(ENABLE_SCRATCH_BUFFER) } else { /* Slow path, fetch each sector a part and memcpy to destination buffer */ int i; for (i = 0; i < count; i++) { ret = BSP_SD_ReadBlocks_DMA((uint32_t*)scratch, (uint32_t)sector++, 1); if (ret == MSD_OK ) {The problem is that variable "ret" is not defined and I have to define it manually after each code generation.My settings are FreeRTOS, DMA and defined ENABLE_SCRATCH_BUFFER and ENABLE_SD_DMA_CACHE_MAINTENANCEAlso in addition to this, on line 78 is this code with missing USER CODE END comment./* USER CODE BEGIN enableSDDmaCacheMaintenance */ #define ENABLE_SD_DMA_CACHE_MAINTENANCE 1 /* USER CODE BEGIN enableSDDmaCacheMaintenance */The last thing is that I have defined symbol in project tool settings / Preprocessor "MBEDTLS_CONFIG_FILE="mbedtls_config.h" and this symbol disappear from the project setti
Posted on April 14, 2017 at 22:44Tried to get this working, no success.HID is OK, virtual COM, MSD, everything works fine.Audio class is recognized as composite device only. I've connected USB DP, DM and GND only. VBUS sensing is OFF. 12 MHz external HSE clock implemented, PLL for usb is generating 48 MHz correctly.I'm on the latest cubeF4 version (1.15.0) and IAR IDE. Any ideas, why it's not working? #stm32 #cubemx-f4 #usb-audio #cubemx
I am designing a sensor board from scratch. It will be similar to evaluation board ..\STM32Cube\Repository\STM32Cube_FW_L4_V1.16.0\Projects\B-L475E-IOT01A.I have tried example projects, they work great. Since ST do not have .ioc files for the this board, I do not know what IDE was used and how the codes were generated with correct configuration and correct driver files in the correct directory structure.I tried recreating a project with this board (using CubeMX ) and adding one component only from It created the project with this structureIt builds without any errors. So far so good.Now I want to copy just one function from the example such as while (1) { Temperature_Test(); }This code will look for the associated driver files, API and other supporting configuration codes.Can someone guide me or show me a procedure to identify the files with their locations and copy them to relevant directory and also paste the codes (with any changes if necessary)
Hello, i am trying to add timer interrupt delay function to my DAC code shown bellow.At first i used CUBE MX to define dac and used HAL delay and it worked great as shownin the scope photo bellow.But then i tried to update the code with timer interrupt timer peripehry which is already ON(APB1) its clock is 21Mhz as shown bellow.So i added manually the code shown bellow and tried to replace hal_delay with delay and the scope gave me absulte noise instead of the starecase shape i had before .the full code shown bellow.Where did i go wrong?Reference Manual:https://www.st.com/resource/en/reference_manual/dm00031020-stm32f405-415-stm32f407-417-stm32f427-437-and-stm32f429-439-advanced-arm-based-32-bit-mcus-stmicroelectronics.pdfmanually added code update for timer delay.void delay(unsigned long us) { TIM4->CR1|=TIM_CR1_CEN; myticks=0; while(myticks<us); TIM4->CR1&=~TIM_CR1_CEN; } void TIM4_IRQHandler(void) { myticks++; TIM4->SR&=~TIM_SR_UIF; } int main(void)
Hello,I'm using CubeMX with X-CUBE-BLE2 3.1.0 Software Package to generate the SampleApplicationI am generating for my L073RZ-NucleoBoard.The code generated work, but each time I generate, I have to make modification in the generated file Drivers/BSP/STM32L0xx_nucleo.cSo I would like to make the modification in the original file, but I could not find it:STM32Cube_FW_L0_V1.12.0/Drivers/BSP/STM32L0XXNucleo is not the same fileIn X-CUBE-BLE2\3.1.0\Drivers\BSP there is only a L4XX fileSame in X-CUBE-BLE2\3.1.0\Projects\STM32L476RG-Nucleo\Applications\SampleApp\SrcSo, either I am missing the correct location, or maybe MX is using a template, but where is it to modify it to generate the file with my modificationThank you for your help
So MX assigns the following pins for FSMCNWE -> PC2NOE -> PC5NE1 -> PD7RST -> PD11FMC addr A18 - PD13D0 -> PB14D1 -> PD15D2 -> PC11 (Assigned to micro sd card)D3 -> PC12 (Assigned of micro sd card)D4 -> PA2D5 -> PA3D6 -> PA4D7 -> PA5 Can you help with how I get access to PC11 and PC12?Thank you!
I use Nucleo-H743ZI and want use the Aduino-Header. On Board MB1137 PIN D10 (CS) is conneted to PD14. In CubeMX SPI1 NSS1 is set to PA4. I can not change to PD14, because there is no SPI1_CS in PD14 in CubeMX. How can I fix this?I don't want change the source code after every generate.
Hello,when generating code from CubeMX for STM32H733ZGTx setting PB13 as OCTOSPIM_P1_IO2, the following code is output:GPIO_InitStruct.Alternate = GPIO_AF4_OCTOSPIM;This won't compile as the correct definition is GPIO_AF4_OCTOSPIM_P1CubeMX v. 6.1.1FW_H7 v. 1.8.0Best regards,Alessandro
STM32CubeMX Version: 6.1.0-RC2 Build: 20201112-1557 (UTC)STM32CubeIDE Version: 1.5.0 Build: 8698_20201117_1050 (UTC) CubeMX generated code missing clock enable command before VREFBUF configuration.cube configuration: Generated code:missing "__HAL_RCC_VREF_CLK_ENABLE()" prevents any configuration...
I'm still beginner to programming STM32. I haven't been able to configure SPI for two weeks and don't understand what I am doing wrong. I dug up all the forums looking for an answer, but nothing helped to solve my problem. I checked the MOSI and SCK pin with an oscilloscope and there are no signals on these pins. I tried different ways to configure SPI but still nothing helped. Tried configuring for SPI1, SPI2, SPI3, SPI4, SPI5 etc, same problem. Everything works in HAL, but I want to understand what I am doing wrong using CMSIS. Please give me at least a little hint what I'm setting up wrong. I'm using STM32H743ZI debug board. I really hope for your help, thank you.#include "main.h" #define cs_set() GPIOC->BSRR |= GPIO_BSRR_BR11; #define cs_reset() GPIOC->BSRR |= GPIO_BSRR_BS11; void SPIinit (void); void Settings7219 (void); void SPITransmit (uint8_t adress, uint8_t data); int main (void) { SPIinit(); Settings7219(); GPIOB->BSRR |= GPIO_BSRR_BS0
I have configured the board as mentioned below and written code in STM32CUBEIDE 1.4. PC IP ADRRESS : 192.168.0.14stm board ip : 192.168.0.10subnet mask : 255.255.255.0Default Gateway : 192.168.0.1and used a direct cross ethernet cable. if anyone knows pls help me.
STM32Cube MX Version 6.1.1, STM32Cube MCU Package for STM32H7 Series V1.8.0eth.c is generated with the following code. It sets the MAC address assuming it is an array of bytes./* ETH init function */ void MX_ETH_Init(void) { heth.Instance = ETH; heth.Init.MACAddr[0] = 0x00; heth.Init.MACAddr[1] = 0x80; heth.Init.MACAddr[2] = 0xE1; heth.Init.MACAddr[3] = 0x00; heth.Init.MACAddr[4] = 0x00; heth.Init.MACAddr[5] = 0x00; heth.Init.MediaInterface = HAL_ETH_RMII_MODE; heth.Init.TxDesc = DMATxDscrTab; heth.Init.RxDesc = DMARxDscrTab; heth.Init.RxBuffLen = 1524; /* USER CODE BEGIN MACADDRESS */ /* USER CODE END MACADDRESS */However, ETH_InitTypeDef defines MACAddr as a pointer (to an array of six bytes)/** * @brief ETH Init Structure definition */ typedef struct { uint8_t *MACAddr; /*!< MAC Address of used Hardware: must be pointer on an array of 6 bytes */ ETH_MediaInterfaceTypeDef MediaInterface; /*!< Selects the MII interface or the RMII int
According to this pull request, FatFS with DMA doesn't work on H7/F7 if cache is enabled.For this, two members in structs (in FatFS) needs to be aligned (even, when I have _MAX_SS as number dividable by 32) to FatFS work (check PR). But, the CubeMX everytime after IOC change replaces this ff.h .Is it possible to not replace the ff.h? Or maybe best will be to solve this internally in CubeMX, since without this mdoification, FatFS with DMA just don't work.Thaks
The old weakly linked callbacks are documented as legacy in the HAL source code. Yet if I want to register callback functions, the corresponding preprocessor define is overwritten by CubeMX. Is there a way to set this flag permanently (and not in the build settings, as I would like my IDE to not complain)? Setting a User Defined Constant in CubeMX does not suffice.
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.