Skip to content

Commit

Permalink
Review system Timer config
Browse files Browse the repository at this point in the history
Set TICK_INT_PRIORITY to 0 (Highest priority) by default, it can be redefined.
Time base configuration function (HAL_InitTick ()) is called automatically
at the beginning of the program after reset by HAL_Init() or at any time
when clock is configured, by HAL_RCC_ClockConfig().

The HAL_SYSTICK_Config()function calls the SysTick_Config() function which
is a CMSIS function that:
  Configures the SysTick Reload register with value passed as function parameter.
  Configures the SysTick IRQ priority to the TICK_INT_PRIORITY.
  Resets the SysTick Counter register.
  Configures the SysTick Counter clock source to be Core Clock Source (HCLK).
  Enables the SysTick Interrupt.
  Starts the SysTick Counter.

So, SystemClock_Config() (variant.cpp) does not need to be set explicitly.

Signed-off-by: Frederic.Pillon <[email protected]>
  • Loading branch information
fpistm committed May 17, 2019
1 parent 6159139 commit 9f757b4
Show file tree
Hide file tree
Showing 62 changed files with 12 additions and 423 deletions.
2 changes: 1 addition & 1 deletion system/STM32F0xx/stm32f0xx_hal_conf_default.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ in voltage and temperature. */
*/
#define VDD_VALUE 3300U /*!< Value of VDD in mv */
#if !defined (TICK_INT_PRIORITY)
#define TICK_INT_PRIORITY ((uint32_t)(1U<<__NVIC_PRIO_BITS) - 1U) /*!< tick interrupt priority (lowest by default) */
#define TICK_INT_PRIORITY 0x00U /*!< tick interrupt priority */
#endif
#if !defined (USE_RTOS)
#define USE_RTOS 0U
Expand Down
2 changes: 1 addition & 1 deletion system/STM32F1xx/stm32f1xx_hal_conf_default.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ extern "C" {
*/
#define VDD_VALUE 3300U /*!< Value of VDD in mv */
#if !defined (TICK_INT_PRIORITY)
#define TICK_INT_PRIORITY 0x0FU /*!< tick interrupt priority */
#define TICK_INT_PRIORITY 0x00U /*!< tick interrupt priority */
#endif
#if !defined (USE_RTOS)
#define USE_RTOS 0U
Expand Down
2 changes: 1 addition & 1 deletion system/STM32F2xx/stm32f2xx_hal_conf_default.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ in voltage and temperature.*/
*/
#define VDD_VALUE 3300U /*!< Value of VDD in mv */
#if !defined (TICK_INT_PRIORITY)
#define TICK_INT_PRIORITY 0x0FU /*!< tick interrupt priority */
#define TICK_INT_PRIORITY 0x00U /*!< tick interrupt priority */
#endif
#if !defined (USE_RTOS)
#define USE_RTOS 0U
Expand Down
2 changes: 1 addition & 1 deletion system/STM32F3xx/stm32f3xx_hal_conf_default.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ in voltage and temperature. */
*/
#define VDD_VALUE (3300U) /*!< Value of VDD in mv */
#if !defined (TICK_INT_PRIORITY)
#define TICK_INT_PRIORITY ((uint32_t)(1U<<__NVIC_PRIO_BITS) - 1U) /*!< tick interrupt priority (lowest by default) */
#define TICK_INT_PRIORITY 0x00U /*!< tick interrupt priority */
#endif
#if !defined (USE_RTOS)
#define USE_RTOS 0U
Expand Down
2 changes: 1 addition & 1 deletion system/STM32F4xx/stm32f4xx_hal_conf_default.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ in voltage and temperature. */
*/
#define VDD_VALUE 3300U /*!< Value of VDD in mv */
#if !defined (TICK_INT_PRIORITY)
#define TICK_INT_PRIORITY 0x0FU /*!< tick interrupt priority */
#define TICK_INT_PRIORITY 0x00U /*!< tick interrupt priority */
#endif
#if !defined (USE_RTOS)
#define USE_RTOS 0U
Expand Down
2 changes: 1 addition & 1 deletion system/STM32F7xx/stm32f7xx_hal_conf_default.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ in voltage and temperature. */
*/
#define VDD_VALUE 3300U /*!< Value of VDD in mv */
#if !defined (TICK_INT_PRIORITY)
#define TICK_INT_PRIORITY 0x0FU /*!< tick interrupt priority */
#define TICK_INT_PRIORITY 0x00U /*!< tick interrupt priority */
#endif
#if !defined (USE_RTOS)
#define USE_RTOS 0U
Expand Down
2 changes: 1 addition & 1 deletion system/STM32G0xx/stm32g0xx_hal_conf_default.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ in voltage and temperature.*/
*/
#define VDD_VALUE (3300UL) /*!< Value of VDD in mv */
#if !defined (TICK_INT_PRIORITY)
#define TICK_INT_PRIORITY ((1UL<<__NVIC_PRIO_BITS) - 1UL) /*!< tick interrupt priority */
#define TICK_INT_PRIORITY 0x00U /*!< tick interrupt priority */
#endif
#if !defined (USE_RTOS)
#define USE_RTOS 0U
Expand Down
2 changes: 1 addition & 1 deletion system/STM32H7xx/stm32h7xx_hal_conf_default.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ in voltage and temperature.*/
*/
#define VDD_VALUE ((uint32_t)3300) /*!< Value of VDD in mv */
#if !defined (TICK_INT_PRIORITY)
#define TICK_INT_PRIORITY ((uint32_t)0x0F) /*!< tick interrupt priority */
#define TICK_INT_PRIORITY ((uint32_t)0x00) /*!< tick interrupt priority */
#endif
#if !defined (USE_RTOS)
#define USE_RTOS 0
Expand Down
2 changes: 1 addition & 1 deletion system/STM32L0xx/stm32l0xx_hal_conf_default.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ in voltage and temperature.*/
*/
#define VDD_VALUE ((uint32_t)3300U) /*!< Value of VDD in mv */
#if !defined (TICK_INT_PRIORITY)
#define TICK_INT_PRIORITY (((uint32_t)1U<<__NVIC_PRIO_BITS) - 1U) /*!< tick interrupt priority */
#define TICK_INT_PRIORITY 0x00U /*!< tick interrupt priority */
#endif
#if !defined (USE_RTOS)
#define USE_RTOS 0U
Expand Down
2 changes: 1 addition & 1 deletion system/STM32L1xx/stm32l1xx_hal_conf_default.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ in voltage and temperature.*/
*/
#define VDD_VALUE (3300U) /*!< Value of VDD in mv */
#if !defined (TICK_INT_PRIORITY)
#define TICK_INT_PRIORITY (0x000FU) /*!< tick interrupt priority */
#define TICK_INT_PRIORITY (0x0000U) /*!< tick interrupt priority */
#endif
#if !defined (USE_RTOS)
#define USE_RTOS 0U
Expand Down
2 changes: 1 addition & 1 deletion system/STM32L4xx/stm32l4xx_hal_conf_default.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ in voltage and temperature.*/
*/
#define VDD_VALUE 3300U /*!< Value of VDD in mv */
#if !defined (TICK_INT_PRIORITY)
#define TICK_INT_PRIORITY 0x0FU /*!< tick interrupt priority */
#define TICK_INT_PRIORITY 0x00U /*!< tick interrupt priority */
#endif
#if !defined (USE_RTOS)
#define USE_RTOS 0U
Expand Down
2 changes: 1 addition & 1 deletion system/STM32WBxx/stm32wbxx_hal_conf_default.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ in voltage and temperature.*/
*/
#define VDD_VALUE (3300UL) /*!< Value of VDD in mv */
#if !defined (TICK_INT_PRIORITY)
#define TICK_INT_PRIORITY ((1UL<<__NVIC_PRIO_BITS) - 1UL) /*!< tick interrupt priority (lowest by default) */
#define TICK_INT_PRIORITY 0x00U /*!< tick interrupt priority */
#endif
#if !defined (USE_RTOS)
#define USE_RTOS 0
Expand Down
6 changes: 0 additions & 6 deletions variants/ARMED_V1/variant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,12 +178,6 @@ WEAK void SystemClock_Config(void)
/* Enable the Flash prefetch */
__HAL_FLASH_PREFETCH_BUFFER_ENABLE();
}
HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq() / 1000);

HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);

/* SysTick_IRQn interrupt configuration */
HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
}

#ifdef __cplusplus
Expand Down
11 changes: 0 additions & 11 deletions variants/BLACK_F407XX/variant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,17 +222,6 @@ WEAK void SystemClock_Config(void)
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_5) != HAL_OK) {
_Error_Handler(__FILE__, __LINE__);
}

/**Configure the Systick interrupt time
*/
HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq() / 1000);

/**Configure the Systick
*/
HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);

/* SysTick_IRQn interrupt configuration */
HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
}

#ifdef __cplusplus
Expand Down
3 changes: 0 additions & 3 deletions variants/BLACK_F407XX/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -316,9 +316,6 @@ extern "C" {
#define PIN_SERIAL_RX PA10
#define PIN_SERIAL_TX PA9

/* HAL configuration */
#define TICK_INT_PRIORITY 0U

/* Extra HAL modules */
#define HAL_DAC_MODULE_ENABLED
#define HAL_SD_MODULE_ENABLED
Expand Down
9 changes: 0 additions & 9 deletions variants/BLUEPILL_F103XX/variant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,15 +138,6 @@ WEAK void SystemClock_Config(void)
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK) {
while (1);
}

/* Configure the Systick interrupt time */
HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq() / 1000);

/* Configure the Systick */
HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);

