AnsweredAssumed Answered

Issue with _time_delay() with MQX on K22F

Question asked by Jacques Dumarest on Mar 26, 2015
Latest reply on Apr 2, 2015 by Jacques Dumarest

I made a simple program using MQX for FRDM K22F board (Using Kinetis Design Studio), and wanted to have the RGB LED blinking. I wanted to use _time_delay() function to define the LED blinking frequence, but it failed. I found that once I use _time_delay() the code after this instruction is never executed.

Here is my simple program to test _time_delay:

 

 

#include <stdio.h>

#include <mqx.h>

#include <bsp.h>

 

/* Task IDs */

#define INIT_TASK 5

 

extern void init_task(uint32_t);

 

const TASK_TEMPLATE_STRUCT MQX_template_list[] =

{

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

 

       {INIT_TASK, init_task, 1500, 9, "init", MQX_AUTO_START_TASK, 0, 0},

       {0, 0, 0, 0, 0, 0, 0, 0}

};

 

/*TASK*-----------------------------------------------------

*

* Task Name : init_task

* Comments :

* This task init stuff and then prints "Hello World ".

*

*END*-----------------------------------------------------*/

void init_task (uint32_t initial_data)

{

       printf("Hello World\n");

 

       printf("before\n");

_time_delay(0);

       printf("after\n");

}


I get both “before” and “after” sent to the hyper terminal, but if I change the time_delay to a non zero value: _time_delay(1); “after” is never printed?

 

Any idea of what I am doing wrong?

 

Thanks for your support

Outcomes