lpcware

Is SysTick COUNTFLAG required to be cleared ?

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by noritan_org on Fri Jan 29 23:17:25 MST 2010
In the example project "systick" for the LPCXpresso LPC1114, there is an exception handler as follows.
void SysTick_Handler(void) {
  msTicks++;                        /* increment counter necessary in Delay() */
}
I wonder why this handler has no code to clear the COUNTFLAG of the SYST_CSR register.

It was described in the page 307 on 00.10 version of user manal UM10398, the COUNTFLAG register can be cleared by reading the SYST_CSR register.   I understand that the exception will be activated during the COUNTFLAG is 1, and the SysTick exception handler is continued to be executed until the COUNTFLAG is cleared.  But, the results attempting the project "systick" is different from my assumption.  The SysTick exception is invoked periodically.

My questions are :
1. Is the COUNTFLAG automatically cleared when a SysTick exception is activated ?
2. Is there an another internal (invisible) pending flag causing SysTick exception separated from the COUNTFLAG ?
3. Is it required to read the SYST_CSR register in the SysTick handler to clear the COUNTFLAG ?

Thanks in advance.

Outcomes