/* SysTick_IRQn interrupt configuration */
HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
}

#ifdef __cplusplus
Expand Down
11 changes: 0 additions & 11 deletions variants/BLUE_F407VE_Mini/variant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,17 +202,6 @@ WEAK void SystemClock_Config(void)
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_5) != HAL_OK) {
_Error_Handler(__FILE__, __LINE__);
}

/**Configure the Systick interrupt time
*/
HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq() / 1000);

/**Configure the Systick
*/
HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);

/* SysTick_IRQn interrupt configuration */
HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
}

#ifdef __cplusplus
Expand Down
1 change: 0 additions & 1 deletion variants/BLUE_F407VE_Mini/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,6 @@ extern "C" {

/* HAL configuration */
#define HSE_VALUE 25000000U
#define TICK_INT_PRIORITY 0U

/* Extra HAL modules */
#define HAL_DAC_MODULE_ENABLED
Expand Down
9 changes: 0 additions & 9 deletions variants/DEMO_F030F4/variant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,15 +110,6 @@ WEAK void SystemClock_Config(void)
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_1) != HAL_OK) {
_Error_Handler(__FILE__, __LINE__);
}

/* Configure the Systick interrupt time */
HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq() / 1000);

/* Configure the Systick */
HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);

/* SysTick_IRQn interrupt configuration */
HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
}

#ifdef __cplusplus
Expand Down
9 changes: 0 additions & 9 deletions variants/DISCO_F030R8/variant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,15 +164,6 @@ WEAK void SystemClock_Config(void)
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_1) != HAL_OK) {
Error_Handler();
}

/* Configure the Systick interrupt time */
HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq() / 1000);

/* Configure the Systick */
HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);

/* SysTick_IRQn interrupt configuration */
HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
}

#ifdef __cplusplus
Expand Down
9 changes: 0 additions & 9 deletions variants/DISCO_F072RB/variant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,15 +160,6 @@ WEAK void SystemClock_Config(void)
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK) {
Error_Handler();
}

/* Configure the Systick interrupt time */
HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq() / 1000);

/* Configure the Systick */
HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);

/* SysTick_IRQn interrupt configuration */
HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
}

#ifdef __cplusplus
Expand Down
7 changes: 0 additions & 7 deletions variants/DISCO_F100RB/variant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,6 @@ WEAK void SystemClock_Config(void)
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK) {
while (1);
}

HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq() / 1000);

HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);

/* SysTick_IRQn interrupt configuration */
HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
}

#ifdef __cplusplus
Expand Down
6 changes: 0 additions & 6 deletions variants/DISCO_F407VG/variant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,12 +188,6 @@ WEAK void SystemClock_Config(void)
/* Enable the Flash prefetch */
__HAL_FLASH_PREFETCH_BUFFER_ENABLE();
}
HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq() / 1000);

HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);

/* SysTick_IRQn interrupt configuration */
HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
}

#ifdef __cplusplus
Expand Down
9 changes: 0 additions & 9 deletions variants/DISCO_F746NG/variant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,15 +138,6 @@ WEAK void SystemClock_Config(void)
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK) {
_Error_Handler(__FILE__, __LINE__);
}

/* Configure the Systick interrupt time */
HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq() / 1000);

/* Configure the Systick */
HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);

/* SysTick_IRQn interrupt configuration */
HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
}

#ifdef __cplusplus
Expand Down
7 changes: 0 additions & 7 deletions variants/DISCO_L072CZ_LRWAN1/variant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,6 @@ WEAK void SystemClock_Config(void)
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK) {
Error_Handler();
}

HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq() / 1000);

HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);

/* SysTick_IRQn interrupt configuration */
HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
}

#ifdef __cplusplus
Expand Down
11 changes: 0 additions & 11 deletions variants/DISCO_L475VG_IOT/variant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,20 +229,9 @@ WEAK void SystemClock_Config(void)
Error_Handler();
}

/**Configure the Systick interrupt time
*/
HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq() / 1000);

/**Configure the Systick
*/
HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);

/**Enable MSI Auto calibration
*/
HAL_RCCEx_EnableMSIPLLMode();

/* SysTick_IRQn interrupt configuration */
HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
}

#ifdef __cplusplus
Expand Down
9 changes: 0 additions & 9 deletions variants/DIYMROE_F407VGT/variant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,15 +203,6 @@ WEAK void SystemClock_Config(void)
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_5) != HAL_OK) {
_Error_Handler(__FILE__, __LINE__);
}

/* Configure the Systick interrupt time */
HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq() / 1000);

/* Configure the Systick */
HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);

/* SysTick_IRQn interrupt configuration */
HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
}

#ifdef __cplusplus
Expand Down
9 changes: 0 additions & 9 deletions variants/EEXTR_F030_V1/variant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,15 +136,6 @@ WEAK void SystemClock_Config(void)
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK) {
Error_Handler();
}

/* Configure the Systick interrupt time */
HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq() / 1000);

/* Configure the Systick */
HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);

/* SysTick_IRQn interrupt configuration */
HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
}

#ifdef __cplusplus
Expand Down
9 changes: 0 additions & 9 deletions variants/FK407M1/variant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,6 @@ WEAK void SystemClock_Config(void)
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_5) != HAL_OK) {
_Error_Handler(__FILE__, __LINE__);
}

/* Configure the Systick interrupt time */
HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq() / 1000);

/* Configure the Systick */
HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);

/* SysTick_IRQn interrupt configuration */
HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
}

#ifdef __cplusplus
Expand Down
4 changes: 0 additions & 4 deletions variants/FK407M1/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,6 @@ extern "C" {
#define PIN_SERIAL_RX PA10
#define PIN_SERIAL_TX PA9


/* HAL configuration */
#define TICK_INT_PRIORITY 0U

/* Extra HAL modules */
#define HAL_DAC_MODULE_ENABLED

Expand Down
9 changes: 0 additions & 9 deletions variants/HY_TinySTM103T/variant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,15 +143,6 @@ WEAK void SystemClock_Config(void)
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK) {
while (1);
}

/* Configure the Systick interrupt time */
HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq() / 1000);

/* Configure the Systick */
HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);

/* SysTick_IRQn interrupt configuration */
HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
}

#ifdef __cplusplus
Expand Down
Loading

0 comments on commit 9f757b4

Please sign in to comment.