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.

TMS320F280025: Question about why CPUTimer0’s count is abnormal

Part Number: TMS320F280025

Dear expert:

     I am using TMS320F280025,I set up two interrupt function,ADCA interrupt of 50us and CPUTimer1 of 100us.I set up CPUTimer0 and cofigurate its period with max period value and I didn't enable CPUTimer0's interrupt.I just let CPUTimer count from 429496729 to 0 and keep the count cycle.I use CPUTimer0 to test the time between two  adjacent interrupts,such as the time between last  ADCA interrupt and current  ADCA interrupt.And I also use CPUTimer0 to test the time of application's execution.

    When I test ADCA interrupt and CPUTimer1 interrupt,the time gap is normal as following:

    But when I test 1ms task which is created by a counter in  CPUTimer1 interrupt,the counter counts up to 100 and then set the 1ms task's flag,and then the 1ms task will execute in while(1) of main() by recognizing the 1ms task's flag.But when I use the same method to test the time gap of 1ms task,the count is abnormal is as following:

  The time gap test code is as following:

  T1ms_start_temp = T1ms_stop_temp;
T1ms_stop_temp = CPUTimer_getTimerCount(CPUTIMER0_BASE);
if(T1ms_start_temp>=T1ms_stop_temp)
{
T1ms_Int_gap = T1ms_start_temp - T1ms_stop_temp;
}
else
{
T1ms_Int_gap = 4294967295 - T1ms_stop_temp + T1ms_start_temp;
}

But when I toggle one GPIO's level in 1ms task,the time is normal in the scope as following:

When I change the gap of CPUTimer1's interrupt from 100us to 1ms,the value of CPUTimer1_Int_gap is also also about 34400,only when I change the gap of CPUTimer1's interrupt to less than 500us,the time gap value start to be normal.I wonder that whether CPUTimer0 moulde could be affected by other module?Why does it start to be abnormal when I test the long time gap application?Could you give some guiding ideas?

  • Hi,

    Is it possible for you to send the counter configuration for 100us and 1ms? Logic of the code to calculate int_time_gap seems correct. But I am not able to understand what the issue is here without knowing the counter configuration.

    Are you saying the GPIO toggle on CPU Timer interrupt shows the correct 1ms difference on the scope. But the difference computed by code is not correct?

    Best Regards,

    Nirav