This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Compiler/TM4C129ENCPDT: TM4C129ENCPDT

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.
  • Hi Sobia,

      If you have not done so, please download the TivaWare library from http://www.ti.com/tool/SW-TM4C. The TivaWare library contains all the drivers, examples and documentation. 

     Once you download the TivaWare library, you can find the peripheral driver library user's guide in below place.

    You can find the drivers source code under <TivaWare_Installation>/driverlib.

    For UART examples, you can find under <TivaWare_Installation>/examples/peripherals/uart

    Please note that we are against developing your application without using the TivaWare. Your presented code using DRM (Direct Memory Manipulation) will be prone to errors and hard to debug.