我直接使用原子的探索者F4资料的例程,讲ucosii复制到我建立的项目里,我的板子硬件是STM32F407VET6,外接晶振24M,已经将stm32f4xx.h中的“HSE_VALUE”改为24000000,system_stm32f4xx.c 中“#define PLL_M” 改为24,代码如下
[mw_shl_code=c,true]#if !defined (HSE_VALUE)
#define HSE_VALUE ((uint32_t)24000000) /*!< Value of the External oscillator in Hz */
#endif /* HSE_VALUE */[/mw_shl_code]
[mw_shl_code=c,true]#if defined (STM32F40_41xxx) || defined (STM32F427_437xx) || defined (STM32F429_439xx) || defined (STM32F401xx)
/* PLL_VCO = (HSE_VALUE or HSI_VALUE / PLL_M) * PLL_N */
#define PLL_M 24
#else /* STM32F411xE */
#if defined (USE_HSE_BYPASS)
#define PLL_M 24
#else /* STM32F411xE */
#define PLL_M 16
#endif /* USE_HSE_BYPASS */
#endif /* STM32F40_41xxx || STM32F427_437xx || STM32F429_439xx || STM32F401xx */ [/mw_shl_code]
[mw_shl_code=c,true]主函数为
[mw_shl_code=c,true]void start_task(void *pdata)
{
OS_CPU_SR cpu_sr=0;
pdata = pdata;
OS_ENTER_CRITICAL(); //???????????¨??·¨±??????ò???©
OSTaskCreate(led0_task,(void *)0,(OS_STK*)&LED0_TASK_STK[LED0_STK_SIZE-1],LED0_TASK_PRIO);
OSTaskCreate(led1_task,(void *)0,(OS_STK*)&LED1_TASK_STK[LED1_STK_SIZE-1],LED1_TASK_PRIO);
OSTaskSuspend(START_TASK_PRIO); //????????????
OS_EXIT_CRITICAL(); //???????????¨????±??????ò???©
}
//LED0????
void led0_task(void *pdata)
{
while(1)
{
LED0=0;
delay_ms(80);
LED0=1;
delay_ms(920);
};
}
//LED1????
void led1_task(void *pdata)
{
while(1)
{
LED1=0;
delay_ms(300);
LED1=1;
delay_ms(300);
};
}[/mw_shl_code]
运行情况是LED0直接常亮,没有按照程序规定的开始闪烁,LED1不亮,求助是移植没有成功?还是线程没有运行?[/mw_shl_code]
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
一周热门 更多>