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.

RTOS/PROCESSOR-SDK-AM335X: Sleep doesn't work

Part Number: PROCESSOR-SDK-AM335X


Tool/software: TI-RTOS

Hello,

Right out of the box, the "New Project" code that is generated by CCS and Sys/Bios  TI-RTOS creates a "task".  With a "Task_sleep(10)" in it.  Which blocks and never returns.  The code is simply this:

/*
 *  ======== main.c ========
 */

#include <xdc/std.h>

#include <xdc/runtime/Error.h>
#include <xdc/runtime/System.h>

#include <ti/sysbios/BIOS.h>

#include <ti/sysbios/knl/Task.h>

/*
 *  ======== taskFxn ========
 */
Void taskFxn(UArg a0, UArg a1)
{
    System_printf("enter taskFxn()\n");

    Task_sleep(10);

    System_printf("exit taskFxn()\n");

    System_flush(); /* force SysMin output to console */
}

/*
 *  ======== main ========
 */
Int main()
{ 
    Task_Handle task;
    Error_Block eb;

    System_printf("enter main()\n");

    Error_init(&eb);
    task = Task_create(taskFxn, NULL, &eb);
    if (task == NULL) {
        System_printf("Task_create() failed!\n");
        BIOS_exit(0);
    }

    BIOS_start();    /* does not return */
    return(0);
}

I have three different  projects, all autogenerated from CCS 7.2 and built with either GNU 4.9.3, GNU 6.3.1 or TI 16.9.3.  Not one of them works.  They use SYS/BIOS 6.46.5.55

I place a break point right after the "Task_sleep(10)" but it is never reached it.  When I place a break point before "Task_sleep(10)" and step into it, it never returns.

So I looked into the BeagleBone Black "blink" example.  It doesn't use that call.  it uses "while(...) " loop to delay.  I guess whoever created the example, must have known it was broken.

My searches have yeilded people from 4 years ago with problems.  None of which seems to apply to the current environment.

( All this started when I discovered I had to import a couple StarterWare projects for USB because they were removed from the new SYS/BIOS  TI-RTOS.  Deep down in there, there is a "Sysdelay()" function, which also doesn't work.  I have stepped deep into the code, and see it is using Timer7, but the interrupt never fires despite the appearance that everything is configured correctly.  )

Any idea why the "out of the box" samples are broken?  Or more importantly, why this simple function is broken?  I'd post my entire project, but anyone can duplicate it simply by creating a new "typical"  "Sys/Bios" new project.

-CSW

  • Should anyone desire to test this out, I have attached the project.  Straight out of CCS 7.2

    BasicTiSleep.zip

  • Update... It appears to be working.

    But here is some advice:

    ***  Do Not EVER try to use the debugger to "step over" a "Task_sleep()" in a Sitara or BeagleBone project. ***

    Apparently I can place a break point after the Task_sleep and it will reach that breakpoint.  But I can't put a breakpoint at the function, and step over it.  It just freezes and blocks.  Trying to pause just takes the debugger into deep space somewhere.  

    I repeated the exact same test using a TM4C1294XL board, and I can step over the Task_sleep() without any difficulty.  So whatever this issue it in debugging, it appears to only apply to BBB (or Sitara in general).

    Regarding my statement "I place a break point right after the "Task_sleep(10)" but it is never reached it."...  It would appear the breakpoint was disabled, even though it didn't appear that way.

    That was a wasted day and a half trying to figure out why something appears broken, when it wasn't.

    -CSW

  • Thanks for updating the thread.