uC/OS-II V2.92 调试Led闪烁时间有问题?
[复制链接]
while (DEF_TRUE) { /* Task body, always written as an infinite loop. */ //BSP_LED_Toggle(0); OSTimeDlyHMSM(0, 0, 0, 500); GPIO_SetBits(GPIOE,GPIO_Pin_3); OSTimeDlyHMSM(0, 0, 0, 500); GPIO_ResetBits(GPIOE,GPIO_Pin_3); }
移植到STM32的是uC/OS官网的uC/OS-II V2.92,程序设置Led闪烁1s一次,但是实际调试的时候,Led闪烁的时间是2s一次。给出源代码,希望大家看看是什么问题? cpu时钟获取: CPU_INT32U BSP_CPU_ClkFreq (void) { RCC_ClocksTypeDef rcc_clocks;
RCC_GetClocksFreq(&rcc_clocks);
return ((CPU_INT32U)rcc_clocks.HCLK_Frequency); } 设置SysTick时钟滴答重载值: hclk_freq = BSP_CPU_ClkFreq(); /* Determine SysTick reference freq. */ cnts = hclk_freq / (CPU_INT32U)OS_TICKS_PER_SEC; /* Determine nbr SysTick increments in OS_TICKS_PER_SEC. */ OS_CPU_SysTickInit(cnts); 初始化SsyTick函数及开中断: void OS_CPU_SysTickInit (INT32U cnts) { OS_CPU_CM3_NVIC_ST_RELOAD = cnts - 1u; /* Set prio of SysTick handler to min prio. */ OS_CPU_CM3_NVIC_PRIO_ST = OS_CPU_CM3_NVIC_PRIO_MIN; /* Enable timer. */ OS_CPU_CM3_NVIC_ST_CTRL |= OS_CPU_CM3_NVIC_ST_CTRL_CLK_SRC | OS_CPU_CM3_NVIC_ST_CTRL_ENABLE; /* Enable timer interrupt. */ OS_CPU_CM3_NVIC_ST_CTRL |= OS_CPU_CM3_NVIC_ST_CTRL_INTEN; } 我移植uC/OS-II V2.86的版本,没有什么问题,只是V2.92是针对F107评估板的,但是它和F103在时钟模块应该没啥区别啊,初始化RCC后均为72MHz,求学习交流!
|