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.

SYSBIOS CPU load measurement Target: C2000 F28335 : User call back "Load.postUpdate" not always call by SYSBIOS

Other Parts Discussed in Thread: SYSBIOS


Hi,

In my project I want to measure the CPU load of my system using the SYSBIOS feature CPU load.

I am using:  bios_6_35_04_50

And my target is: C2000 F28335

My sysbios settings:

Load.hwiEnabled = true;
Load.swiEnabled = true;
Load.taskEnabled = false;
Idle.idleFxns[0] = "&my_idle_function_1";
Load.windowInMs = 200;
Load.postUpdate = "&cpuload_callback";



My main:
void main(void)
{
...

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


In the cpuload_callback function, is called the "my_sysbios_getCPULoad" function.


// Return the CPU load (time window of CPU load evaluation by default set to 200ms)
UInt32_t my_sysbios_getCPULoad(void)
{
  UInt32_t cpu_load;

  cpu_load = Load_getCPULoad();
  return(cpu_load);
}


When I load the program with the JTAG, it works ie:
* the callback function is called by SYSBIOS and the value of CPU load returned by "Load_getCPULoad" is correct.
* on my system this CPU value is sent by CAN and is deplayed on a PC

When I power OFF power ON, the board, the value on the PC is 0.
When I connect the target with the JTAG, I can see that SYSBIOS does not call the callback function and  the value of CPU load returned by "Load_getCPULoad" is Not correct (always 0).
In this state if I do with CCS: Menu Run-> Restart CPU, then Run then all is working properly.

Do you know where may come from the issue?
What do you have to check regarding SYSBIOS settings when it is not working? I can connect to the target and check some SYSBIOS variables ?

Thanks for your help

Regards,

Mathieu


 

  • Mathieu,

    This sounds like CCS is initializing or doing something that is causing your program to work through the debugger.
    Is there a gel file that is setting up the board somehow?

    Judah

  • Hi Judah,

    Thanks for your reply.

    I checked the gel file. It is the standard: C:\ti\ccsv5\ccs_base\emulation\gel.

    I do not see why there is this behavior.

    Is there something to check in the SYS BIOS variables to know why the call back is not called whereas the user idle function is called ?

    Thanks and best regards,

    Mathieu

  • No, not that I am aware of.

    Can you attach your project here so I can try on my end? Or maybe even just the executable if you can't do the whole project?

    Judah
  • Hi Judah,

    Sorry for the delay and thanks for the answer.

    I find the issue but I do not know exactly what it is safe to do.

    The issue is that the "CPU Load"  module is using the Timer 2 (Timer 0 et 1 are used for other stuff).

    However the Period of this timer does not seem to be set by SYS BIOS. Not also that the associated clock is not enable also ().

    To fix the issue I needed to set the following in the main function and before calling:   BIOS_start(); 

        SysCtrlRegs.

    PCLKCR3.bit.CPUTIMER2ENCLK = 1; // CPU Timer 2

    CpuTimer2Regs.

    PRD.all = 0xFFFFFFFF;

        EDIS;

    I read the document "Boot Sequence with SYS/BIOS"    processors.wiki.ti.com/.../BIOS_for_the_28x

    It is indicated:

    "

    5) As the last phase of the startup process, BIOS_start() must be called at the end of main(). Note that once SYS/BIOS is "started

    ..

    5c. Initialize any Timers that have been configured for the application

    "

    However I checked the SYSBIOS code:

    " Void ti_sysbios_BIOS_startFunc__I()

    {

      ..

      ti_sysbios_hal_Timer_startup();

    }

    And it looks like that there is no timer of the C2000 processor that is set.

     

    Could you clarify what has to be done by the user when he wants to use the CPU Load module ? and what is done by SYSBIOS ?

     

    Thanks for your help

    Regards,

    Mathieu