Other Parts Discussed in Thread: TM4C123GH6PM
I tried creating the source code for the clock code.
Can you move here too?
Sample Code
--------------------------------------------------------------------------------
/*Probably We should use header files below*/
#include <sysctl.h>
#include <rom_map.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
/*main function*/
int main(void){
/* Configure the PLL */
SysCtlClockFreqSet(SYSCTL_XTAL_16MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL, 120000000);
MAP_SysCtlClockFreqSet(SYSCTL_XTAL_16MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL, 120000000);
return 0;
}
--------------------------------------------------------------------------------
By the way, the PLL configuration and UART configuration were made with the following code.
What do you think?
Sample Code
--------------------------------------------------------------------------------
/*Probably We should use header files below*/
#include <stdint.h>
#include <stdbool.h>
#include "inc/hw_ints.h"
#include "inc/hw_memmap.h"
#include "driverlib/debug.h"
#include "driverlib/gpio.h"
#include "driverlib/interrupt.h"
#include "driverlib/pin_map.h"
#include "driverlib/rom.h"
#include "driverlib/rom_map.h"
#include "driverlib/sysctl.h"
#include "driverlib/uart.h"
/*System clock rate in Hz*/
uint32_t g_ui32SysClock;
/*main function*/
int main(void){
// Setting the PLL
g_ui32SysClock = SysCtlClockFreqSet(SYSCTL_XTAL_16MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL, 120000000);
// Enable UART Pin
SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
// Configure UART
UARTConfigSetExpClk(UART0_BASE, g_ui32SysClock, 115200,(UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE));
return 0;
}
--------------------------------------------------------------------------------