Page 1 of 1

Support for HSEBYP

Posted: Thu May 03, 2012 3:04 pm
by mobyfab
Hi,

Could someone add support for HSEBYP?

I want to connect an external clock to the MCU, and there's no clean way to do so.

basically

in mcuconf.h:

Code: Select all

#define STM32_HSE_BYPASS  TRUE (should depend on HSE_ENABLED)


in hal_lld.c:

Code: Select all

#if STM32_HSE_ENABLED
   #if STM32_HSE_BYPASS
     /* HSE Bypass.*/
     RCC->CR |= RCC_CR_HSEBYP;
   #endif
  /* HSE activation.*/
  RCC->CR |= RCC_CR_HSEON;
  while (!(RCC->CR & RCC_CR_HSERDY))
    ;                                       /* Waits until HSE is stable.   */
#endif


HSEBYP can only be written when HSE is not enabled yet, so I put it before.

Bit 18 HSEBYP: External high-speed clock bypass
Set and cleared by software to bypass the oscillator with an external clock. The external
clock must be enabled with the HSEON bit set, to be used by the device. The HSEBYP bit
can be written only if the HSE oscillator is disabled.
0: external 4-16 MHz oscillator not bypassed
1: external 4-16 MHz oscillator bypassed with external clock


STM32_HSE_BYPASS is already defined.

Re: Support for HSEBYP

Posted: Thu May 03, 2012 6:34 pm
by Giovanni
Hi,

I added it but, IMO, you need to define STM32_HSE_BYPASS in your board.h not mcuconf.h, it is a board design related setting not an application setting.

Giovanni

Re: Support for HSEBYP

Posted: Thu May 03, 2012 7:00 pm
by mobyfab
Indeed that sounds more appropriate.

Thanks :)