cancel
Showing results for 
Search instead for 
Did you mean: 

STM32G0B1RE output clock

undacmic
Associate

Hello everyone and thank you for taking the time to read my post.

 

The problem I'm encountering is regarding the configuration of MCO.

I configured MCOSEL and MCOPRE to use PLLRCLK with a 1 prescaler value. The PLLR clock is configured with a frequency of 64 MHz.

I also activated GPIOAEN in RCC registers and configured PA8 for alternate function 0, push&pull, no push, no pull, low speed and i dont get the clock at all. If i connect an oscilloscope to a pin direclty touching SB17 on the board, i can see the rectangular signal and its generated well, but when I try using PA8 it doesn't work. I have connected a GND referencec to the oscilloscope as well.

For reference, I will leave here the snippet of code:

 

static void MX_GPIO_Init(void)
{
  GPIO_InitTypeDef GPIO_InitStruct = {0};
/* USER CODE BEGIN MX_GPIO_Init_1 */
/* USER CODE END MX_GPIO_Init_1 */

  /* GPIO Ports Clock Enable */
  __HAL_RCC_GPIOA_CLK_ENABLE();

  /*Configure GPIO pin : PA8 */
  GPIO_InitStruct.Pin = GPIO_PIN_8;
  GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
  GPIO_InitStruct.Pull = GPIO_NOPULL;
  GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
  GPIO_InitStruct.Alternate = GPIO_AF0_MCO;
  HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);

/* USER CODE BEGIN MX_GPIO_Init_2 */
/* USER CODE END MX_GPIO_Init_2 */
}

 

2 REPLIES 2

@undacmic wrote:

low speed


Try high?

Mike_ST
ST Employee

Hello,

- SB17 is connected the MCO coming from the ST-Link V2, this 8MHz clock can be used as input clock for the STM32G0 when SB17 is closed.
it has almost nothing to do with MCO of the STM32G0.

- If you're using the HAL library, you can call the
HAL_RCC_MCOConfig(uint32_t RCC_MCOx, uint32_t RCC_MCOSource, uint32_t RCC_MCODiv) function. In theory, it configures the registers automatically.
Example: HAL_RCC_MCOConfig(RCC_MCO_PA8, RCC_MCO1SOURCE_SYSCLK, RCC_MCODIV_1);

- Check you are probing the right pins:
PA8 is on CN9/PIN8 or CN10/PIN23