ucosii系统化移植到stm32f103RDt6上,总是在空闲任务中运行,后发现无法进入SysTick中断:
void SysTick_Handler(void)
{
OSIntEnter();
OSTimeTick();
// OS_Sched();
OSIntExit();
}
//以下是系统时钟和嘀嗒定时器的配置
void RCC_Configuration(void)
{
ErrorStatus HSEStartUpStatus;
/* RCC system reset(for debug purpose) */
RCC_DeInit();
/* Enable HSE */
RCC_HSEConfig(RCC_HSE_ON);
/* Wait till HSE is ready */
HSEStartUpStatus = RCC_WaitForHSEStartUp();
if(HSEStartUpStatus == SUCCESS){
/* HCLK = SYSCLK */
RCC_HCLKConfig(RCC_SYSCLK_Div1);
/* PCLK2 = HCLK */
RCC_PCLK2Config(RCC_HCLK_Div1);
/* PCLK1 = HCLK/2 */
RCC_PCLK1Config(RCC_HCLK_Div2);
/* Flash 2 wait state */
FLASH_SetLatency(FLASH_Latency_2);
/* Enable Prefetch Buffer */
FLASH_PrefetchBufferCmd(FLASH_PrefetchBuffer_Enable);
/* PLLCLK = 8MHz * 8 = 64 MHz */
RCC_PLLConfig(RCC_PLLSource_HSE_Div1, RCC_PLLMul_8);
/* 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 peripheral clocks --------------------------------------------------*/
/* GPIOA, GPIOB clock enable */
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA //
| RCC_APB2Periph_GPIOB //
| RCC_APB2Periph_GPIOC //
| RCC_APB2Periph_GPIOD //2008-5-14 10:26
| RCC_APB2Periph_GPIOE //
| RCC_APB2Periph_USART1//
| RCC_APB2Periph_AFIO //2008-5-14 10:26
, ENABLE);
/* Enable USART2 、USART3 clock */
RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART2//
|RCC_APB1Periph_USART3
, ENABLE);
/* SysTick event each 1ms with input clock equal to 64MHz (64*100.00) */
SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK);
SysTick_SetReload((INT_TIME*SYS_CLK)/INT_TM_COEFFICIENT);
/* Enable SysTick interrupt */
SysTick_ITConfig(ENABLE);
/*Enable LSI clock*/
RCC_LSICmd(ENABLE); //add20120524
while(RCC_GetFlagStatus(RCC_FLAG_LSIRDY) == RESET) {}
if (RCC_GetFlagStatus(RCC_FLAG_PORRST) != RESET)
{
//这是上电复位
}
else if (RCC_GetFlagStatus(RCC_FLAG_PINRST) != RESET)
{
//这是外部RST管脚复位
}
else if(RCC_GetFlagStatus(RCC_FLAG_IWDGRST) != RESET)
{
//这是独立看门狗IWDG复位
}
RCC_ClearFlag();//清除复位标志
}
}
请求各位指点迷津!!! |