AnsweredAssumed Answered

MQX _time_get_hwticks_per_tick() and _time_get_ticks_per_sec()

Question asked by Rainer Stillhard on Jun 16, 2016
Latest reply on Jul 20, 2016 by Rainer Stillhard

Hello

I have a problem when i use:

_time_get_hwticks_per_tick()

and directly after the function:

_time_get_ticks_per_sec()

MQX doesn't start anymore. It works well, when i omit one of the two functions. Which one is equal.

The debugger then never reaches the main task when i call both functions.

I had tried with _time_delay() between these two functions, but without any success.

I hope somone has an answer. Thanks

 

My configuration is:

MQX 4.2   

VYBRID VF61

IAR 7.6

 

Here is my minimal project file:

 

#include <mqx.h>

#include <bsp.h>

#include <Mutex.h>

//---------------------------------------------------------------------------------------

// Task IDs

#define MAIN_TASK   1

#define MAIN_IDLE  10

#define RS485_TASK  4

extern void Main_task(unsigned int);

extern void RS_485Task(unsigned int);

//---------------------------------------------------------------------------------------

void MyIdleTask(unsigned int temp)

//---------------------------------------------------------------------------------------

{

   while (1)

   {

      _time_delay(100);

   }

}

//---------------------------------------------------------------------------------------

const TASK_TEMPLATE_STRUCT  MQX_template_list[] =

{

   /* Task Index,   Function,      Stack,  Priority,   Name,   Attributes,          Param, Time Slice */

    { MAIN_IDLE,    MyIdleTask,     500,    13,         "MyIdle",    MQX_AUTO_START_TASK, 0,   0 },

    { MAIN_TASK,    Main_task,     5000,    10,         "main",      MQX_AUTO_START_TASK, 0,   0 },

    { RS485_TASK,   RS_485Task,    5000,     3,         "RS-485",    MQX_AUTO_START_TASK, 0,   0 },

    { 0 }

};

#define TICK_MS  (50)  // Tickintervall in ms

//---------------------------------------------------------------------------------------

void Main_task(unsigned int initial_data)

//---------------------------------------------------------------------------------------

{

   static MQX_TICK_STRUCT  tick_time_m;

   MQX_TICK_STRUCT_PTR ptr = &tick_time_m;

   uint32_t  ttt= _time_get_hwticks_per_tick();

   /*_time_delay(3000);*/

   _mqx_uint tt = _time_get_ticks_per_sec();

   /*_time_delay(3000);*/

   while(1)

   {

      _time_delay(100);

      _time_add_msec_to_ticks(ptr, 50); 

      _time_delay_until(ptr);     

   }

}

//--------------------------------------------------------------------------------------

//---------------------------------------------------------------------------------------

void RS_485Task(unsigned int temp)

//---------------------------------------------------------------------------------------

{

   while(1)

   {

      _time_delay(100);

   }

}

Outcomes