I have set my system timers to generate interrupts at 10Hz (MSINT) and 1HZ (SECINT). The millisecond interrupt is triggered immediately after reset but the seconds interrupt takes some time before it starts to trigger (about 15s). After that it triggers every second, as desired.
I have set up the timers as follows:
void InitSysTimer(void) { // Set millisecond timer MSECH = 0x73; MSECL = 0x32; // Set hundred millisecond clock HMSEC = 99; // Set interrupt frequency SECINT = 0x89; MSINT = 0xE3; // Enable interrupt AIE = 0x90; EAI = 1; // Power on system timers PDCON &= 0xFD; }
Is there a reason the seconds interrupt takes so long to be called?
Thanks, Paul
TI's MSC1210Y5
This isn't a chip I have worked with.
However, a common way for a timer to generate an interrupt is by having a timer match register. If the timer counter is _exactly_ the value of the match register, the timer may (depending on configuration) generate an interrupt, and/or reset the counter (for repetitive use) and/or just stop the counter.
If you have a 32-bit counter configured in a way that the match register will match and auto-reset at a low value, you could manage to configure the timer so that the counter value has already passed the match value when you program the timer.
In that case, you will have to wait the full 32-bit counting range until it turns around before the match register gets a second chance. If implementing the same thing in software, delays are normally implemented with a >= test, to maximize the "self-healing" of the software. If you have a timer with exact-match, there will not be any such self-healing and depending on prescaler settings, it could take a very, very long time until an overflow happens and the timer starts to tick with the normal time intervals.
Are you sure that both timers are stopped (and in a reset condition) before you start them?