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.

Problem with tasks switch after porting to SYS/BIOS

Other Parts Discussed in Thread: SYSBIOS

Hi everybody,

I have a project for TI DM6435 using DSP/Bios 5 and I am about porting it to SYS/BIOS. As a first step, I used the conversion tool to create a cfg-file and a platform from my old tcf-file. I created a new CCS4-project and recompiled the code, which worked fine after some small changes. But running the code on DSP does not work correctly. It seems, there is a problem with the task switch.

I have several task that are initialized statically. I see that the system starts them correctly and that they run until they go to sleep, e.g. at a mailbox or a mutex. But when one task waits for another, hangs forever. There never seems to be a task switch. On Bios5 this worked fine. What went wrong during conversion?

One assumption is, that there is a problem with the system timer. The cfg-file contains the following entries:

bios.GBL.CLKOUT = 600.0000;
bios.CLK.INPUTCLK = 25.0000;
bios.CLK.TIMERSELECT = "Timer 0";
bios.CLK.RESETTIMER = true;

The compiler prints out a warning "bios.CLK.INPUTCLK not supprted".

Thanks for your help!
Tobias

  • Tobias,

    "bios.CLK.INPUTCLK is not supprted for BIOS 6", however, if you know which physical Timer is being used by BIOS you can set it through the Timer module.

    var Timer = xdc.useModule("ti.sysbios.timers.timer64.Timer");
    Timer.intFreqs[x].lo = 25.0;                // Change x to whichever Timer is being used.

    If a task is waiting on a Mailbox, once its posted the task should run.  Could you be more specific like what's going on in the system?  Are all tasks blocked? Is your Clock running?

    Judah

  • Judah,

    ok, I corrected the timer configuration as you proposed but nothing changed. If I look at the timer registers in memory view, I see that the timer is running. I checked the value returned by CLK_getltime(). It is running much too slow, about one tick in two seconds. Something seems wrong.

    This is the configuration:

    var Clock = xdc.useModule('ti.sysbios.knl.Clock');
    var Timer = xdc.useModule('ti.sysbios.timers.timer64.Timer');
    Clock.tickSource = Clock.TickSource_TIMER;
    Timer.intFreqs[0].lo = 25000000;
    Clock.timerId = 0;

    There is one warning:

    ti.bios.CLK : Cannot change ti.sysbios.knl.Clock.timerId. Parameter changed elsewhere

    What's going on in the system:

    There are several worker tasks (high priority) and one init task (low priority). Each worker tasks should start running at a certain point of the init task, so I synchronize them using mailboxes. All tasks are configured statically. I see that all tasks are started by the system correctly. The worker tasks run until they go to sleep at the mailbox. The init task finally starts, posts the mailbox and sleeps in a loop until the worker task woke up and signalized that it is running. But this never happens.

    This is the simplified code:

    static bool s_stateReady = false;
    static MBX_Handle s_mailbox;
    void worker_task_run()
    {
        unsigned int msg;
        s_mailbox = MBX_create(4, 1, 0L);
        MBX_pend(s_mailbox, &msg, SYS_FOREVER);
        s_stateReady = true;
        ...
    }
    void init_task_run()
    {
        ...
        MBX_post(s_mailbox, 0, 0);
       
        while (!s_stateReady) {        // this never happens, loops endless
            TSK_sleep(10MS);
        }
        ...
    }

    Thanks in advance for your help

    Tobias

  • Can you post a screen shot of the Timer registers in memory?

    If things are running too slow that could explain why your TSK_sleep never returns.

    Judah

  • Here is the screenshot of the timer 0 registers.

    But it's not the case, that TSK_sleep() never returns. It does return but the loop runs endless since the worker thread does not wake up on the mailbox.

    Tobias

  • Tobias,

    When you do a Mailbox_post() the first time do any of the worker tasks wake up?

    I presume you are doing multiple Mailbox_post() and all the worker tasks are block on the same Mailbox?

    Also you could use ROV to view why the threads are not waking up.

    Judah

  • No, none of the tasks wakes up. And of course there is an array of mailboxes, one for each worker task. I only simplified the code to better understand what's going on.

    I did not get ROV working yet, most modules say something like "ROV failed to load the module ti.sysbios.knl.Mailbox" although the path is set and the project compiles without errors.

    Any other ideas?

    Thanks

    Tobias

  • Tobias,

    I can't think of what else it can be.  If you have ROV working it might help in the debug but really I have no other suggestion if Mailbox_post is not working.

    Judah