A few quick comments:
SysTick is NOT an 'NVIC' interrupt -- it is a 'basic' ARM interrupt, on vector 15. NVIC uses vectors 16 'and up'. Do NOT try to use the NVIC-interrupt interface routines. Just create your ISR vector directly in the table, at #15.
.
.
.
| DCD | PendSV_Handler | ; PendSV Handler #14 |
| DCD | SysTick_Handler | ; SysTick Handler #15 |
| ; External Interrupts | |
| DCD | DMA0_IRQHandler | ; 0: DMA Channel 0 transfer complete #16, NVIC #0 |
.
.
.
My handler, with an optional 'scope hook' on GPIOC16:
void SysTick_Handler(void)
{
{
// GPIOC_PSOR = 1<<16;
tick_flag = TRUE;
if( TST_dly != 0 )
TST_dly--; //Timeouts within test state machine
// GPIOC_PCOR = 1<<16;
}
}
The count runs from the CPU instruction-clock, so you will need a BIG number to toggle at a rate you can see -- probably something > 10million.:
| |
| SYST_RVR = (core_clk_khz * 1000L / TICKS_PER_SECOND) - 1; |
| SYST_CVR = 0; |
| SYST_CSR = SysTick_CSR_TICKINT_MASK | SysTick_CSR_ENABLE_MASK | SysTick_CSR_CLKSOURCE_MASK; |
But note that SYST_RVR (etc) is a 24-bit counter setup, so limited to about 16 million (or about 6 interrupts per second from 100MHz, at the longest).
As a final note, one need NEVER '|=' to the direct-bit-control GPIO registers -- as in this case, PTOR. The mere existence of the proper '1' bit implements the function, and they always READ as zero -- so Read/Modify/Write is a WASTE of time.