Mark Greenhalgh

Timers on KW01Z

Discussion created by Mark Greenhalgh on Feb 16, 2017
Latest reply on Feb 27, 2017 by Luis Antonio Burgos Lopez

I am building an app from the wireless UART bare metal app and am in need of getting access to a timer to time stamp interrupt events.  I have modified the Switch_Press_ISR in keyboard.c so that I get an event set whenever my circuit activates the input used by SW4 on the freedom board.  I can reliably detect these events and count them.  Now I need to time the duration between them.  My initial attempts have been to put a call to StackTimer_GetCounterValue() in Switch_Press_ISR.  This results in always getting the same nonzero value returned by StackTimer_GetCounterValue().  I then tried to use the SDK function HWTIMER_SYS_GetTicks(&variable) and I always get zero values.  I’m thinking there is more setup to use HWTIMER_SYS_GetTicks such as calls to HWTIMER_SYS_Init and HWTIMER_SYS_Start.  I need to understand what is happening with the StackTimer_GetCounterValue function from Wireless_UartApp.c or how to setup and properly call HWTIMER_SYS_Init of the SDK. 

Outcomes