I've created the BSP for one custom board based on the kinetis K20DN512VLK10, as base for the cloning wizard I used the tower K40 BSP that comes in the installation.
Now I need to use one hardware timer for internal timings in my application but I can't find the right way to do it.
First try was to add one TimerUnit_LDD device in the BSP PE editor but, when including the required files (I named the component ResponseTimer and it's associated header is "ResponseTimer.h") in the application the compiler showed this error:
In file included from C:/Freescale/Freescale_MQX_4_0/lib/MyBSP.cw10gcc/debug/bsp/Generated_Code/ResponseTimer.h:78:0,
C:/Freescale/Freescale_MQX_4_0/lib/MyBSP.cw10gcc/debug/bsp/Generated_Code/PE_Types.h:56:33: error: two or more data types in declaration specifiers
mingw32-make: *** [Sources/HAL/_timing.o] Error 1
mingw32-make: *** Waiting for unfinished jobs....
The corresponding lines in the PE_Types.h file are:
/* PE types definition */
typedef unsigned char bool; /*<- this is the 56th line.*/
Second try was to add two new source files in the BSP project (legacy.h and legacy.c, in this case) and add there the code for accessing the timer device. It compiled without any issue but when debugging the code the application crashed on calls to function ResponseTimer_ResetCounter().
From results in the first attempt it seems that this is not the method for gaining acess to hardware. How should I do it?
My needs are simple, I want to use one hardware timer for making very precise sub-millisecond delays (one detecting one specific event I should reset the timer and keep reading the timer's count register until it reaches some precalculated value). The functionalities involved are: Up Counting, Make Counter Reset, Get Value of Input Frequency and Get Current Counter Value.
(and thanks a lot in advance)