2024-09-17 04:38 PM
I'm using CubeIDE and I have PG10 configured as MCO output and I see nothing. Usually when I see this, there is a HAL enable command I missed, but I don't think there is in this case.
I've tried multiple clock sources and the pin stays at voltage high. I've checked on all the registers I know:
GPIOG
MODER -> MODER10 = 0x2 (alternate function)
AFRL = 0x0
AFRH = 0x0
I suspect that having no alternate function set in AFR\L registers is what is not correctly set, but I don't see the mapping table mentioned in the reference manual: "Refer to the “Alternate function mapping” table in the device datasheet for the detailed mapping of the alternate function I/O pins."
What should these registers be set to for MCO and where is the mapping table?
Solved! Go to Solution.
2024-09-17 09:09 PM - edited 2024-09-17 10:59 PM
PG10 is also the NRST pin. I was able to trace this behavior to the NRST_MODE bits in FLASH_OPTR. I changed them from 0x3 to 0x2 and the MCO output started working along with normal GPIO which I also found to be failing.
2024-09-17 07:10 PM
> Refer to the “Alternate function mapping” table in the device datasheet for the detailed mapping of the alternate function I/O pins.
So did you? The datasheet is a separate document from the reference manual.
MCO is AF0, so 0 is correct in those registers.
Make sure output speed is very high.
2024-09-17 07:19 PM
Ahh...once again, datasheet and reference manual are different. So, yes...AF0 is correct.
The RCC register configuration all seemed correct.
If I'm not seeing MCO output, what else could I look at?
2024-09-17 08:54 PM
Configure it in CubeMX and see if it works. If it does, compare your register values against what it does instead. If it doesn't work, set pin up as a GPIO output and toggle it and verify on a scope that you're actually monitoring the pin and not something else.
2024-09-17 09:09 PM - edited 2024-09-17 10:59 PM
PG10 is also the NRST pin. I was able to trace this behavior to the NRST_MODE bits in FLASH_OPTR. I changed them from 0x3 to 0x2 and the MCO output started working along with normal GPIO which I also found to be failing.
2024-09-17 09:40 PM
Check out
WEAK void SystemClock_Config(void){}
there is a line for MCO, something like
HAL_RCC_MCOConfig(RCC_MCO2, RCC_MCO2SOURCE_SYSCLK, RCC_MCODIV_4);
2024-09-18 06:39 AM - edited 2024-09-18 06:40 AM
You should post your chip name in the title or opening post next time. Could have been solved much quicker.