Part Number: TM4C129ENCPDT
Tool/software: TI C/C++ Compiler
Hi,
I am new in this TM4c129ENCPDT microcontroller. I want to create a driver routines to access the Universal Synchronous/Asynchronous Receiver/Transmitter (USART) port of the Tiva™ TM4C129ENCPDT Microcontrolle.I found difficulty to found API functions..I make these functions
//#include <stdbool.h>
#include <stdint.h>
#include "inc/hw_memmap.h"
#include "driverlib/gpio.h"
#include "driverlib/pin_map.h"
#include "driverlib/sysctl.h"
#include "driverlib/uart.h"
#include <main.h>
#include "tm4c129encpdt.h"
// This function initializes the USART driver
void USART_init(uint32_t ui32Base){
//Enable UART module 0 (UART0)
SYSCTL_RCGCUART_R = SYSCTL_RCGCUART_R | 0x01;
//Enable the clock for GPIO module A, as i am using the UART0
SYSCTL_RCGCGPIO_R = SYSCTL_RCGCGPIO_R | 0x01;
//Set the GPIO AFSEL for pin PA0 and PA1
GPIO_PORTA_AHB_AFSEL_R = GPIO_PORTA_AHB_AFSEL_R | 0x03;
//Configure GPIO current level (slew rate is not necessary)
GPIO_PORTA_AHB_DR2R_R = GPIO_PORTA_AHB_DR2R_R | 0x01;
//Configure PCM0 and PCM1 (Pin0 and Pin1)
GPIO_PORTA_AHB_PCTL_R = GPIO_PORTA_AHB_PCTL_R&0xFFFFFF00; //First reset
GPIO_PORTA_AHB_PCTL_R = GPIO_PORTA_AHB_PCTL_R | 0x00000011;
//Configure baud-rate divisor (BRD)
UART0_CTL_R = UART0_CTL_R&(~UART_CTL_UARTEN); // Disable UART
UART0_IBRD_R = 130; // IBRD = int(20,000,000 / (16 * 9,600)) = int(130.2083)
UART0_FBRD_R = 13; // FBRD = int(0.2083 * 64 + 0.5) = int(13)
//Configure serial parameters (UARTLCRH)
UART0_LCRH_R = (UART_LCRH_WLEN_8|USART_LCRH_PAR_NONE|UART_LCRH_STOP_ONE);
//Configure UART clock source
UART0_CC_R = UART0_CC_R|0x00; //Using system clock
//Enable UART
UART0_CTL_R = UART0_CTL_R|UART_CTL_UARTEN;
Are these are right registers and the way of initailizing?
Don't understand any sugguestion..its very hard to understand because TM4c129ENCPDT microcontroller have no Peripheral Driver Library user guide for TM4c129ENCPDT.