2015-03-26 01:56 AM
I use STM32F4
I set MCO1 to PLL Clock and set output prescaler to 5 and I have 6MHz on my MCO1. There is no problem in it, But when I enable LSE with HSE together, I have no signal on MCO1 pin. Code:RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE|RCC_OSCILLATORTYPE_LSE;
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
RCC_OscInitStruct.LSEState = RCC_LSE_ON;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
RCC_OscInitStruct.PLL.PLLM = 25;
RCC_OscInitStruct.PLL.PLLN = 336;
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
RCC_OscInitStruct.PLL.PLLQ = 7;
HAL_RCC_OscConfig(&RCC_OscInitStruct);
HAL_RCC_MCOConfig(RCC_MCO1,RCC_MCO1SOURCE_PLLCLK,RCC_MCODIV_5);
What is the problem?
Thanks...
2015-03-26 05:38 AM
Does some other unshown code configure the other GPIOs and clocks to allow this to work?
2015-03-26 06:59 AM
Yes. GPIO configured with this code :
__GPIOA_CLK_ENABLE();
GPIO_InitStruct.Pin = GPIO_PIN_8;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_PULLDOWN;
GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF0_MCO;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
When I change this line:
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE|RCC_OSCILLATORTYPE_LSE;
to
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
MCO1 clock is good and with LSE, I have no clock on MCO1 pin.
2015-03-26 02:35 PM
Try to blink a LED in the main loop, first with the setting where you do have the output clock, then with the other setting.
Does it blink in both cases? JW2015-03-27 05:33 AM
Yes.
I have LED blinking every 500mS in both cases(cmsis_os delay) and I have 1KHz signal of TIM3 too.-----------------In my new tests I have MCO1 clock in both cases!(No board changes and no software changes!)I am continuing my work and if this state happened again I will write state to this thread.Thanks.