Page 1 of 1
Using System Tick
Posted: Thu Nov 28, 2019 7:32 pm
by bscholte
We are building an "RTOS" an a LPC-1769-ARM3 and are using the standard Timer module, using Timer3 for a 10mS pulse which basically clocks everything. Following the documentation, the System Tick should do exactly the same thing. So, we thought it would be easy to convert the Timer module into a SysTick Module which does essentially the same. Unfortunately, it seems to be quite different...
Has anyone used the system tick on this processor?
With great thanks......
Re: Using System Tick
Posted: Fri Nov 29, 2019 6:41 am
by cfbsoftware
I haven't used it myself. Does this article help?
http://www.exploreembedded.com/wiki/LPC ... Tick_Timer
If not send us a minimal example of your code with a test program to exercise it and we'll investigate here.
Re: Using System Tick
Posted: Fri Nov 29, 2019 7:53 am
by bscholte
The article has more information than the NXP LPC manual, so it does help. In the LPC manual, the information is partly in the main section, but critical details are in the ARM section. For example, the NVIC offset vector seems to be at $3C, which is below the $40 that is the lowest in the NXP NVIC table.
Anyway, I will make a few more attempts and post the resulting Module.
Re: Using System Tick
Posted: Sat Nov 30, 2019 3:15 pm
by Selectech
I've used Systick on LPC1347 and LPC1768 ( and some other non-NXP controllers ). It's used for my RTOS work,
With a 96 Mhz clock, this sets up Systick to give 1 mSec tick.
The trap handler is just like any other interrupt handler.
(* System Tick Timer Handler *)
PROCEDURE SysTickTrap[1];
BEGIN
INC(mSec);
Timer_Ticked := TRUE;
(* other work to be done by tick Int goes here *)
END SysTickTrap;
(* Init the System Tick Timer Handler, 1 mSec tick *)
PROCEDURE Init_Systick;
CONST
SysTickVector = 01000003CH; (* from Cortex-M3 documentation *)
VAR direction : SET;
BEGIN
SYSTEM.PUT(MCU.STCURR, 0 ); (* start from 0 *)
SYSTEM.GET(MCU.STCTRL, direction);
SYSTEM.PUT(MCU.STCTRL, direction - {1} + {0,2} );
SYSTEM.PUT(MCU.STRELOAD, 96000 ); (* using 96 Mhz clock *)
(* set Systick vector *)
Traps.Assign( SysTickVector , SysTickTrap );
SYSTEM.PUT(MCU.STCTRL, direction + {0,1,2} ); (* enable the interrupt *)
END Init_Systick;
Re: Using System Tick
Posted: Wed Dec 04, 2019 10:19 am
by bscholte
The posted Module works like a charm and frees up a Timer. Thanks!
The only difference for my LCP1769 at 120MHZ and a tick every 10mSec, is the RELOAD. The value given in the manual (120MHZ/100 - 1= 1199999) nicely produces the desired tick.
Cheers!