Hello.
Since several days (!) i try to obtain a signal on MCO pin ( PA8) on my blue pill board.
I'm using gcc-arm-none-eabi-10.3-2021.10-x86_64-linux from
https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads + stlink tools + terminal window whithout any other librarie or IDE. All work perfectly with GPIO, timers, usart, clock management ...
For best clock management, i wish see Clock signal on MCO pin ( PA8) with a scope, without modify ( actualy !) the fault clock.
By fault, no signal appear. Fault clock is HSI ( internal 8MHz).
ST Doc is RM0041 §6 ( RCC) and 7 ( GPIO).
I use RCC_APB2ENR register ( §6.3.7 p 90), RCC_CFGR ( §6.3.2 p 80) and GPIOA_CRH ( §7.2.2 p 112).
These registers works fine for others functions.
My code :
//------------------ Define registers ( RM0041)
volatile uint32_t *APB2_ENR = (uint32_t*) 0x40021018;
volatile uint32_t *RCC_CFGR = (uint32_t*) 0x40021004;
volatile uint32_t *GPIOA_CRH = (uint32_t*) 0x40010804;
//Enable "alternate function". Bit 0 in RCC_APB2ENR
*APB2_ENR |= (1 << 0);
//Enable GPIOA. Bit 2 in RCC_APB2ENR
*APB2_ENR |= (1 << 2);
//Enable PA8 as MCO - §7.1.4 p.103
*GPIOA_CRH &= (0000<<0); //RAZ PA8 ( input-analog)
*GPIOA_CRH |= (11<<0); //PA8 output 50MHz
*GPIOA_CRH |= (10<<2); //PA8 function alternative output Push-pull
//Choose MCO entry - §6.3.2 p.80
*RCC_CFGR &= 0xF8FFFFFF; //RAZ MCO pin config - bits 24, 25, 26
*RCC_CFGR |= 0x04000000; //MCO = SYSCLK ( = default HSI clock 8MHz)
Compilation and linkage are OK, and others functions in this programm on PA, PC, TIM3 and USART1 are working fine with these registers.
But ... no signal on scope !
I've tried to alternatively pull-up and pull-down MCO pin with a 1K resistor without modification.
Have you an idea ?
Thank you for your tolerance about this bad english text !!!