2014-04-08 08:20 AM
I have two probably-related bugs relating to clock configuration in the pinout and clock configuration wizards of the STM32CubeF4 tool; I have been unable to find any references to these bugs, so I don't know if there's a tool limitation I haven't found in the documentation yet...
On a project using the STM32F405RGTx with an external 32.768 KHz crystal on the OSC32 pins, the clock config wizard does not allow me to configure the RTC clock mux to use the LSE, although I have appropriately configured the pins as OSC32 and have enabled the LSE in the RCC section of the pinout wizard. The RTC clock mux remains grayed out and cannot be changed from its default setting. On a project using the STM32F205RCTx (testing the ability of STM32CubeMX to replicate an existing product design for the F2 series), the pinout wizard does not allow me to configure OSC32_IN and OSC32_OUT as GPIO output pins, although the LSE is disabled in the RCC. Since I'm using this exact GPIO configuration in deployed code, I know it's possible to do this, so the GUI tool is wrong. #stm32f4 #stmcubemx-hsi16-calibration #rcc #stm32cubeff4-rtc #rtc2014-04-08 10:29 AM
Hello Stephen
To have the RTC source MUX enabled for selection, you have to enable the RTC first.1- RTC issue:1.1- Enable LSE and RTC in the Pinout view1.2- RTC Clock source MUX is available for selection2- GPIO issue Due to the fact that the switch only sinks a limited amount of current (3 mA), the use of GPIOs PC13 to PC15 and PI8 are restricted: only one I/O at a time can be used as an output, the speed has to be limited to 2 MHz with a maximum load of 30 pF and these I/Os must not be used as a current source (e.g. to drive an LED).Please let me know if it works for you.Best RegardsNawres.2014-04-08 11:24 AM
Thanks, Nawres. I was able to get the RTC configuration working, and I ultimately found the datasheet note on PC13-15.
2014-06-07 12:20 AM
static void SystemClock_Config(void)
{ RCC_ClkInitTypeDef RCC_ClkInitStruct; RCC_PeriphCLKInitTypeDef PeriphClkInitStruct; RCC_OscInitTypeDef RCC_OscInitStruct; __PWR_CLK_ENABLE(); __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1); RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE|RCC_OSCILLATORTYPE_LSE; RCC_OscInitStruct.HSEState = RCC_HSE_BYPASS; RCC_OscInitStruct.LSEState = RCC_LSE_ON; RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE; RCC_OscInitStruct.PLL.PLLM = 50; RCC_OscInitStruct.PLL.PLLN = 336; RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2; RCC_OscInitStruct.PLL.PLLQ = 4; HAL_RCC_OscConfig(&RCC_OscInitStruct); <-- app hangs up in here .... } HAL_StatusTypeDef HAL_RCC_OscConfig(RCC_OscInitTypeDef *RCC_OscInitStruct) { ... /* Wait till HSE is bypassed or disabled */ while(__HAL_RCC_GET_FLAG(RCC_FLAG_HSERDY) != RESET) <-- final execution before ending up HardFault_Handler(). ... } ________________ Attachments : Neon_STM32F4.ioc : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HzIH&d=%2Fa%2F0X0000000bLq%2FOFYSGWuy2a_X_8m9xaqTVbFAGi1e5Zg2..y4f.FPaAw&asPdf=false2014-06-12 01:59 PM
#define configUSE_TIME_SLICING 0
into FreeRTOSConfig.h without it app ends up intoHardFault_Handler
fromxTaskIncrementTick
. RTC works like charm now. Would be nice if future CubeMX release had an option to enable RTC with calendar only, now one needs to clean up generated code.2014-06-19 06:34 PM
ST Support:
I am designing around STM32L052K8T6 device, and I am trying to figure out how to implement calibration for the internal 16 MHz oscillator (HSI16) using an external 768 KHz oscillator (LSE) as discussed on page 160 of the Reference Manual (RM0376 - Attached). I see the Figure 19 diagram is not the same as the Cube's Clock Configuration Diagram, so I cannot figure out which boxes to check to get the LSE to capture TIM22 (I cannot use TIM21 because TIM21 is blocked when both USARTs are used). So, if anybody (like ST Support) can let me know which boxes to check in CubeMX for my L0 device to make page 602 work, that would be most appreciated. Thanks, Garry Anderson. ________________ Attachments : Page_160_from_STM0_Plus_Refence_Manual_DM00108281.pdf : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HzBG&d=%2Fa%2F0X0000000bLs%2FJ9N1gS.FArK8paStD9Q2qzXIpIyNE6Qm.loCIj2KQ70&asPdf=false2014-07-01 01:10 AM
Hello Garry,
This remapping functionality (to select which of the I/O or the internal clock is to trigger the input capture) is not yet supported in MX4.3 and is planned for 4.4. As a workaround you can add the following code in the main user section (hal function from stm32l0xx_hal_tim_ex.c driver file):
/* USER CODE BEGIN 2 */
HAL_TIMEx_RemapConfig(&htim21, TIM21_TI1_LSE);
/* USER CODE END 2 */
Note: MX 4.3 will still reserve a GPIO pin for the input capture mode although in this case you don't need it.
ST Support:
I am designing around STM32L052K8T6 device, and I am trying to figure out how to implement calibration for the internal 16 MHz oscillator (HSI16) using an external 32.768 KHz oscillator (LSE) as discussed on page 160 of the Reference Manual (RM0376 - Attached). I see the Figure 19 diagram is not the same as the Cube's Clock Configuration Diagram, so I cannot figure out which boxes to check to get the LSE to capture TIM22 (I cannot use TIM21 because TIM21 is blocked when both USARTs are used). So, if anybody (like ST Support) can let me know which boxes to check in CubeMX for my L0 device to make page 602 work, that would be most appreciated. Thanks, Garry Anderson.