I'm trying to configure my Launchpad to run at 80MHz.
I'm not using TivaWare for this.
I'm following the instrauctions as for page 231 5.3 Initialization and Configuration
but I'm not having success as the clock clearly is not running at 80MHz.
This is what I'm doing as first thing in main function.
Maybe someone can spot the error! Thx.
void clockSetup(){
// Run-Mode Clock Configuration(RCC) reset value 0x078E3AD1
// Get Values
unsigned int RCC_i = SYSCTL->RCC;
unsigned int RCC2_i = SYSCTL->RCC2;
unsigned int MOSCCTL = SYSCTL->MOSCCTL;
SYSCTL->RCC = 0x078E3AD1U; // Reset the register
unsigned int RCC_r = SYSCTL->RCC; // Should read 0x078E3AD1U
SYSCTL->RCC &= ~(0x01U << 11); // PLL Bypass (0x0 use PLL)
// Main Oscillator Disable (MOSCDIS)
// 0 enabled (default), 1 disabled
SYSCTL->RCC |= (0x01U << 22); // Enable System Clock Divider
SYSCTL->RCC |= (0x15U << 6); // Set XTAL value 16Mhz
unsigned int RCC_c = SYSCTL->RCC;
// Run-Mode Clock Configuration 2(RCC2)reset value 0x07C06810
SYSCTL->RCC2 = 0x07C06810; // reset register
unsigned int RCC2_r = SYSCTL->RCC;
SYSCTL->RCC2 |= (0x01U << 31); // Use RCC2
SYSCTL->RCC2 |= (0x01U << 30); // Divide PLL as 400 MHz
SYSCTL->RCC2 &= ~(0x01U << 13);// Power-Down PLL (overrides RCC)
SYSCTL->RCC2 &= ~(0x01U << 11);// PLL Bypass (overrides RCC)
SYSCTL->RCC2 &= ~(0x07U << 4); // Oscillator Source (overrides RCC) select Main Oscillator (MOSC)
SYSCTL->RCC2 |= (0x02U << 23); // System Clock Divisor |
SYSCTL->RCC2 &= ~(0x01U << 22);// Additional LSB for SYSDIV2 | 80Mhz
unsigned int RCC2_c = SYSCTL->RCC2;
unsigned int RCC_f = SYSCTL->RCC;
unsigned int RCC2_f = SYSCTL->RCC2;
// wait for 16ms is deferred to the caller
}