cancel
Showing results for 
Search instead for 
Did you mean: 

Working with MCO1 pin of H7 series...

HTajb.1
Associate III

Dear experts,

I am using STM32H750 vbt6 in my project .

Recently I decided to use MCO1 to produce clocks for other devices attached to this chip .

Also, I am using STM32cube IDE for working .

It seems that setting the right parameters for MCO1 to work properly, is an easy task 

(by using CubeMX).

(The input of source multiplexer of MCO1 is: HSE or PLL1Q and the output frequency of this MCO1 pin will be between 28MHz to 35 MHz.)

Here are my questions:

1-Are there any HW or SW recommendations for me to make this MCO pin work properly? 

2-Does this pin produce "square wave form clock pulses"?

Your consideration is highly appreciated.

Regards,

HT.

1 ACCEPTED SOLUTION

Accepted Solutions
Peter BENSCH
ST Employee
  1. Yes of course, since this is a normal GPIO. You will find the detailled description in the reference manual and the parameters in the datasheet. Due to the high frequency I would not use a track with a length bigger than a few centimeters. RG174 is a 50 ohm coaxial cable that requires a driver to match this impedance.
  2. Yes, of course you can switch the pin at run-time. Please check the source code created by STM32CubeMX and find the function MX_GPIO_Init, which also contains the initialization of the GPIO pin, here PA8. You can use a similar block in your own program, e.g. by changing the GPIO functionality from MCO1:
/*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_VERY_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF0_MCO;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);

to e.g. analog:

/*Configure GPIO pin : PA8 */
GPIO_InitStruct.Pin = GPIO_PIN_8;
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);

Good luck!

/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

View solution in original post

4 REPLIES 4
Peter BENSCH
ST Employee

You have likely already enabled MCO1 in the RCC block of STM32CubeMX, which makes the GPIO act as MCO1. This GPIO is per default set to Alternate Function Push Pull, but also to Max Output Speed = Low.

To change this you should open the block GPIO, select that GPIO (PA8 for the STM32H750VB) and set the Max Output Speed = High or Very High.

And yes, this pin produces a "square wave" signal.

When your question is answered, please close this topic by choosing Select as Best.

Good luck!

/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Hi Peter,

Thank you so much for reply.

I already did what you suggested me .

1-Is there any HW consideration (constraint) for using this pin?(using capacitors, resistors, or considering length of tracks for this pin and so on).

(Right now, I am testing on an evaluation board with RG174 cable for this pin and I haven't designed the proper PCB for this pin and my project yet.)

2-Can we turn on/off the output clock of this pin by SW somehow in the run-time ?

(If not, by using and AND gate?)

Your consideration is highly appreciated.

Regards,

HT.

Peter BENSCH
ST Employee
  1. Yes of course, since this is a normal GPIO. You will find the detailled description in the reference manual and the parameters in the datasheet. Due to the high frequency I would not use a track with a length bigger than a few centimeters. RG174 is a 50 ohm coaxial cable that requires a driver to match this impedance.
  2. Yes, of course you can switch the pin at run-time. Please check the source code created by STM32CubeMX and find the function MX_GPIO_Init, which also contains the initialization of the GPIO pin, here PA8. You can use a similar block in your own program, e.g. by changing the GPIO functionality from MCO1:
/*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_VERY_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF0_MCO;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);

to e.g. analog:

/*Configure GPIO pin : PA8 */
GPIO_InitStruct.Pin = GPIO_PIN_8;
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);

Good luck!

/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Hi Peter,

Thank you so much for your answers. If I face any problem, I will ask it asap .

Regards,

HT.