Hal_Rcc_Mcoconfig; Figure 68. Mco Multiplexer In Stm32Cubemx Clock Configuration Pane - STMicroelectronics STM32 Application Note

Microcontroller debug toolbox
Hide thumbs Also See for STM32:
Table of Contents

Advertisement

AN4989

Figure 68. MCO Multiplexer in STM32CubeMX Clock Configuration Pane

The divider allows to output a signal frequency compatible with output capabilities.
8.2.2

HAL_RCC_MCOConfig

Independantly of the fact that STM32CubeMX is used or not, MCO configuration is done
using the hal_rcc or LL function:
stm32XXxx_hal_rcc.c/ stm32XXxx_hal_rcc.h
void HAL_RCC_MCOConfig( uint32_t RCC_MCOx, uint32_t RCC_MCOSource, uint32_t
RCC_MCODiv)
Examples based on LL drivers are available in STM32Cube libraries (refer to
STM32CubeProjectList.html) which configure the GPIO and the related registers depending
on source and divider.
They also configure the selected GPIO accordingly:
/* Configure the MCO1 pin in alternate function mode */
GPIO_InitStruct.Pin = MCO1_PIN;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Alternate = GPIO_AF0_MCO;
HAL_GPIO_Init(MCO1_GPIO_PORT, &GPIO_InitStruct);
Caution:
The setting of GPIO speed (OSPEED) must be carefully set.
OSPEED setting and maximum output frequency value are described in the datasheet of
the related MCU in chapter I/O port characteristics.
Max Frequency values are given for a typical load of 50 pF or 10 pF.
If the measure is performed with an oscilloscope, the load of the probe circuitry must be
taken into account.
Debug through hardware exploration
AN4989 Rev 3
89/118
117

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the STM32 and is the answer not in the manual?

Table of Contents

Save PDF