Hello,
I have been working with the timers today and have come across a discrepancy which I can't explain. I have been trying to make a simple freerunning 32 bit timer so I can do some microsecond measurements.
I made some operational code for the 16/32 bit timers and this worked fine and tried to use this code to control a 32/64bit timer TimerA so that I was able to use the prescaler.
Here is the code:
//set up a timer for the fine resolution clock // Configure TimerA as a 32 bit timer // TimerB values inferred from Timer A SysCtlPeripheralEnable(SYSCTL_PERIPH_WTIMER1); // ensure timer is disabled before configuring TimerDisable(WTIMER1_BASE, TIMER_BOTH); // timer overflows and restarts TimerConfigure( WTIMER1_BASE, TIMER_CFG_SPLIT_PAIR | TIMER_CFG_A_PERIODIC_UP ); // Set timer clock source to be system clock TimerClockSourceSet( WTIMER1_BASE, TIMER_CLOCK_SYSTEM ); // set up the prescaler - each counter bit is worth 1/20e6 of a second (ie divide by 20 to get uS) TimerPrescaleSet( WTIMER1_BASE, TIMER_A, 1); // Set the overrun value (largely ignored, must be above max expected value) TimerLoadSet( WTIMER1_BASE, TIMER_A, 2000001 ); // set the cause of interrupt TimerIntEnable( WTIMER1_BASE, TIMER_TIMA_TIMEOUT); // timer is free running TimerEnable( WTIMER1_BASE, TIMER_A );
Where I essentially replaced the timer base with WTIMER1_BASE.
Does anyone have any initial thoughts why this might not have worked... it just cycles through at a constant rate and ignores the TimerLoadSet threshold (regardless of what value I use).
Best of thanks