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 using PRD

hi,

I am using EVMC6747_XDS510USB , CCS v3.3 and BIOS 5.33.05.

Now i want to use PRD and have done the follow steps.

1. Edit the .tcf file

bios.PRD.create("myPrd");
bios.PRD.instance("myPrd").fxn = prog.extern("PrdFxn");
bios.PRD.instance("myPrd").order = 1; 
bios.PRD.instance("myPrd").period = 1000;

2. Add PRD function

void PrdFxn(Void)
{
 counter++
}

The problem is when i run the program, the PrdFxn is never called.

Is there anything other that i have to set? Such as HWI or SWI.

In my program, i have created some tasks, has it influence to PRD?

thanks!

  • Hi rookie,

    I should work like that. I just tested and it did. Can you add a PRD to one of the provided examples and test it?

    The TSK has lower priority than the PRD, so it does not influence it.

    Make sure that you when you right click on the PRD - Periodic Function Manager and select Properties you have "Use CLK Manager to drive PRD":

     

     

  • In addition to Mariana's suggestion (which I suggest you try first [:)]) are you using the optimizer? If so the optimizer could be optimizing out the contents of that function. Are you placing a breakpoint in the function which is never hit?

    Otherwise you might want to look at how the CLK Manager is configured. If it is configured to use Timer1 (default) and your project is reconfiguring Timer1 this could be an issue. The Microseconds/Int is also important this this changes how frequently the timer interrupt occurs.

    It is really hard to tell why your PrdFxn is never called without having enough to reproduce the issue. I wrote up a test project using your PRD configuration and nothing else and I am able to see counter increment. I am sure you are almost there, but any other details you have would be useful.

  • Thanks for your applies. I have found the reason.

    In main function I have called the function USTIMER_init() of the BSL evmc6748_timer.h.

    And USTIMER_init disabled the timer0,1 interrupts.

    PRD works when i enable the timer interrupts.

    Now the question is why it has to disable timer interrupts in USTIMER_init?

    thanks