erupter wrote on Sunday, October 02, 2011:
I’m opening a new topic because I feel it doesn’t have much in common with my previous one.
Although all the research I’m doing stems from my other problems.
I’ve opened a Microchip demo (PIC32 starter kit timer interrupt):
they are using an undocumented 32bit counter, the CPU own internal counter referenced by undocumented macros
// configure the core timer roll-over rate (100msec)
OpenCoreTimer(CORE_TICK_RATE);
// set up the core timer interrupt with a prioirty of 2 and zero sub-priority
mConfigIntCoreTimer((CT_INT_ON | CT_INT_PRIOR_2 | CT_INT_SUB_PRIOR_0));
// update the period
UpdateCoreTimer(CORE_TICK_RATE);
// clear the interrupt flag
mCTClearIntFlag();
And it’s working.
By searching here and there, it comes out this is an internal feature of the MIPS core, separated from microchip’s own Timer1/5 timers.
I’m looking into it, but it seems the Tick should use this counter instead of a peripheral timer.
And given the resolution an the speed (fixed at half the clock) it could also be suitable for the stats generator.
I would have tried it myself, but the fact that the ISR is in asm is blocking me: I don’t know asm.
I also can’t find any reference in the MCHP docs to anything in the following line
mConfigIntCoreSW0( CSW_INT_ON | CSW_INT_PRIOR_1 | CSW_INT_SUB_PRIOR_0 );
They don’t exist in the docs.
So can I use the CoreTimer to feed the stats?
Why it hasn’t been used for the tick?
What are the undocumented macros?
Thanks