Re:RTC on LM3S811 Eval Board
Did you remember to enable the clocks to the GPIO and Timer modules in the Run-Mode Clock Gating Control registers (RCGCn) before you accessed them? This can be done using DriverLib with the following calls:
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB); SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER2);
Also, I see that you call:
TimerLoadSet(TIMER2_BASE, TIMER_A, 0xFFFF);
Remember, RTC mode is the only mode in which the timer counts UP and not down. Typically, in RTC type applications, you would not adjust the load value (with TimerLoadSet). It is set to 1 when RTC mode is enabled and runs free. You set the match value based on the current value of the counter plus the period you would like to count to. In the interrupt handler, you can reset the match value to the next timeout period. This way the time is continuously running real-time and does not lose any time if you set the interval load register again.
login or register to reply
|