cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeMX clock config bugs

Steve H
Associate III
Posted on April 08, 2014 at 17:20

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 #rtc
6 REPLIES 6
Nawres GHARBI
ST Employee
Posted on April 08, 2014 at 19:29

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 view

0690X00000605eGQAQ.png

1.2- RTC Clock source MUX is available for selection

0690X00000605eKQAQ.png

2- 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).

0690X00000605eLQAQ.png

Please let me know if it works for you.

Best Regards

Nawres.

Steve H
Associate III
Posted on April 08, 2014 at 20:24

Thanks, Nawres. I was able to get the RTC configuration working, and I ultimately found the datasheet note on PC13-15.

jarno
Associate III
Posted on June 07, 2014 at 09:20

I'm having an issue with RTC on STM32F407 with HSE (50MHz RCC bypass mode) and LSE (768 kHz crystal / ceramic resonator mode). When running on target device app hangs at very beginning in generated function SystemClock_Config()

Attached is my *.ioc file to look and perhaps generate a code from. I think i've all configured as should: LSE is connected to PC14 & PC15 but do i need interrupt handler or initialization that i missed? I would appreciate if anybody could help me. Below is CubeMX generated code to look at. Thanks.

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=false
jarno
Associate III
Posted on June 12, 2014 at 22:59

solved my problem (above) by adding

#define configUSE_TIME_SLICING 0

into FreeRTOSConfig.h without it app ends up into

HardFault_Handler

from

xTaskIncrementTick

. 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.

design23
Associate II
Posted on June 20, 2014 at 03:34

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=false
stm32cube-t
Senior III
Posted on July 01, 2014 at 10:10

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.