AnsweredAssumed Answered

Timer component  problem

Question asked by Cathy chang on May 31, 2012
Latest reply on Nov 15, 2012 by David E Seymour

hi all,

   I'm a beginner for MQX ,i want to get your helps.

   

when  I used the function ipcfg_init_device for ethernet , then created timer component(_timer_create_component()),there is a problem about this timer component---Dont call the callback function (SendCommad Function or RecCommand Function)  in  _timer_start_periodic_at_ticks().

  _timer_create_component(TIMER_TASK_PRIORITY, TIMER_STACK_SIZE);      _time_init_ticks(&dticks, 0);   _time_add_sec_to_ticks(&dticks, 2);   _time_get_elapsed_ticks(&ticks);   _time_add_sec_to_ticks(&ticks, 1);   on_timer = _timer_start_periodic_at_ticks(SendCommand, 0,TIMER_ELAPSED_TIME_MODE, &ticks, &dticks);   _time_add_sec_to_ticks(&ticks, 1);   off_timer = _timer_start_periodic_at_ticks(RecCommand, 0,TIMER_ELAPSED_TIME_MODE, &ticks, &dticks);   _time_delay(time * 1000); // wait 6 seconds   write(FileHandle_Uart0,"\nThe task is finished!",22);   _timer_cancel(on_timer);   _timer_cancel(off_timer);

     In debug mode ,found that the below condition (timer_component_ptr->VALID )is be meet, it means the timer component is invalid. 

 

   the below code is located in _timer_start_periodic_at_internal function (mqx\source\timer\Ti_spati.c)

#if MQX_CHECK_VALIDITY   if(timer_component_ptr->VALID != TIMER_VALID) {      _task_set_error(MQX_INVALID_COMPONENT_BASE);      return TIMER_NULL_ID;   } /* Endif */#endif

     I dont know what caused the issue, what should i do for using timer component in my project ?

    Wait for your reply,Thanks!


    PS:i used MQX3.8 for MCF5225xEvb board.

Outcomes