git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@9999 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
Rocco Marco Guglielmi 2016-12-30 15:36:49 +00:00
parent d7fcfd351a
commit e6acaa5a46
7 changed files with 63 additions and 9 deletions

View File

@ -41,7 +41,6 @@
#define STM32_PLS STM32_PLS_LEV0
#define STM32_HSI_ENABLED TRUE
#define STM32_HSI14_ENABLED TRUE
#define STM32_HSI48_ENABLED FALSE
#define STM32_LSI_ENABLED TRUE
#define STM32_HSE_ENABLED FALSE
#define STM32_LSE_ENABLED FALSE

View File

@ -41,7 +41,6 @@
#define STM32_PLS STM32_PLS_LEV0
#define STM32_HSI_ENABLED TRUE
#define STM32_HSI14_ENABLED TRUE
#define STM32_HSI48_ENABLED FALSE
#define STM32_LSI_ENABLED TRUE
#define STM32_HSE_ENABLED FALSE
#define STM32_LSE_ENABLED FALSE

View File

@ -41,7 +41,6 @@
#define STM32_PLS STM32_PLS_LEV0
#define STM32_HSI_ENABLED TRUE
#define STM32_HSI14_ENABLED TRUE
#define STM32_HSI48_ENABLED FALSE
#define STM32_LSI_ENABLED TRUE
#define STM32_HSE_ENABLED FALSE
#define STM32_LSE_ENABLED FALSE

View File

