2025-10-14 3:54 AM - last edited on 2025-10-14 4:18 AM by Andrew Neil
Hi All,
Does anyone know how to enable the MCO2(PC9) output after secure manager enabled? its work in project without secure manager and it could be enabled in systemClock config function as below:
,but it's not work any more after secure manager on,
and we could not call system clock config any more(the demo in repository v1.5.0 are calling).
Summarize:
1.How to enable MCO2 output in non-secure application;
2. It seems after trustzone enabled, rcc would not work in non-secure side, is the demo on repository right or not(call system clock config)?
Thanks!
2025-10-22 9:34 AM
Hello @SamZ and welcome to ST Community!
After enabling TrustZone/Secure Manager, you cannot configure MCO2 (PC9) from non-secure code unless the secure world grants access to RCC and GPIOC. The best practice is to configure MCO2 in the secure world, or provide a secure callable function for non-secure code to request MCO2 configuration.
To enable MCO2 output on PC9 from the non-secure world, there are key steps involving secure and non-secure configurations:
The secure world must first configure the MCO2 output settings (RCC->CFGR, GPIOC->MODER, etc.) because by default, only secure code can access these registers. After this, the non-secure world can use the output but cannot modify the configuration.
Alternatively, the secure world can grant non-secure access to the RCC peripheral via the Global TrustZone Controller (GTZC). This allows non-secure code to configure MCO2 directly, but it reduces system security since non-secure code can alter clock settings.
Additionally, GPIOC (specifically PC9) must be set as non-secure in GTZC so that non-secure code can configure the pin mode.
Best regards,