Part Number: TM4C123GH6PM
Just got my hands on this TIVA dev board and tried to blink a LED. The datasheet suggests on reset, PIOSC (16 MHz) is selected as system clock. But when I tried to pass 16000000 to SysTick LOAD register to blink the LED at 1 Hz, the LED seemed to blinking a bit faster than 1 Hz. I hooked it up to the scope and found the frequency was 1.5 Hz (320ms high and low time).
Here's my code if it helps :
#include "TM4C123.h" // Device header
void blinkLED(int count);
int main()
{
SYSCTL->RCGCGPIO |= 1<<5; //clock port F
GPIOF->DIR |= (1<<3); //PF3 configured as output
GPIOF->DEN |= (1<<3); //enable digital function on PF3
blinkLED(16000000);
while(1);
}
void SysTick_Handler(void)
{
GPIOF->DATA ^= (1<<3); //toggle
}
void blinkLED(int count)
{
SysTick->LOAD = count - 1; //starting from 0
SysTick->VAL = 0;
SysTick->CTRL = 7;
}
I have even noticed the issue while programming UART driver to communicate with PC. Sometimes it shows garbage characters (baud rate calculated taking 16 MHz system clock).