@ -307,9 +307,10 @@ void stm32_clock_init(void) {
#endif
/* Clock settings.*/
/* CFGR2 must be configured first since CFGR value could change CFGR2 */
RCC->CFGR2 = STM32_PREDIV;
RCC->CFGR = STM32_PLLNODIV | STM32_MCOPRE | STM32_MCOSEL | STM32_PLLMUL |
STM32_PLLSRC | STM32_PPRE | STM32_HPRE;
RCC->CFGR2 = STM32_PREDIV;
#if STM32_CECSW == STM32_CECSW_OFF
RCC->CFGR3 = STM32_USBSW | STM32_I2C1SW | STM32_USART1SW;
#else

View File

@ -499,6 +499,10 @@
* HSI related checks.
*/
#if STM32_HSI_ENABLED
#if (STM32_SW == STM32_SW_PLL) && \
(STM32_PLLSRC == STM32_PLLSRC_HSI) && !STM32_HAS_HSI_PREDIV
#error "STM32_PLLSRC_HSI not available on this platform. Select STM32_PLLSRC_HSI_DIV2 instead."
#endif
#else /* !STM32_HSI_ENABLED */
#if STM32_SW == STM32_SW_HSI
@ -548,6 +552,9 @@
* HSI48 related checks.
*/
#if STM32_HSI48_ENABLED
#if !STM32_HAS_HSI48
#error "HSI48 not available on this platform"
#endif
#else /* !STM32_HSI48_ENABLED */
#if STM32_SW == STM32_SW_HSI48
@ -662,7 +669,7 @@
#define STM32_ACTIVATE_PLL FALSE
#endif
/* HSE prescaler setting check.*/
/* HSE, HSI prescaler setting check.*/
#if ((STM32_PREDIV_VALUE >= 1) || (STM32_PREDIV_VALUE <= 16))
#define STM32_PREDIV ((STM32_PREDIV_VALUE - 1) << 0)
#else
@ -821,14 +828,16 @@
*/
#if (STM32_MCOPRE == STM32_MCOPRE_DIV1) || defined(__DOXYGEN__)
#define STM32_MCOCLK STM32_MCODIVCLK
#elif STM32_MCOPRE == STM32_MCOPRE_DIV2
#elif (STM32_MCOPRE == STM32_MCOPRE_DIV2) && STM32_HAS_MCO_PREDIV
#define STM32_MCOCLK (STM32_MCODIVCLK / 2)
#elif STM32_MCOPRE == STM32_MCOPRE_DIV4
#elif (STM32_MCOPRE == STM32_MCOPRE_DIV4) && STM32_HAS_MCO_PREDIV
#define STM32_MCOCLK (STM32_MCODIVCLK / 4)
#elif STM32_MCOPRE == STM32_MCOPRE_DIV8
#elif (STM32_MCOPRE == STM32_MCOPRE_DIV8) && STM32_HAS_MCO_PREDIV
#define STM32_MCOCLK (STM32_MCODIVCLK / 8)
#elif STM32_MCOPRE == STM32_MCOPRE_DIV16
#elif (STM32_MCOPRE == STM32_MCOPRE_DIV16) && STM32_HAS_MCO_PREDIV
#define STM32_MCOCLK (STM32_MCODIVCLK / 16)
#elif !STM32_HAS_MCO_PREDIV
#error "MCO_PREDIV not available on this platform. Select STM32_MCODIVCLK."
#else
#error "invalid STM32_MCOPRE value specified"
#endif

View File

@ -46,6 +46,15 @@
/* Common identifier of all STM32F030 devices.*/
#define STM32F030
/* RCC attributes. */
#define STM32_HAS_HSI48 FALSE
#if defined(STM32F030xC)
#define STM32_HAS_HSI_PREDIV TRUE
#else
#define STM32_HAS_HSI_PREDIV FALSE
#endif
#define STM32_HAS_MCO_PREDIV TRUE
/* ADC attributes.*/
#define STM32_HAS_ADC1 TRUE
#define STM32_ADC_SUPPORTS_PRESCALER FALSE
@ -241,6 +250,7 @@
#define STM32_HAS_TIM2 FALSE
#define STM32_HAS_TIM4 FALSE
#define STM32_HAS_TIM5 FALSE
#define STM32_HAS_TIM7 FALSE
#define STM32_HAS_TIM8 FALSE
#define STM32_HAS_TIM9 FALSE
#define STM32_HAS_TIM10 FALSE
@ -349,6 +359,11 @@
/*===========================================================================*/
#elif defined(STM32F031x6) || defined(STM32F038xx)
/* RCC attributes. */
#define STM32_HAS_HSI48 FALSE
#define STM32_HAS_HSI_PREDIV FALSE
#define STM32_HAS_MCO_PREDIV TRUE
/* ADC attributes.*/
#define STM32_HAS_ADC1 TRUE
#define STM32_ADC_SUPPORTS_PRESCALER FALSE
@ -553,6 +568,11 @@
/*===========================================================================*/
#elif defined(STM32F042x6)
/* RCC attributes. */
#define STM32_HAS_HSI48 TRUE
#define STM32_HAS_HSI_PREDIV TRUE
#define STM32_HAS_MCO_PREDIV TRUE
/* ADC attributes.*/
#define STM32_HAS_ADC1 TRUE
#define STM32_ADC_SUPPORTS_PRESCALER FALSE
@ -767,6 +787,11 @@
/*===========================================================================*/
#elif defined(STM32F048xx)
/* RCC attributes. */
#define STM32_HAS_HSI48 TRUE
#define STM32_HAS_HSI_PREDIV TRUE
#define STM32_HAS_MCO_PREDIV TRUE
/* ADC attributes.*/
#define STM32_HAS_ADC1 TRUE
#define STM32_ADC_SUPPORTS_PRESCALER FALSE
@ -985,6 +1010,11 @@
/*===========================================================================*/
#elif defined(STM32F051x8) || defined(STM32F058xx)
/* RCC attributes. */
#define STM32_HAS_HSI48 FALSE
#define STM32_HAS_HSI_PREDIV FALSE
#define STM32_HAS_MCO_PREDIV FALSE
/* ADC attributes.*/
#define STM32_HAS_ADC1 TRUE
#define STM32_ADC_SUPPORTS_PRESCALER FALSE
@ -1219,6 +1249,11 @@
/* Common identifier of all STM32F070 devices.*/
#define STM32F070
/* RCC attributes. */
#define STM32_HAS_HSI48 FALSE
#define STM32_HAS_HSI_PREDIV TRUE
#define STM32_HAS_MCO_PREDIV TRUE
/* ADC attributes.*/
#define STM32_HAS_ADC1 TRUE
#define STM32_ADC_SUPPORTS_PRESCALER FALSE
@ -1469,6 +1504,11 @@
/*===========================================================================*/
#elif defined(STM32F071xB) || defined(STM32F072xB) || \
defined(STM32F078xx)
/* RCC attributes. */
#define STM32_HAS_HSI48 TRUE
#define STM32_HAS_HSI_PREDIV TRUE
#define STM32_HAS_MCO_PREDIV TRUE
/* ADC attributes.*/
#define STM32_HAS_ADC1 TRUE
@ -1733,6 +1773,11 @@
/*===========================================================================*/
#elif defined(STM32F091xC) || defined(STM32F098xx)
/* RCC attributes. */
#define STM32_HAS_HSI48 TRUE
#define STM32_HAS_HSI_PREDIV TRUE
#define STM32_HAS_MCO_PREDIV TRUE
/* ADC attributes.*/
#define STM32_HAS_ADC1 TRUE
#define STM32_ADC_SUPPORTS_PRESCALER FALSE

View File

@ -153,6 +153,8 @@
- RT: Merged RT4.
- NIL: Merged NIL2.
- NIL: Added STM32F7 demo.
- HAL: Fixed wrong clock init in STM32F0 port ad added more error checks
(bug #806)(backported to 16.1.6).
- HAL: Fixed misplaced else in STM32F0 port (bug #805)
(backported to 16.1.6).
- HAL: Fixed flash waiting state misconfiguration in STM32L4 port (bug #804)