cancel
Showing results for 
Search instead for 
Did you mean: 

HSI->MCO and RTC->LSE configuration

siddj
Associate II
Posted on March 02, 2009 at 05:13

HSI->MCO and RTC->LSE configuration

3 REPLIES 3
siddj
Associate II
Posted on May 17, 2011 at 13:04

So I have been trying to get the HSI clock as the MCO and output it on pin#67, PA8. I am using a STM32F103 VB chip.Following is my code for it.

RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);

GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8;

GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;

GPIO_Init(GPIOA, &GPIO_InitStructure);

RCC_MCOConfig(RCC_MCO_HSI);

I can see in my RCC_CCR that my HSI is on and stable/ready. Also on executing the code I can see in my register that HSI is used as MCO source.

When I try to see the signal on a scope, the HSI clock is not outputted on pin PA8 #67.

I have the same issue with RTC, I am using the LSE clock 32 Khz to output on pin#7, PC13-Tamper RTC. Again I can see in my registers as I step through the following code that the LSE is on, LSE is selected as RTC clock.

/* Enable PWR and BKP clocks */

RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR | RCC_APB1Periph_BKP, ENABLE);

/* Allow access to BKP Domain */

PWR_BackupAccessCmd(ENABLE);

/* Reset Backup Domain */

BKP_DeInit();

/* Enable LSE */

RCC_LSEConfig(RCC_LSE_ON);

/* Wait till LSE is ready */

while (RCC_GetFlagStatus(RCC_FLAG_LSERDY) == RESET)

{}

/* Select LSE as RTC Clock Source */

RCC_RTCCLKConfig(RCC_RTCCLKSource_LSE);

/* Enable RTC Clock */

RCC_RTCCLKCmd(ENABLE);

/* Wait for RTC registers synchronization */

RTC_WaitForSynchro();

I am using both clocks to clock my CPLD ( they are already routed to the CPLD clock pins). Any recommendations or troubleshooting tips would be

really appreciated.

sofiene
Associate III
Posted on May 17, 2011 at 13:04

siddj;

You forgot to enable the APB alternate function clock on APB2.

RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_AFIO , ENABLE);

siddj
Associate II
Posted on May 17, 2011 at 13:04

My RTC clock issue was resolved, thanks!

Has anyone outputted the MCO on a GPIO A8 pin before?