Rtc seconds count not updating
When either of these compare registers are reached, the RTC interrupt handler will run and take care of advancing the clock or starting/stopping the sprinkler.I first configure the required clock sources for RTC, set the timer for 1 second ticks, and enable the interrupts in the NVIC controller.Peripherals in the EFM32 libraries can generally be found as a pointer from a memory address.The libraries have set up a #define for the identifier RTC to hold the system address for the register space for the RTC clock.We have looked at fast-running timers in chapter five, but those aren’t necessarily the best to use for long-running time keeping purposes such as keeping track of the time of day and the day of the year.The best timer for that purpose is the Real Time Clock (RTC) which is the topic of this section.I will use one interrupt to trigger every 60 seconds so that I can update the time.
It also has its own backup power supply called BU_VIN that is separate from the VIN to the MCU and is routed on PD8 on the Wonder Gecko pinout.
Real Time Clock (RTC) Since I am building a sprinkler timer, I need a suitable timer to keep track of time.
All of the clocks that I covered in the last lesson were not ideal for long-term timekeeping.
This is the setup function: You can see that the clock divisor is huge at 32768.
The Reference Manual for RTC shows the divisors in integers from 1 to 15, while the CMU requires inputs to be in the form of 2^DIVISOR. So this is why I had to send in such a huge divider.