Hi, I am fairly new to MCU development. I was playing around with the TivaWare Getting Started Wiki site, which actually is terrific!
However, there is one (probably simple) task that I couldn't resolve yet. I want to let the Tiva run at 50 MHz, count the clock cycles for a given function and derive from it the absolute time ins ms. I know that it should be possible to derive this information from CCS, but I would like to do it algorithmically to get to know the board better. So right now I am setting up the clock to run at 50 MHz and I use the SysTickEnable() function to count the cycle. I am not entirely sure but the SysTick function is like a timer that is decremented and I can use SysTickPeriodSet() to define the start of the decrementation process? But in order to derive the absolut time from the counted cycles I would need to know the cycles per second right? Also isn't there a chance that the SysTick counter overflows (or underflows)? Can someone help me out with this or tell me if I am on the right track?
Thank you!
unsigned long clockRate;
unsigned long ulValue;
SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_XTAL_16MHZ |
SYSCTL_OSC_MAIN);
clockRate = SysCtlClockGet();
UARTprintf("Clock Rate %d\n",clockRate);
SysTickPeriodSet(1000);
SysTickEnable();
ulValue = SysTickValueGet();
UARTprintf("SysTickValue %d\n",ulValue);