Ask questions on STM32CubeMX. Discuss code generation and configuration challenges, among other topics.
Most recent activity
Posted on September 09, 2015 at 14:17When using CubeMX to generate project (e.g. for SW4STM32), the code for SD Card looks like this:void MX_SDIO_SD_Init(void){ hsd.Instance = SDIO; hsd.Init.ClockEdge = SDIO_CLOCK_EDGE_RISING; hsd.Init.ClockBypass = SDIO_CLOCK_BYPASS_DISABLE; hsd.Init.ClockPowerSave = SDIO_CLOCK_POWER_SAVE_DISABLE; hsd.Init.BusWide = SDIO_BUS_WIDE_1B; hsd.Init.HardwareFlowControl = SDIO_HARDWARE_FLOW_CONTROL_DISABLE; hsd.Init.ClockDiv = 4; HAL_SD_Init(&hsd, &SDCardInfo); HAL_SD_WideBusOperation_Config(&hsd, SDIO_BUS_WIDE_4B);}The user has no possibility to add own error detection code, as there is no use section. My suggestion is to return the status type like this:HAL_SD_ErrorTypedef MX_SDIO_SD_Init(void){ HAL_SD_ErrorTypedef err = SD_OK; hsd.Instance = SDIO; hsd.Init.ClockEdge = SDIO_CLOCK_EDGE_RISING; hsd.Init.ClockBypass = SDIO_CLOCK_BYPASS_DISABLE; hsd.Init.ClockPowerSa
Posted on August 24, 2015 at 22:08When Discontinuous Conversion Mode is disabled CubeMX leaves the NbrOfDiscConversion field in ADC_InitTypeDef uninitialized which can cause assert_param(IS_ADC_REGULAR_NB_CONV(hadc->Init.NbrOfConversion)) in HAL_ADC_Init to trigger resulting in an assert failure. CubeMx Version 4.9.0 STM32Cube FW_L1 V1.3.0 #bug #stm32cubemx #stm32l #assert
Posted on March 04, 2015 at 11:41HiWith CubeMx, I can associate the Label for each pin of the MCU or only some of them. Exporting the project to TrueSTUDIO, I have noticed that these customizations remain only in the .ioc file and are not included in the source code, even after the import of the project ( in TrueStudio) . Is this correct? Best Regard D. #st32cubemx
Posted on October 07, 2015 at 08:19have you ever noticed, that pinout and clock config tabs aren't matching each other?especially if you select Nucleo or Discovery Boards, on pinout Tab you can see pin's selected and marked properly, but Clock configuration tab doesn't reflect proper crystals ...for STM32F4 Discovery there is an issue with clocking ratios so when you move to clock config tab mostly it is red overclocked... for STM32F466RET Nucleo board, it doesn't reflect 32 kHz crystal connected to the MCU PC14,PC15... #stm32 #cubemx
Posted on October 07, 2015 at 13:16 I am a beginner to STM So far, I have done a lot of work on NETMF and AVR. Starting out with STM Environment: I have a super tiny board for STM32F103C8 (like this one http://artofcircuits.com/product/minimum-system-development-board-for-arm-microcontroller-stm32f103c8t6)I have a HTU21D sensor board (like this one https://www.sparkfun.com/products/12064)I also have a BMP180 (which also is not working and is giving similar issues, so skipping)The SDA/SCL have been pulled up using 4.7K resistors. S/W Setup: I used STM32CubeMX tool to create a project. The tool usesSTM32Cube_FW_F1_V1.2.0 libraryI am using EmBlocks IDE to write/compile the codeI have used the STM32CubeMX with EmBlocks successfully for other non-I2C projects on the same board (e.g. USB HID, GPIO, UART) The code in main.c is given below: /* Includes ------------------------------------------------------------------*/ #include ''stm32f1xx_hal.h'' /* USER CODE B
Posted on October 03, 2015 at 05:00I intend to use SDIO with STM32F103C8 MCU and am trying to generate initialization code from CubeMX.It turns out, SDIO is NOT available for STM32F103C8 MCU in CubeMX. Is there a good reason why this cannot be done with CubeMX? Thanks,Yo #sdio #stm32f1 #cubemx
Posted on August 13, 2014 at 02:14I do not know enough about the internal workings of the processor to be sure, but I believe there is a bug in the HAL DMA drivers for the F4xx series. Specifically, it seems the De-init method puts the DMA peripheral in a state that the Init method does not properly reset. This was evidenced in a problem I had posted [DEAD LINK /public/STe2ecommunities/mcu/Lists/STM32Java/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/STM32Java/SPI&currentviews=20]here. Essentially, if I made a call to de-init prior to initializing, the DMA transfer never incremented the destination address. Removing the de-init call results in working behavior. I was able to confirm by changing the length of the transfer that the peripheral being served by the DMA transfer was in fact receiving the correct data, but that each byte transferred to memory by the DMA was going to the same location rather than auto-incrementing. #stm32 #stcubemx #hal #stm32f4
Posted on October 01, 2015 at 13:22Hello, I'm new here and i've the problem that i don't know how to get the generated code from simulink and CubeMX to my Microcontroller.My Setup:I use mikroC Pro and an EasyMX Prov7 board with STM32V107VCT6Now I got the order to setup Simulink, CubeMX to get the code to my microchip.First steps were fine, i generate the code in my simulink model and after that i saw that i'm able to generate EWARM, MDK-ARM or TrueStudio but i need microC or just hex files to send it to the microcontroller. Is there any workaroung, because Keil, IAR, Atollic are to expensive .I hope you can help me #simulink-code-generate #stm32cubemx
Posted on July 03, 2014 at 12:01Hello,I'm using STM32CubeMX to generate a project for STM32F207 that uses USB Host. The project compiles without problems. I have a custom USB device that uses CDC to send and receive serial data. When the device is attached to the USB host, it is detected correctly and the CDC class is being started. The functions for writing to and reading from the USB device are USBH_CDC_Transmit and USBH_CDC_Receive. These functions are non-blocking, and there are 2 callback functions that are called when the data have been transferred - USBH_CDC_TransmitCallback and USBH_CDC_ReceiveCallback. I have made some tests reading and writing the device and discovered, that I have to wait the last operation to finish before calling again the functions for reading or writing. The problem is that if I call USBH_CDC_Receive and the device is not sending anything at the moment, I cannot use the USB device anymore, I can call USBH_CDC_Tran
Posted on April 15, 2015 at 22:27 If you use HAL_CAN_Receive_IT for receive and send messages at same time you can get race condition. Typical callback looks like: void HAL_CAN_RxCpltCallback(CAN_HandleTypeDef* CanHandle) { if ((CanHandle->pRxMsg->StdId == 0x321) && (CanHandle->pRxMsg->IDE == CAN_ID_STD) && (CanHandle->pRxMsg->DLC == 2)) { if (CanHandle->pRxMsg->Data[0]) { LED_GREEN_ON(); } else { LED_GREEN_OFF(); } } /* Receive */ if (HAL_CAN_Receive_IT(CanHandle, CAN_FIFO0) != HAL_OK) { /* Reception Error */ Error_Handler(1, 20); } } If interrupt occurs when HAL_CAN_Transmit (or other) is called, HAL_CAN_Receive_IT will return HAL_BUSY because can handle is locked. I can reproduce this error in 100% if loopback mode is used. I attach sample code to reproduce this. my_main() must be called inside generated main.c #cubemx #bug #bxcan #stm32f2
Posted on July 23, 2015 at 09:41Due to security reasons I recently updated to the latest Java 8 Update 51 (Releasedate 14.07.2015) and deleted the old Java version. But now CubeMX (4.9.0) is not starting anymore asking for an old Java 1.7.0_45 I kindly ask you to make the CubeMX software compatible to the latest Java. And I also ask other users to support this request. #java-jre #stm32cubemx #stmcube
Posted on September 12, 2015 at 00:46Hi All,I'm trying to build an application which can receive commands through UART, and can also send messages.I have created 2 threads using FreeRTOS: one for a continuous RX, and one for a repetitive TX.The RX task seems to run fine, it captures all the raw data coming in through the UART. However in the other thread when I'm trying to send out a few bytes, I always got a HAL_BUSY flag.I'm using HAL drivers, and project is generated with MXCube.I'm not using currently a DMA or even an IT callback, I'm just trying to get things working first with the most simple blocking RX/TX.I'm wondering if I should synchronise the reader and writer flags - however if the UART peripheral is meant to be full duplex then parallel TX and RX should work.The whole communication is going to be used to manage an ESP8266 through UART with AT command set. Also looking at the SPWF01.Please advise, thanks,Bal #stm32 #hal #uart #cubemx
Posted on September 08, 2015 at 12:25 Hello, I've used the STD peripheral libraries before and successfully generating interrupts from UART //snippet 1 void USART1_IRQHandler(void){ char chee; if(USART_GetITStatus(USART1, USART_IT_RXNE) != RESET){ chee = USART_ReceiveData(USART1); BTrxString[BTrxPointer++] = chee; //used for something else USART_ClearITPendingBit(USART1, USART_IT_RXNE); } if(USART_GetITStatus(USART1, USART_IT_IDLE) != RESET){ strncpy(EXT_BTrxString, BTrxString, 200); //used for something else USART_ClearITPendingBit(USART1, USART_IT_IDLE); BTrxPointer = 0; //used for something else memset(&BTrxString[0], 0, sizeof(BTrxString)); //used for something else chee = USART_ReceiveData(USART1); FLAG_BT_TIMEOUT = 1; //used for something else } } I'm having a hard time understanding how to use HAL and the cubeMX.. I am able to send strings on UART HAL_UART_Transmit_IT(&huart2, (''lol\n''), strlen(''lol\n'')); no problems at all. the problem is I
Posted on September 02, 2015 at 04:35Hello,I just start using STM32CubeMX three days ago and the product is looking good! I'm playing with a Nucleo Board STM32F103RB and one thing that I noticed is that the HAL Library for F1 version downloaded by CubeMX is 1.1.0, where the STM site has the 1.2.0. Question: I tried to manually install 1.2.0 but it still downloads the 1.1.0. Is there any place on the ST site where I can download the old releases from HAL Libraries? I found only here: http://sourceforge.net/projects/micro-os-plus/files/Vendor%20Archives/STM32/Suggestion for ST: IMO the examples from the HAL Libraries should use the STMCubeMX generated code as boiler plate instead of something else. The code looks similar but sometimes things are defined in different places.Another thing: might be good to add the release date to the downloads for the users can check if it has been recently released or not.ps.: Another thing is that the HAL 1.2.0 downloaded from the Website
Posted on August 26, 2015 at 14:48are they intentionally undefined for STM32F0xx?CAN_FLAG_FMP0 ''FIFO 0 Message Pending Flag'' CAN_FLAG_FMP1 ''FIFO 1 Message Pending Flag'' are not defined #stm32cubemx
Posted on July 24, 2015 at 14:41Hello, I am developing own RTOS for STM32. I see that CubeMX is a very useful tool for generating SW configuration. Is there any possibilty to add my OS to CubeMX configuration? I saw that configuration of IP packages is in xml files, but also I saw some jar files related to those. Thank You, Slawek #cubemx #plugin
Posted on August 04, 2015 at 18:20 The generated config code ''MX_TIM3_Init()'' in ''src/tim.c'' for TIM3_PWM_Output on channel 1 and 2 fails in ''HAL_TIM_PWM_ConfigChannel()'' at assert_param(IS_TIM_OCN_POLARITY(sConfig->OCNPolarity)); assert_param(IS_TIM_OCNIDLE_STATE(sConfig->OCNIdleState)); assert_param(IS_TIM_OCIDLE_STATE(sConfig->OCIdleState)); OCNPolarity, OCNIdleState and OCIdleState are not defined. This is the generated code: void MX_TIM3_Init(void) { TIM_ClockConfigTypeDef sClockSourceConfig; TIM_MasterConfigTypeDef sMasterConfig; TIM_OC_InitTypeDef sConfigOC; htim3.Instance = TIM3; htim3.Init.Prescaler = 0; htim3.Init.CounterMode = TIM_COUNTERMODE_UP; htim3.Init.Period = 0; htim3.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1; HAL_TIM_Base_Init(&htim3); sClockSourceConfig.ClockSource = TIM_CLOCKSOURCE_INTERNAL; HAL_TIM_ConfigClockSource(&htim3, &sClockSourceConfig); HAL_TIM_PWM_Init(&htim3); sMasterConfig.MasterOutputTrigger = TIM_TRGO_
Posted on August 26, 2015 at 10:08 Hello, I have 2 STM32F042C6 board. My transmitter board's code : static CanTxMsgTypeDef TxMessage; // Static variable declaration static CanRxMsgTypeDef RxMessage; /* CAN init function */ void MX_CAN_Init(void) { hcan.Instance = CAN; hcan.pTxMsg = &TxMessage; // Pointer initialization hcan.pRxMsg = &RxMessage; hcan.Init.Prescaler = 16; hcan.Init.Mode = CAN_MODE_NORMAL; hcan.Init.SJW = CAN_SJW_1TQ; hcan.Init.BS1 = CAN_BS1_14TQ; hcan.Init.BS2 = CAN_BS2_6TQ; hcan.Init.TTCM = DISABLE; hcan.Init.ABOM = DISABLE; hcan.Init.AWUM = DISABLE; hcan.Init.NART = DISABLE; hcan.Init.RFLM = DISABLE; hcan.Init.TXFP = DISABLE; HAL_CAN_Init(&hcan); } void SendCan(void) { while(!hcan.State == HAL_CAN_STATE_READY); TxMessage.IDE = CAN_ID_STD; TxMessage.StdId = 0x001; TxMessage.ExtId = 0x001; TxMessage.RTR = CAN_RTR_DATA; //For Remote Request CAN_RTR_REMOTE TxMessage.DLC = 8; TxMessage.Data[0] = 0x01; TxMessage.Data[1] = 0x02; TxMessage.Data[2]
Posted on August 19, 2015 at 21:12It is becoming annoying that since ST's inception of a Cortex implementation there have been Standard Peripheral libraries that simply are not standards to rely on.I thought that switching to the HAL libraries would eliminate unnecessary changes but, yet again I am proven wrong.This time it is macro names that have changed between libraries.1.2 had....... 1.3 now has.......... __APB1_FORCE_RESET(); __HAL_RCC_APB1_FORCE_RESET(); __GPIOx_CLK_ENABLE(); __HAL_RCC_GPIOx_CLK_ENABLE();.......etc. et ceteraAfter switching from the old 1.2.0 HAL to the new 1.3.0 hoping the update would fix the multitude of UART issues; I find that I now have to go back and change anything that used a macro in my code to add ''__HAL_RCC_'' in front of it. Why? Why were the macro names changed?Who at ST ne
Posted on August 12, 2015 at 17:07The STM32CubeMX software generates a USB stack with a call to free() in usbd_conf.c. If you disconnect USB by calling usbd_stop() the software crashes here as there is no free from stdlib or there is no correctly defined memory section to use. As the function is documentated as 'dummy' the call of free is useless anyway. Costs us hours to find this. Please fix it in next release! #stmcube-stmcubemx-cube-stm32cube
Posted on July 29, 2015 at 14:50Why is it not possible to choose Custom HID class for STM32F2 in CubeMX?The selection is grayed.Regards,Paul #cubemx #hid #stm32f2
Posted on July 30, 2014 at 10:30Hi, In the last few days I have spend few hours trying to setup FreeRTOS + LwIP TCP/IP stack. Now it is finally working (UDP echo, ICMP ping), but I believe there might be some bugs in STM32CubeMX. - Interrupt priority for ETH_IRQn is left at default priority which is too low. This causes FreeRTOS hanging at assert. (see http://www.freertos.org/RTOS-Cortex-M3-M4.html). - Some (important) settings for STM32CubeMX for LwIP don't get transferred into lwiopts.h. This means that default values (which are often 0) are used. I did manually set: &sharpdefine TCPIP_THREAD_STACKSIZE 1000 &sharpdefine TCPIP_MBOX_SIZE 5 &sharpdefine DEFAULT_UDP_RECVMBOX_SIZE 2000 &sharpdefine DEFAULT_TCP_RECVMBOX_SIZE 2000 &sharpdefine D
Posted on July 06, 2015 at 18:20Hi to all, i'm a newbie of programming embedded, i have a Stm nucleo L152RE and i a sd card shiled v 4.1 of seeed studio this is thehttp://www.seeedstudio.com/wiki/SD_Card_shield_V4.0 of shiled. Now i want use cubemx for use this shield, i use this setting: PERIPHERALS MODES FUNCTIONS PINS RCC Crystal/Ceramic Resonator RCC_OSC_IN PH0-OSC_IN RCC Crystal/Ceramic Resonator RCC_OSC_OUT PH1-OSC_OUT SPI1 Full-Duplex Master SPI1_MISO PA6 SPI1 Full-Duplex Master SPI1_MOSI PA7 SPI1 Full-Duplex Master SPI1_SCK PA5 SYS Trace-Asynchronous_SW SYS_JTMS-SWDIO PA13 SYS Trace-Async
Posted on July 16, 2015 at 12:41Who can tell me, how to change processor already selected? If I've found that the selected became too small for my firmware? I would like to change it for the bigger one with compartible pins. #stm32cubemx
Posted on July 08, 2015 at 11:31I would like to add a menu system and other things to the application. I can't figure out where is the library and where to start using CubeMX? Help would be appreciated! #cubemx #!stm32f4-disco
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.