This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

EVM L137 crash when using TSK_sleep()

My application is based on the audio_edma_c6747 demo project. I want to use a task to scan I/O for user interface keys. I have created a task using the DSP/BIOS config as below. But when I enable the clock:  bios.CLK.RESETTIMER = 1;  and try to sleep the task TSK_sleep(1000); the code crashes after about 4 seconds! Am I missing something or doing something wrong. If I keep a simple counter in the tsk instead of using the sleep function, it seems to work. But anything I do using the ticks ie:TSK_sleep() or TSK_time() Causes the crash ....

 

Any ideas.... thanks

------------------------------
bios.TSK.create("Keyscan_tsk");
bios.TSK.instance("Keyscan_tsk").order = 2;
bios.TSK.instance("Keyscan_tsk").priority = 1;
bios.TSK.instance("Keyscan_tsk").fxn = prog.extern("Keyscan_tsk_fxn");

bios.PRD.OBJMEMSEG = prog.get("IRAM");
bios.TSK.DRIVETSKTICK = "PRD";
bios.PRD.USECLK = 1;
bios.GBL.CLKIN = 24000;
bios.CLK.RESETTIMER = 1;

--------------------------------

My test task looks like:

 

static void io_run(void)
{

    static int ledState = 0;
    static Uns ticks = 0;

   while (1)
   {
       TSK_sleep(1000); //sleep for 1 sec at 60mHz

       if (ledState)
              EVM_LED_on ( 0 );
       elsE
             EVM_LED_off ( 0 );

       ledState ^= 0x01;
   }
}

//-----------------------------------------------------------------------------
// Static TSK Function
//-----------------------------------------------------------------------------

int Keyscan_tsk_fxn()
{
    io_run();
    return 0;
}