cancel
Showing results for 
Search instead for 
Did you mean: 

How can it be? Datasheet, as well as CubeMX allow to set alternate function (MCO) for PG10 pin (Stm32g431KBTx LQFP32) while STM's driver does not?!!!

Stanislav Silnicki
Associate III

BTW, Errata says nothing about this mess.

1 ACCEPTED SOLUTION

Accepted Solutions
Igor Cesko
ST Employee

Hi Stanislav Silnicki ,

I tried now to set MCO output on PG10 pin and it works correctly (I used CubeMX for code generation). But the condition is that there must be reprogrammed option bits NRST_MODE = 2 (GPIO mode). Then the PG10 pin works as GPIO and there can be enabled MCO function.

As side effect I have found one mistake in HAL function "HAL_RCC_MCOConfig". This function configures always PA8 as MCO output - so the PG10 pin must be configured in "main" function as MCO alternate function (which CubeMX codes correctly). This mistake in "HAL_RCC_MCOConfig" function will be reported (to be corrected). Mistake causes that MCO output will be on both PA8 and PG10 pins.

Please reprogram option bits NRST_MODE to value 2 (for example in STM32CubeProgrammer) and try the code generated by CubeMX again. And please make sure that on PG10 pin is no capacitor connected - because PG10 works usually as NRST and usually is there 100nF capacitor at NRST pin.

Regards

Igor0693W00000D1zy1QAB.png

View solution in original post

5 REPLIES 5
TDK
Guru

Just a bug/missing functionality. It looks like the generated code will set both PG10 and PA8 to output MCO in this case.

Note that you'll need to set NRST_MODE appropriately unless you want MCO to reset your chip immediately. And reassigning the NRST pin provides opportunities for bricking the chip.

If you feel a post has answered your question, please click "Accept as Solution".
Stanislav Silnicki
Associate III

Disabling NRST function for the PG10 pin in FLASH_OPTR doesn't help. While reset function is disabled, and pin assigned to GPIO, MCO doesn't appear at all....

Its is so frustrating.... we spent a lot for design and now we eat this. :(

Interesting. I suppose the datasheet could be incorrect. The CubeMX functionality seems to be implemented off of the datasheet. I do not have a chip to test this with.
If you feel a post has answered your question, please click "Accept as Solution".

I have rearranged the code to init PG10 as MCO, enabling GPIOG clocks as well. And no result at all. PG10 just keeps high. The other pin (PA8) functions well for MCO.

Igor Cesko
ST Employee

Hi Stanislav Silnicki ,

I tried now to set MCO output on PG10 pin and it works correctly (I used CubeMX for code generation). But the condition is that there must be reprogrammed option bits NRST_MODE = 2 (GPIO mode). Then the PG10 pin works as GPIO and there can be enabled MCO function.

As side effect I have found one mistake in HAL function "HAL_RCC_MCOConfig". This function configures always PA8 as MCO output - so the PG10 pin must be configured in "main" function as MCO alternate function (which CubeMX codes correctly). This mistake in "HAL_RCC_MCOConfig" function will be reported (to be corrected). Mistake causes that MCO output will be on both PA8 and PG10 pins.

Please reprogram option bits NRST_MODE to value 2 (for example in STM32CubeProgrammer) and try the code generated by CubeMX again. And please make sure that on PG10 pin is no capacitor connected - because PG10 works usually as NRST and usually is there 100nF capacitor at NRST pin.

Regards

Igor0693W00000D1zy1QAB.png