Exemplo n.º 1
0
static void prvSetupHardware( void )
{
	/* Start with the clocks in their expected state. */
	RCC_DeInit();

	/* Enable HSE (high speed external clock). */
	RCC_HSEConfig( RCC_HSE_ON );

	/* Wait till HSE is ready. */
	while( RCC_GetFlagStatus( RCC_FLAG_HSERDY ) == RESET )
	{
	}

	/* 2 wait states required on the flash. */
	*( ( unsigned long * ) 0x40022000 ) = 0x02;

	/* HCLK = SYSCLK */
	RCC_HCLKConfig( RCC_SYSCLK_Div1 );

	/* PCLK2 = HCLK */
	RCC_PCLK2Config( RCC_HCLK_Div1 );

	/* PCLK1 = HCLK/2 */
	RCC_PCLK1Config( RCC_HCLK_Div2 );

	/* PLLCLK = (25MHz / 2 ) * 5 = 62.5 MHz. */
	RCC_PLLConfig( RCC_PLLSource_HSE_Div2, RCC_PLLMul_5 );

	/* Enable PLL. */
	RCC_PLLCmd( ENABLE );

	/* Wait till PLL is ready. */
	while(RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET)
	{
	}

	/* Select PLL as system clock source. */
	RCC_SYSCLKConfig( RCC_SYSCLKSource_PLLCLK );

	/* Wait till PLL is used as system clock source. */
	while( RCC_GetSYSCLKSource() != 0x08 )
	{
	}

	/* Enable GPIOA, GPIOB, GPIOC, GPIOD, GPIOE and AFIO clocks */
	RCC_APB2PeriphClockCmd(	RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB |RCC_APB2Periph_GPIOC
							| RCC_APB2Periph_GPIOD | RCC_APB2Periph_GPIOE | RCC_APB2Periph_AFIO, ENABLE );

	/* Set the Vector Table base address at 0x08000000 */
	NVIC_SetVectorTable( NVIC_VectTab_FLASH, 0x0 );

	NVIC_PriorityGroupConfig( NVIC_PriorityGroup_4 );

	/* Configure HCLK clock as SysTick clock source. */
	SysTick_CLKSourceConfig( SysTick_CLKSource_HCLK );

	/* Initialise the IO used for the LED outputs. */
	vParTestInitialise();
}
Exemplo n.º 2
0
static void prvSetupHardware( void )
{
	/* RCC system reset(for debug purpose). */
	RCC_DeInit ();

    /* Enable HSE. */
	RCC_HSEConfig( RCC_HSE_ON );

	/* Wait till HSE is ready. */
	while (RCC_GetFlagStatus(RCC_FLAG_HSERDY) == RESET);

    /* HCLK = SYSCLK. */
	RCC_HCLKConfig( RCC_SYSCLK_Div1 );

    /* PCLK2  = HCLK. */
	RCC_PCLK2Config( RCC_HCLK_Div1 );

    /* PCLK1  = HCLK/2. */
	RCC_PCLK1Config( RCC_HCLK_Div2 );

	/* ADCCLK = PCLK2/4. */
	RCC_ADCCLKConfig( RCC_PCLK2_Div4 );

    /* Flash 2 wait state. */
	*( volatile unsigned long  * )0x40022000 = 0x01;

	/* PLLCLK = 8MHz * 9 = 72 MHz */
	RCC_PLLConfig( RCC_PLLSource_HSE_Div1, RCC_PLLMul_9 );

    /* Enable PLL. */
	RCC_PLLCmd( ENABLE );

	/* Wait till PLL is ready. */
	while (RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET);

	/* Select PLL as system clock source. */
	RCC_SYSCLKConfig (RCC_SYSCLKSource_PLLCLK);

	/* Wait till PLL is used as system clock source. */
	while (RCC_GetSYSCLKSource() != 0x08);

	/* Enable GPIOA, GPIOB, GPIOC, GPIOD, GPIOE and AFIO clocks */
	RCC_APB2PeriphClockCmd(	RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB |RCC_APB2Periph_GPIOC
							| RCC_APB2Periph_GPIOD | RCC_APB2Periph_GPIOE | RCC_APB2Periph_AFIO, ENABLE );

	/* Set the Vector Table base address at 0x08000000. */
	NVIC_SetVectorTable( NVIC_VectTab_FLASH, 0x0 );

	NVIC_PriorityGroupConfig( NVIC_PriorityGroup_4 );

	/* Configure HCLK clock as SysTick clock source. */
	SysTick_CLKSourceConfig( SysTick_CLKSource_HCLK );

	/* Initialise the IO used for the LED outputs. */
	vParTestInitialise();

	/* SPI2 Periph clock enable */
	RCC_APB1PeriphClockCmd( RCC_APB1Periph_SPI2, ENABLE );
}
Exemplo n.º 3
0
/* init System Ticker with 1ms ----------------------------------------------*/
void initSysTick()
{
    // config for systick - delay
    SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK);
    SysTick_SetReload(72000);
    SysTick_ITConfig(ENABLE);
    SysTick_CounterCmd(SysTick_Counter_Enable);
}
Exemplo n.º 4
0
void SysTick_init(void)
{
			RCC_ClocksTypeDef RCC_Clocks;
			RCC_GetClocksFreq(&RCC_Clocks);
			SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK);
			SysTick_Config(RCC_Clocks.HCLK_Frequency / 1000);
			NVIC_SetPriority(SysTick_IRQn, 0x03);
}
Exemplo n.º 5
0
void Delay_init(uint32_t interval){
	
	SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK_Div8); //set clock source

	SysTick->LOAD = interval; //set reload value
	SysTick->VAL = 0; //set counter value to 0
	SysTick->CTRL =  SysTick_CTRL_CLKSOURCE_Msk | SysTick_CTRL_ENABLE_Msk; //set clock and enable
}
Exemplo n.º 6
0
/**************************************************************************************************************
  函数描述 : SysTick初始化,8分频,分频后每计1个数为0.111us
 ***************************************************************************************************************/
