Part Number:EK-TM4C123GXL
Hello,
I tried to use SysTick to time a segment of code, but I am getting an answer that I can tell is wrong. This is what I have done:
SysTickPeriodSet(16777216);
SysTickEnable();
uint32_t numCycles = SysTickValueGet();
// time-intensive code runs here
numCycles = SysTickValueGet() - numCycles;
uint32_t clockRate = SysCtlClockGet();
I then calculate numCycles/clockRate and get 53 seconds as my time, when I can clearly tell that the code is running in less than a second. Am I using SysTick incorrectly/is there a better way to time code on the TM4C123? I need microsecond resolution.
Thanks.