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.

How to reset PRD tick count to zero

Is there a way to reset the PRD tick count? (I hope I'm wording this correctly)

I am using the CLK Manager to drive PRD.  The CLK Manager interrupts every 1000.00 us ( 1 ms ). My PRD object's period (ticks) is set to 10 i.e. interrupts every 10 ms. In my application, I have a totally unrelated event that can happen at any time. Once that event happens I need to post SWIs to occur based on both the CLK timer and the PRD timer. The SWIs tied to the CLK timer will occur within 1 ms. No problem. The SWIs based on the PRD timer will occur sometime within 1 to 10 ms. I understand why this is happening based on the documentation (see PRD_start() description in the BIOS API document, although I am not using the PRD_start() function in my code). If I were able to reset the PRD tick timer back to 0 prior to posting the PRD-based SWIs, then the CLK-based SWIs and the PRD-based SWIs would be much more in synch i,e they would be within 1ms of each other.

Is there a way to reset the PRD tick count?

BIOS 5.33.05;  CCS 3.3.82.13; DSP F28335

Regards,

     Scott

 

  • You should be able to use 'PRD_stop()' followed by 'PRD_start()' to reset the counter associated with PRD object.

    I tried the following test case to verify:

    ------ C code -----

    #include <prd.h>

    extern PRD_Obj prd1, prd10;

    prd1fxn()
    {
        static Int i = 0;
       
        LOG_printf(&trace, "prd1 ticks = %d", PRD_getticks());
       
        if (i++ == 2) {
            PRD_stop(&prd10);
            PRD_start(&prd10);
        }
    }

    prd10fxn()
    {
        LOG_printf(&trace, "prd10 ticks = %d", PRD_getticks());
    }

     

    ---- .tcf code ---

    bios.PRD.create("prd1");
    bios.PRD.instance("prd1").order = 1;
    bios.PRD.instance("prd1").period = 1;
    bios.PRD.instance("prd1").fxn = prog.extern("prd1fxn");
    bios.PRD.create("prd10");
    bios.PRD.instance("prd10").order = 2;
    bios.PRD.instance("prd10").period = 10;
    bios.PRD.instance("prd10").fxn = prog.extern("prd10fxn");

  • Thanks for the response.

    Scott