void SysTick_Init(void)
{
    SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK_Div8);	//计数器时钟源 == AHB(HCLK)/8 = 72MHz/8 = 9MHz

    SysTick->LOAD = 0xFFFFFE;				//装载计数器初始值
    SysTick->VAL   =  0;					//重新装载
    SysTick->CTRL &= ~(SYSTICK_TICKINT<<1);			//禁止中断
}
//SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK_Div8)
//  Reload Value = SysTick Counter Clock (Hz) x  Desired Time base (s)
//     
//        - Reload Value is the parameter to be passed for SysTick_Config() function
//        - Reload Value should not exceed 0xFFFFFF
void InitDelay(__IO uint32_t BaseTime)
{
		RCC_ClocksTypeDef    RCC_Clocks;
		RCC_GetClocksFreq(&RCC_Clocks);
	  SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK);
		if(SysTick_Config((uint32_t)(BaseTime*(RCC_Clocks.HCLK_Frequency))/1000000))
				while(1); // capture an error	
}
Exemplo n.º 8
0
/*==================================================================================
* 函 数 名: systick_init
* 参    数: None
* 功能描述:  初始化系统嘀嗒定时器
* 返 回 值: None
* 备    注: 此函数调用的SysTick_CLKSourceConfig()设定定时器的输入时钟,可是不知道为
						 什么更改SysTick_CLKSource_HCLK_Div8和SysTick_CLKSource_HCLK两个输入参数
						 ,定时周期一样,有待考证。
* 作    者: gaodb
* 创建时间: 2012.10
==================================================================================*/
static void systick_init(void)
{
	SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK);
	if (SysTick_Config(72000))
  { 
    while (1);
  }
}
Exemplo n.º 9
0
void start_timer() {
	RCC_ClocksTypeDef RCC_Clocks;
	/* Configure Systick clock source as HCLK */
  SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK);
  /* SystTick configuration: an interrupt every 10ms */
  RCC_GetClocksFreq(&RCC_Clocks);
  SysTick_Config(RCC_Clocks.HCLK_Frequency / 100);
}
Exemplo n.º 10
0
Arquivo: Com.c Projeto: lenfien/MS
/********************************************************************************************
*函数名称:void Delay(u32 nTime)
*
*入口参数:u32 nTime:延时时间
*
*出口参数:无
*
*功能说明:SYSTICK滴答延时配置
*******************************************************************************************/
void Delay(u32 nTime)
{
  SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK_Div8);	//时钟源选择
  SysTick_Config(72000);																//调置产生中断的计数个数

  TimingDelay = nTime;
  while(TimingDelay != 0);
}
Exemplo n.º 11
0
void systick_init(void)
{
	//72MHz / 8 = 9MHz
	SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK_Div8);
	SysTick -> CTRL = 0x02;  //开启SysTick中断
	SysTick -> LOAD = 9000;  //重载值
	systick_value = 0;
	SYSTICK_START
}
Exemplo n.º 12
0
void RCC_Configuration(void)
{
	SystemInit();
	SysTick_CLKSourceConfig( SysTick_CLKSource_HCLK );
	RCC_USBCLKConfig(RCC_USBCLKSource_PLLCLK_1Div5);
	// enable usb 
	RCC_APB1PeriphClockCmd(RCC_APB1Periph_USB, ENABLE);
	RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);
}
Exemplo n.º 13
0
void SysTick_Initial(void)
{
	RCC_ClocksTypeDef RCC_Clocks;
	RCC_GetClocksFreq(&RCC_Clocks);
	
	SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK_Div8);
	factor_us = SystemCoreClock/8000000;
	factor_ms = factor_us * 1000;
}
Exemplo n.º 14
0
/*******************************************************************************
* Function Name  : delay_init
* Description    :  
* Input          : None
* Output         : None
* Return         : None
* Attention		 : 
*******************************************************************************/
void delay_init(void)
{
    RCC_ClocksTypeDef RCC_ClocksStatus;

    RCC_GetClocksFreq(&RCC_ClocksStatus);
    SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK_Div8);
	SysTick_ITConfig(DISABLE);
    delay_fac_us = RCC_ClocksStatus.HCLK_Frequency / 8000000;
    delay_fac_ms = RCC_ClocksStatus.HCLK_Frequency / 8000;      
}
Exemplo n.º 15
0
void SysTick_Configuration(void)
{
	/* Configure HCLK clock as SysTick clock source */
	SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK);
	SysTick_SetReload(72000);
	/* Enable the SysTick Interrupt */
	SysTick_ITConfig(ENABLE);
	/* Enable the SysTick Counter */
	SysTick_CounterCmd(SysTick_Counter_Enable);
}
Exemplo n.º 16
0
void initTimer(void)
{
	SysTick_CounterCmd(SysTick_Counter_Disable);   
     
    SysTick_ITConfig(DISABLE);   
     
	SysTick->LOAD = 9000;
	SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK_Div8);
	SysTick_ITConfig(ENABLE);
}
Exemplo n.º 17
0
//初始化延迟函数
//当使用ucos的时候,此函数会初始化ucos的时钟节拍
//SYSTICK的时钟固定为HCLK时钟的1/8
//SYSCLK:系统时钟
void delay_init(void)	 
{
  
	SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK_Div8);	//选择外部时钟  HCLK/8
	fac_us=SystemCoreClock/8000000;	//为系统时钟的1/8  
	 

	fac_ms=(u16)fac_us*1000;//非ucos下,代表每个ms需要的systick时钟数   

}								    
Exemplo n.º 18
0
/*******************************************************************************
* Function Name  : main.
* Description    : Main routine.
* Input          : None.
* Output         : None.
* Return         : None.
*******************************************************************************/
int main(void)
{
#ifdef DEBUG
    debug();
#endif

    Set_System();
    Set_USBClock();
    USB_Config();
    USB_Init();
    InitialIO();
    InitialADC();

#ifdef  JOYSTICK
    SSD1303_Init();

    InitialSSD1306_controller();
#endif

    InitialProcTask();

    //WaitConfig();

    InitialDevice(&dev,&SSD1303_Prop,SongSmall5_DrawChar);

    SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK);
    SysTick_SetReload(72000000/20);
    SysTick_CounterCmd(SysTick_Counter_Enable);
    SysTick_ITConfig(ENABLE);

    CurrentProcess = JoystickProcess;
    CurrentSystick = JoystickSystick;
    JoystickUIInit();
    void  HidProcess(void);
    while (1)
    {
        HidProcess();
        continue;
        static u8 lastCamOn = 0;
        if(lastCamOn != bCameraOn) {
            if(bCameraOn) {
                CurrentProcess = TetrisProcess;
                CurrentSystick = TetrisSystick;
                TetrisUIInit();
            } else {
                CurrentProcess = JoystickProcess;
                CurrentSystick = JoystickSystick;
                JoystickUIInit();
            }
        }
        lastCamOn = bCameraOn;
        CurrentProcess();
    }
}
Exemplo n.º 19
0
void main(void)
{

    ENTR_CRT_SECTION();
    /* Setup STM32 system (clock, PLL and Flash configuration) */
    SystemInit();

    /* Set the Vector Table base location at 0x08000000 */
    NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x0);
    NVIC_PriorityGroupConfig(NVIC_PriorityGroup_4);

    // SysTick end of count event each 0.5s with input clock equal to 9MHz (HCLK/8, default)
    SysTick_Config(1500000);
    SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK_Div8);

    // Step motor init
    StepMotorInit();
    // I2C1 init
    I2C1_Init();

    EXT_CRT_SECTION();

    // GLCD init
    GLCD_PowerUpInit((pInt8U)IAR_Logo.pPicStream); //(
    GLCD_Backlight(BACKLIGHT_ON);
    GLCD_SetFont(&Terminal_9_12_6,0x000F00,0x00FF0);
    GLCD_SetWindow(10,104,131,131);

    // Init Accl sensor
    if(FALSE == Accl_Init())
    {
        // Initialization fault
        GLCD_TextSetPos(0,0);
        GLCD_print("\fLIS3LV020 Init.\r\nfault\r\n");
        while(1);
    }
    Car_Init();
    while(1)
    {
        A=position();
        /*   A = accX[1];
           B = velX[1];
           C = posX[1]; */

        if(SysTickFl) //
        {
            SysTickFl = FALSE;
            GLCD_TextSetPos(0,0);
            GLCD_print("\f%d Deg\r\n",A);
        }

        GoCar(Test, TestTurn);
    }
}
Exemplo n.º 20
0
/***************************************************************************//**
 * @brief
 *   Configure the SysTick for OS tick.
 *
 * @details
 *
 * @note
 *
 ******************************************************************************/
