cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F030R8 External Oscillator

metin
Associate II
Posted on April 03, 2014 at 13:17

Dear friends,

How can I use external oscillator with STM32F030R8?

I try it with Discovery Kit but it can not work properly?

Do we need something with software side?

When we do it with STM32F100R series, it is easy but we can not solve for this one?

with my best regards.

OZTURK, Metin.

#stm32
7 REPLIES 7
Posted on April 03, 2014 at 13:31

Does the board have an external 8 MHz crystal? Or is it connected by solder-bridges to the 8 MHz output of the F103 providing the ST-LINK function? Are those bridges made? Refer to manual and schematic.

If you use the 8 MHz output, the HSE should be enabled with BYPASS mode.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
frankmeyer9
Associate II
Posted on April 03, 2014 at 13:37

How can I use external oscillator with STM32F030R8?

 

I try it with Discovery Kit but it can not work properly?

 

Consult the schematics of your discovery board.

I have a F051 and a F072 discovery board, both are clocked from the integrated STLink, but with a reserved space for a quartz. You will need to remove a soldering bridge if populating a quartz - as said, consult the schematics and the discovery user manual.

To find a suitable oscillator, check the requirements in your MCU's datasheet. I am no hardware developer, so I won't comment on that.

metin
Associate II
Posted on April 04, 2014 at 09:10

Dear friends,

Thank you very much for your helps.

I did something according to user manuel.

I use 16MHz external.

But it works 8MHz.

Do we have to do something in software side?

Or when we use our own boards, what kind of configurations do we have to do?

''

Oscillator onboard

 

. From X2 crystal (not provided). For typical frequencies and its

 

capacitors and resistors, please refer to the STM32F030R8T6 datasheet.

Configuration needed:

– SB16, SB17, SB18 OPEN

– R22, R23, C13, C14 soldered

''

frankmeyer9
Associate II
Posted on April 04, 2014 at 10:03

Could it be that the 8 MHz clock output from the STLink is overdriving your quartz ?

Have you checked this :

– SB16, SB17,

SB18 OPEN

metin
Associate II
Posted on April 08, 2014 at 11:12

Dear friends,

According to your comments, the hardware configuration is enough for external oscillator. And we do not have to do something in software side, especially in system_stm32f0xx.c. Am I right?

Best regards.

Posted on April 08, 2014 at 15:56

You should look to the standard library rather than the Discovery one, you'd need to adjust the PLLMUL value to account for the faster oscillator, and the HSE_VALUE define (stm32f0xx_conf.h? or project wide)

STM32F0xx_StdPeriph_Lib_V1.3.1\Projects\STM32F0xx_StdPeriph_Examples\ADC\ADC_AnalogWatchdog\system_stm32f0xx.c

SetSysClock()

 RCC->CFGR |= (uint32_t)(RCC_CFGR_PLLSRC_PREDIV1 | RCC_CFGR_PLLXTPRE_PREDIV1 | RCC_CFGR_PLLMULL6); // 8 MHz * 6 = 48 MHz

changes too

 RCC->CFGR |= (uint32_t)(RCC_CFGR_PLLSRC_PREDIV1 | RCC_CFGR_PLLXTPRE_PREDIV1 | RCC_CFGR_PLLMULL3); // 16 MHz * 3 = 48 MHz

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
metin
Associate II
Posted on April 09, 2014 at 16:13

Thank you very much for your helps.

We solved the problem by changing something in system_stm32f00xx.c

But I think it was a difficult loop to select external oscillator. 🙂

 /* Select HSE as system clock source */

    RCC->CFGR &= (uint32_t)((uint32_t)~(RCC_CFGR_SW));

    RCC->CFGR |= (uint32_t)RCC_CFGR_SW_HSE;

  

  /* Wait till HSE is used as system clock source */

    while ((RCC->CFGR & (uint32_t)RCC_CFGR_SWS) != (uint32_t)0x04)

    {

    }

    // PLL configuration = HSE * 6 = 48 MHz */

   /* RCC->CFGR &= (uint32_t)((uint32_t)~(RCC_CFGR_PLLSRC | RCC_CFGR_PLLXTPRE | RCC_CFGR_PLLMULL));

    RCC->CFGR |= (uint32_t)(RCC_CFGR_PLLSRC_PREDIV1 | RCC_CFGR_PLLXTPRE_PREDIV1 | RCC_CFGR_PLLMULL2);

           

    // Enable PLL

    RCC->CR |= RCC_CR_PLLON;

    // Wait till PLL is ready

    while((RCC->CR & RCC_CR_PLLRDY) == 0)

    {

    }

    // Select PLL as system clock source

    RCC->CFGR &= (uint32_t)((uint32_t)~(RCC_CFGR_SW));

    RCC->CFGR |= (uint32_t)RCC_CFGR_SW_PLL;   

    // Wait till PLL is used as system clock source

    while ((RCC->CFGR & (uint32_t)RCC_CFGR_SWS) != (uint32_t)RCC_CFGR_SWS_PLL)

    {

    }*/ On the other hand, we need your helps about TIM 17 PWMOut issue.

We can not produce TIM17 N channel out.

with my best wishes.

Öztürk, Metin.