Hi,
I created a small BeagleBone test-application that makes use of DMTimer2 to create a (fast) periodic interrupt. This test-application mainly uses code out of the examples that come with starterware. Unfortunately it is not as fast as expected. Currently I'm not sure if only the first interrupt comes with expected speed (altough I'ml already using auto-reload via flag DMTIMER_AUTORLD_NOCMP_ENABLE) or if the clock source is not CLK_M_OSC (but DMTimer2ModuleClkConfig() is setting the correct clock source). That's what I'm doing to initialise the timer-IRQ:
DMTimer2ModuleClkConfig(); // should select 24 MHz CLK_M_OSC as clock source IntMasterIRQEnable(); IntAINTCInit(); IntRegister(SYS_INT_TINT2, isr_func); IntPrioritySet(SYS_INT_TINT2, 0, AINTC_HOSTINT_ROUTE_IRQ); IntSystemEnable(SYS_INT_TINT2); DMTimerCounterSet(SOC_DMTIMER_2_REGS,0xFFFFFFF9); // load initial value DMTimerReloadSet(SOC_DMTIMER_2_REGS, 0xFFFFFFF9); //...and reload value DMTimerModeConfigure(SOC_DMTIMER_2_REGS, DMTIMER_AUTORLD_NOCMP_ENABLE); // auto-reload and overflow, so this should appear periodically DMTimerIntEnable(SOC_DMTIMER_2_REGS, DMTIMER_INT_OVF_EN_FLAG); DMTimerEnable(SOC_DMTIMER_2_REGS);
My ISR looks like this:
static void isr_func()
{
static int clockCtr=0;
static int ledCtr=0;
// DMTimerIntDisable(SOC_DMTIMER_2_REGS, DMTIMER_INT_OVF_EN_FLAG); not sure regarding these functions, it does not seem to make a difference if they exist or not, but in my opinion it would be good to not to disable the interrupt to keep the interrupt frequency stable (ISR code in this case must be faster than the frequency itself of course) // DMTimerIntStatusClear(SOC_DMTIMER_2_REGS, DMTIMER_INT_OVF_IT_FLAG); ledCtr++; clockCtr++; // some code here... /* Re-enable the DMTimer interrupt */ // DMTimerIntEnable(SOC_DMTIMER_2_REGS, DMTIMER_INT_OVF_EN_FLAG); }
Any ideas what could be wrong?
Thanks!