void  SysTick_Configuration(void)
{
	rt_uint32_t 	core_clock;
	rt_uint32_t 	cnts;

	core_clock = SystemCoreClockGet();
	cnts = core_clock / RT_TICK_PER_SECOND;

	SysTick_Config(cnts);
	SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK);
}
Exemplo n.º 21
0
/** System Clock Configuration
*/
void SystemClock_Config(void)
{
    RCC_ClocksTypeDef System_Clocks;

    /* This part doesn't have an equivalent in the original code,
     * but we NEED this to generate PRECISE 1ms timing function 5Delay_msfor instance)
     */
    RCC_GetClocksFreq(&System_Clocks);
    SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK);
    SysTick_Config(System_Clocks.HCLK_Frequency / 1000); //Interrupt generated every 1000 us = 1ms
}
Exemplo n.º 22
0
/*******************************************************************************
* Function Name  : SysTick_Config
* Description    : Configure a SysTick Base time to 10 ms.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void SysTick_ConfigX(void)
{
  /* Configure HCLK clock as SysTick clock source */
  SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK);

  /* SysTick interrupt each 100 Hz with HCLK equal to 72MHz */
  //SysTick_SetReload(SYSTICK_FREQUENCY);

  /* Enable the SysTick Interrupt */
  //SysTick_ITConfig(ENABLE);
}
Exemplo n.º 23
0
inline void RCC_Configuration(void)
{
	SystemInit();
	SysTick_CLKSourceConfig( SysTick_CLKSource_HCLK );

	// Enable GPIO modules
	RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB | RCC_APB2Periph_USART1 | RCC_APB2Periph_AFIO | RCC_APB2Periph_ADC1 | RCC_APB2Periph_SPI1, ENABLE);
	RCC_AHBPeriphClockCmd(RCC_AHBPeriph_CRC | RCC_AHBPeriph_DMA1, ENABLE);
	RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR | RCC_APB1Periph_BKP, ENABLE);

}
Exemplo n.º 24
0
/**
  * @brief  Configures SysTick to generate an interrupt each 250ms.
  * @param  None
  * @retval None
  */
