Hi,
I try to configure DMTimer2 as simple permanent counter but fail to configure the clock divider/prescaler, it is always running and counting with full 24 MHz. This is my code:
// first part is taken from DMTimer example... DMTimer2ModuleClkConfig(); DMTimerReset(SOC_DMTIMER_2_REGS); DMTimerCounterSet(SOC_DMTIMER_2_REGS,0); DMTimerReloadSet(SOC_DMTIMER_2_REGS,0); DMTimerModeConfigure(SOC_DMTIMER_2_REGS,DMTIMER_AUTORLD_NOCMP_ENABLE); // then registers are written to make use of clock prescaler HWREG(SOC_DMTIMER_2_REGS + DMTIMER_TCLR)&=~DMTIMER_TCLR_PTV; // clear current prescale-counter values HWREG(SOC_DMTIMER_2_REGS + DMTIMER_TCLR)|=0x18; // set prescaler to 6 which is equal to a divider by 128 HWREG(SOC_DMTIMER_2_REGS + DMTIMER_TCLR)|=DMTIMER_TCLR_PRE; // enable prescaler // and start the timer HWREG(SOC_DMTIMER_2_REGS + DMTIMER_TCLR) |= DMTIMER_TCLR_ST;
No IRQ or something like that is involved, I just want it to count up. With the code above the prescaler value is ignored - any idea why?