Having trouble using PLL of TM4C123GH6PM Microcontroller

-1

I am working with the PLL of TM4C123 mcu. I tried each and everything I could do. But doesn't work. I followed each steps and everything correctly.

I am trying to use PLL at 80Mhz. But in debugging "SystemCoreClock" shows "50000000" that means 50Mhz. Please tell me if you find anything wrong in my code.

Here is my method:

void PLL_Init_80MHz(){

    SYSCTL->RCC2 |= (1 << 31); // setting USERCC2 bit to use RCC2 and to overwrite with RCC
    SYSCTL->RCC2 |= (1 << 11); // bypass the PLL
    SYSCTL->RCC2 &= ~(11 << 6); // clearing XTAL value
    SYSCTL->RCC2 |=  (21 << 6); // setting XTAL value as 16MHz
    SYSCTL->RCC2 &= ~(1 << 4); // clearing OSCRC bit to set MAin OSC 16MHz
    SYSCTL->RCC2 &= ~( 1 << 13); // clearing PWRDN2 to 0 to make PLL works normally 
    SYSCTL->RCC2 |= (1 << 30); // setting up DIV400 to 1 and Append the SYSDIV2LSB bit to the SYSDIV2 field to create a 7 bit divisor using the 400 MHz PLL output
    SYSCTL->RCC2 &= ~(1 << 22); // clearing SYSDIV2LSB, SYSDIV2LSB=0;
    SYSCTL->RCC2 &= ~(15 << 23); // SYSDIV2=0x00 to divide by 5;
    SYSCTL->RCC2 |= (2 << 23); // SYSDIV2=0x02 to divide by 5;
    SYSCTL->RCC  |= (1 << 22); // set USESYSDIV bit to 1
    SYSCTL->RCC  &= ~(1 << 0); // The main oscillator is enabled.
    while((SYSCTL->RIS & 0x00000040)==0){
    }
    SYSCTL->RCC2 &= ~(1 << 11); // clearing the bypass the PLL



}
embedded
microcontroller
cortex-m3
texas-instruments
stm32f7
asked on Stack Overflow Aug 6, 2019 by naasif • edited Aug 7, 2019 by naasif

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0