void SysTick_Configuration(void)
{
  /* SysTick interrupt each 250ms with counter clock equal to (HCLK/8) */
  if (SysTick_Config((SystemCoreClock/8) / 4))
  { 
    /* Capture error */
    while (1);
  }

  /* Select HCLK/8 as SysTick clock source */
  SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK_Div8);
}
Exemplo n.º 25
0
/*******************************************************************************
 * Function Name  : SysTick_Configuration
 * Description    : Configures the SysTick for OS tick.
 * Input          : None
 * Output         : None
 * Return         : None
 *******************************************************************************/
void  SysTick_Configuration(void)
{
	RCC_ClocksTypeDef  rcc_clocks;
	rt_uint32_t         cnts;

	RCC_GetClocksFreq(&rcc_clocks);

	cnts = (rt_uint32_t)rcc_clocks.HCLK_Frequency / RT_TICK_PER_SECOND;

	SysTick_Config(cnts);
	SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK);
}
Exemplo n.º 26
0
/****************************** SysTick_Conf *******************************
* Function Name  : SysTick_Conf
* Description    : SysTick_Conf.
* Input          : None
* Output         : None
* Return         : None
********************************************************************/
void SysTick_Conf(void)
{
	//Zegar SysTick bedzie wynosil 168MHz
	SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK);


	if(SysTick_Config(1680000))	//przerwanie co 1ms - 168MHz/1680000=100Hz => T=10ms
	{
		while(1);
	}

}
Exemplo n.º 27
0
void SPIRIT_INIT(void)
{
  NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x0000);   // Use STM32L1xx_flash.icf
  RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1, ENABLE);
  RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA | RCC_AHBPeriph_GPIOB | RCC_AHBPeriph_GPIOC, ENABLE );
  SdkEvalIdentification();
  SdkStartSysTick();
  SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK);
  SdkEvalLedInit(LED1);
  SdkEvalLedInit(LED2);
  SdkEvalM2SGpioInit(M2S_GPIO_SDN,M2S_MODE_GPIO_OUT);
  SpiritSpiInit();  
  USART1_Init();
  
  SpiritEnterShutdown();
  SpiritExitShutdown();
  
  SpiritManagementIdentificationRFBoard();
  SdkEvalM2SGpioInit(M2S_GPIO_0, M2S_MODE_EXTI_IN);
  
  SdkEvalM2SGpioInterruptCmd(M2S_GPIO_0,0x0F,0x0F,ENABLE);
  SpiritGpioInit(&xGpioIRQ);
  SpiritRadioInit(&xRadioInit);
  SpiritPktBasicInit(&xBasicInit);
  SpiritPktBasicAddressesInit(&xAddressInit);
  SpiritIrqDeInit(&xIrqStatus);
   SpiritIrq(RX_DATA_DISC, S_ENABLE);
   SpiritIrq(RX_DATA_READY, S_ENABLE);  // testy dla odbioru komend !!!!!
  SpiritIrq(TX_DATA_SENT, S_ENABLE);
  SpiritIrq(TX_FIFO_ERROR, S_ENABLE);
  
  // Declare Length of Payload
  SpiritPktBasicSetPayloadLength(PAYLOAD_LENGTH);
  
  SpiritQiSetSqiThreshold(SQI_TH_0);
  SpiritQiSqiCheck(S_ENABLE); 
  SpiritIrqClearStatus();
  
 // SET_INFINITE_RX_TIMEOUT();
  SpiritTimerSetRxTimeoutMs(RX_TIMEOUT);
  //SpiritTimerSetRxTimeoutStopCondition(TIMEOUT_ALWAYS_STOPPED);
  SpiritTimerSetRxTimeoutStopCondition(SQI_ABOVE_THRESHOLD);
  
  SpiritIrqClearStatus();
  //USART_Conf();
  
  //*** For test purposes only: create unsigned, 16-bit counter
  vectcTxBuff[0] = 0;   // Clear Counter to overwrite initial values
  vectcTxBuff[1] = 0;
  SdkDelayMs(2000);  //wait till the tested board FW active
 // IWDG_Init();      // let the dogs out,
}
Exemplo n.º 28
0
void eBoxInit(void)
{
	SysTick_Config(SysTickOverFlowValue);//  每隔 (nhz/9,000,000)s产生一次中断
	SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK_Div8);//9Mhz的systemticks clock;
	Init_ADC1();
	
	NVIC_PriorityGroupConfig(NVIC_GROUP_CONFIG);

	//将pb4默认设置为IO口,仅用jtag
	RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO,ENABLE);
	 GPIO_PinRemapConfig(GPIO_Remap_SWJ_JTAGDisable,ENABLE);

}
Exemplo n.º 29
0
static void prvSetupHardware( void )
{
	/* Enable GPIOA, GPIOB, GPIOC, GPIOD, GPIOE and AFIO clocks */
	RCC_APB2PeriphClockCmd(	RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB |RCC_APB2Periph_GPIOC
							| RCC_APB2Periph_GPIOD | RCC_APB2Periph_GPIOE | RCC_APB2Periph_AFIO, ENABLE );

	/* Set the Vector Table base address at 0x08000000 */
	NVIC_SetVectorTable( NVIC_VectTab_FLASH, 0x0 );

	NVIC_PriorityGroupConfig( NVIC_PriorityGroup_4 );

	/* Configure HCLK clock as SysTick clock source. */
	SysTick_CLKSourceConfig( SysTick_CLKSource_HCLK );
}
Exemplo n.º 30
0
/*******************************************************************************
* Function Name  : SysTick_Configuration
* Description    : Configures the SysTick to generate an interrupt each 1 millisecond.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void SysTick_Configuration(void)
{
  /* Select AHB clock(HCLK) as SysTick clock source */
  SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK);

  /* Set SysTick Priority to 3 */
  NVIC_SystemHandlerPriorityConfig(SystemHandler_SysTick, 3, 0);
   
  /* SysTick interrupt each 1ms with HCLK equal to 72MHz */
  SysTick_SetReload(72000);

  /* Enable the SysTick Interrupt */
  SysTick_ITConfig(ENABLE);
}