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.

PRD function Problem

Hello,

I am using a PRD function in DSP BIOS to set a timeout for one of the processes in my program. I defined a flag called EDMA_Timeout, that set in interrupt, generated by one-shot PRD called  EDMA_Timeout_PRD and the wait for interrupt to happen. the interrupt function is:

void EDMA_Timeout_FXN(void)
{
 EDMA_Timeout = TRUE;
}

And th code in program is:

 EDMA_Timeout = FALSE;
 PRD_start(&EDMA_Timeout_PRD);
 while(EDMA3_MemCpy_Interrupt && !EDMA_Timeout);
 PRD_stop(&EDMA_Timeout_PRD);

It is executed from time to time in program. The problem is that the program after some time get stuck in while loop, i.e. the interrupt does not occurs.

It usualy occurs that the program completes the transfer before timeout is expired. In this case PRD_stop function stops PRD interrupt before it occurs, and then the PRD activated again in next cycle using PRD_start. Can this cause the PRD to continue counting, or PRD_start  causes the counter to be restarted each time?

If this is not the reason for the problem, then what can cause it?

Thanks

Arye Lerner

  • Though I do not have a complete answer for your problem, I can at least answer one question.

    Arye Lerner said:
    Can this cause the PRD to continue counting, or PRD_start  causes the counter to be restarted each time?

    The call to PRD_start should reset the counter, the BIOS API Guide says this explicitly in the PRD_start description.

    SPRU403q p366 said:
    If PRD_start is called again before the period for the object has elapsed, the object’s tick count is reset.

    My suspicion on why you would get stuck in the loop would be that some other code in your project is messing with the interrupts or the timers inadvertently breaking the PRD. You might try stripping down the problem by disabling any other TSKs or HWIs in the system as a test to see if the problem goes away.

  • Arye Lerner said:
    It is executed from time to time in program. The problem is that the program after some time get stuck in while loop, i.e. the interrupt does not occurs.

    Make sure you declare EDMA_Timeout as volatile, especially if the ISR is in a separate file from the other code.  I imagine that is the reason why your timeout condition is not causing you to exit the while loop.  The reason for the EDMA not completing in time will be tougher...