Page 1 of 1

mod5213 PIT problem

Posted: Fri Dec 07, 2012 5:35 am
by e.dinu
Hi,
I am quite new with netburner hardware and I modified the PIT example from this page: http://www.netburner.com/support/resources/mod5213 to give me a 400Hz interrupt. My modifications are in the line: SetUpPITR( 1 /* Use PITR 1 */, 20735 /* Wait 16588 clocks */, 2/*
Divide by 2 from table 17­3 */ ); . I added also a line to keep the pitr_count in a pitrold and show me iprintf the difference between pitr_count and pitrold, which should be 400 for every second. Now my problem is that every about 60 seconds the difference for about 4 values off the difference is 399 instead of 400, like it misses an interrupt. If I change the frequency to the default in the example, it missis once at about 90 seconds and then is not doing it again. Anybody knows why and how should I avoid this? Is it a problem with the PIT timing or the OSTimeDly function?

Re: mod5213 PIT problem

Posted: Mon Dec 10, 2012 3:28 pm
by pbreed
Calling OSTimeDly is asyncronous...
the delay is syncronous...

so in fact a call to OSTimedly(n)

Will give you a delay
n-1 < actual _delay < n

So you are see slip in the OSTimeDly and the code around your pause burns up cycles until you slip over the the next count...