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/F28M36H53C2: Cannot run statically declared timer ISR with "user" start mode.

Part Number: F28M36H53C2
Other Parts Discussed in Thread: SYSBIOS

Tool/software: TI-RTOS

Hi there,

I am having some trouble to to execute a timer ISR when the start mode is defined as USER. It works fine when it is set to automatic. 

Here is my static configuration file:

var ti_sysbios_family_arm_l3_Timer0Params = new ti_sysbios_family_arm_lm3_Timer.Params();

ti_sysbios_family_arm_lm3_Timer0Params.instance.name = "timerHandle";

ti_sysbios_family_arm_lm3_Timer0Params.period = 100000;

ti_sysbios_family_arm_lm3_Timer0Params.startMode = xdc.module("ti.sysbios.interfaces.ITimer").StartMode_USER;

Program.global.timerHandle = ti_sysbios_family_arm_lm3_Timer.create(-1, "&timer_ISR", ti_sysbios_family_arm_lm3_Timer0Params);

 

In my application:

 

extern Timer_Handle timerHandle;

...

void main(void){

...

IntMasterEnable();

IntEnable(INT_TIMER0A);

...

}

 

void myTask(void){

while(1){

if(something){

Timer_setPeriodMicroSecs(timerHandle, 100000);

Timer_start(timerHandle);

}

}

Any thoughts ? Thanks.

Configuration : TI-RTOS 2.16.01.14

  • Cedric 40627 said:
    var ti_sysbios_family_arm_l3_Timer0Params = new ti_sysbios_family_arm_lm3_Timer.Params();

    Cedric 40627 said:
    Program.global.timerHandle = ti_sysbios_family_arm_lm3_Timer.create(-1, "&timer_ISR", ti_sysbios_family_arm_lm3_Timer0Params);

    Is it as simple as a typo?  Your var declaration has 'l3' but then all your subsequent statements use 'lm3'.

    Regards,

    - Rob

  • Yes this is a typo... The compilation works fine and it also works when the run mode is  automatic start. 

  • Yes, I knew it was a typo, but did fixing it cause the problem to be resolved? I'm assuming not based on your response, but I need to be sure.

    Regards,

    - Rob
  • Sorry I wasn't clear it was a typo in the forum, not the code.
  • This code from your initial post seems suspicious:

    void main(void){

    ...

    IntMasterEnable();

    IntEnable(INT_TIMER0A);

    ...

    }

    I don't know where those "Int*" functions come from, but when using SYS/BIOS you should be letting SYS/BIOS enable interrupts (both individual ones and global enable).  SYS/BIOS will do those things upon calling BIOS_start() from main().

    Also, you have this in your task:

    Timer_setPeriodMicroSecs(timerHandle, 100000);

    But you also set the period to 100000 in your .cfg, so you shouldn't need to do it at run-time (but I don't know that it is a bad thing to do, just pointing it out as unnecessary).

    Please remove the "Int*" calls from main() and perhaps comment out the above Timer call and let us know.  In the meantime I will try to discover possible issues.

    Regards,

    - Rob

  • Hi Rob,

    Thank you for your help and your time, I really appreciate it.

    I originally used IntMasterEnable() because I was working on the IPC support. I removed Int* calls as you mentioned but the problem persists.

    The reason I call Timer_setPeriodMicroSecs() is that I want to adjust how frequently I fire the timer hwi based on different events. For troubleshooting sake, I just put a hard coded value.

    What is puzzling me is that it works when the runmode is in automatic. The Timer_start() is called but nothing happens after that so I suspect it might be an interrupt or clocking configuration problem...

    I have attached the state of the handler after I call the function Timer_Start().

  • Everything looks OK in your screenshot.

    I'm wondering about your original code, though.  You posted this pseudo-code:

    void myTask(void){

    while(1){

    if(something){

    Timer_setPeriodMicroSecs(timerHandle, 100000);

    Timer_start(timerHandle);

    }

    }

    I don't know what "something" is, but is it possible that you're looping back to Timer_start() before the period has expired from the original Timer_start()?

    I believe that calling Timer_start() a 2nd time before the 1st one has expired will reset it back to 0.

    Regards,

    - Rob

  • The calls to setPeriod and start are only called once. When I set the runmode to auto, I have "irp" set to 0x00208130 whereas in manual mode, it is set to 0x00000. I am not sure what this register is used for but since hwi interrupt is not firing up I thought it might be symptomatic to the problem ? 

  • I replaced the timer module by the clock module and it is working. I call the same set of functions Clock_setPeriod() and Clock_start(). Very odd.
  • Cedric 40627 said:
    I replaced the timer module by the clock module and it is working. I call the same set of functions Clock_setPeriod() and Clock_start(). Very odd.

    I'm wondering if you're satisfied with using Clock instead, then.  Would you still like me to help figure out why the Timer is not working in user start mode?

    Regards,

    - Rob

  • Well, I can make it with the clock module but I think it is highly suspicious that the timer would not work.

    When I create a timer from the configurator, I clicked on "Device-specific Timer Support" . I think this is correct as it works in automatic. Also, I use NDK module, could it be any possible interaction between the driver and the timer module ?

  • Cedric 40627 said:
    Well, I can make it with the clock module but I think it is highly suspicious that the timer would not work

    Agreed.

    Can you inspect things with ROV in CCS?

    ROV is under the Tools menu in the CCS Debug perspective.

    If you can open ROV for the USER start mode case, you should be able to see the Timer that you created and the Hwi that was created for that timer.  See if things look as you would expect.  Feel free to post screen shots in a reply.

    Cedric 40627 said:
    When I create a timer from the configurator, I clicked on "Device-specific Timer Support" . I think this is correct as it works in automatic

    Yes, that is correct.

    Cedric 40627 said:
    Also, I use NDK module, could it be any possible interaction between the driver and the timer module ?

    If the only difference between the working case and the non-working case is a change from AUTO start to USER start, then I wouldn't expect NDK to be a problem since if it was interfering then it would interfere either way.

    Regards,

    - Rob