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.

i2c problem and question in TM4C

Other Parts Discussed in Thread: TM4C123GH6PM, TLV320AIC3204

hi all

i just would like to ask, currently i am writing the i2c Code for my project but when i use TM4C pinMux or even i follow the example i am still facing some error which is as below

MAP_GPIOPinConfigure(GPIO_PB2_I2C0SCL);

MAP_GPIOPinConfigure(GPIO_PB3_I2C0SDA);

the error shown as below

Description Resource Path Location Type
#20 identifier "GPIO_PB3_I2C0SDA" is undefined main.c /tester line 88 C/C++ Problem
#20 identifier "GPIO_PB2_I2C0SCL" is undefined main.c /tester line 82 C/C++ Problem

what is the meaning of undefined? is it something need to be done?

the include file as below

#include <stdint.h>
#include <stdbool.h>
#include "test.h"
#include "inc/hw_types.h"
#include "inc/hw_memmap.h"
#include "inc/hw_gpio.h"
#include "inc/hw_ints.h"
#include "inc/hw_uart.h"
#include "inc/hw_sysctl.h"
#include "inc/hw_i2c.h"
#include "driverlib/fpu.h"
#include "driverlib/systick.h"
#include "driverlib/sysctl.h"
#include "driverlib/pin_map.h"
#include "driverlib/rom_map.h"
#include "driverlib/debug.h"
#include "driverlib/interrupt.h"
#include "driverlib/gpio.h"
#include "driverlib/uart.h"
#include "driverlib/rom.h"
#include "driverlib/i2c.h"
------------------------------------------------------------------------------------------------------------------------------------------------

another question is i have saw both driverlib and sensorlib i2c configuration and setup, when i compare driver lib is easier to understand but i would like to ask since i have search through driverlib document, and i only saw that there only send a byte at one time. is there any possible to send 3 byte at a time? and any possible quote an example for sending 3 byte data using driverlib? 

thank you

  • Hi,

       If you are using the Tiva Launchpad, these defines can be found at pin_map.h and are dependent on a preprocessor symbol. So, set it at your project settings.

       PART_TM4C123GH6PM

    - kel

  • hi Markel

    do you mean the error i have mentioned? or the question i ask?

  • Hello Kelvin,

    What Kel mentioned is shown in the following snapshot

    Regards

    Amit

  • hi Amit 

    thank for the answer problem solved

    just would like to ask and confirm something in the programming, i m building this i2c to communicate with the CODEC AIC3204 which will need 3 byte each command, and this uC will be act as master to send data to activate the CODEC. if i continuous to send 3 byte will the programming as below?

    i need to write the i2c command like 01 44 4C am i suppose write like below?

    I2CMasterSlaveAddrSet (I2C_MASTER_BASE, I2C_SLAVE_ADDRESS, 0);

    I2CMasterDataPut(I2C1_BASE, 0x01);

    I2CMasterControl(I2C1_BASE,I2C_MASTER_CMD_BURST_SEND_START);

    while(!I2CMasterBusy(I2C1_BASE));

    I2CMasterDataPut(I2C1_BASE, 0x44);

    I2CMasterControl(I2C1_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);

    while(!I2CMasterBusy(I2C1_BASE));

    I2CMasterDataPut(I2C1_BASE, 0x4C);

    I2CMasterControl(I2C1_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);

    while(!I2CMasterBusy(I2C1_BASE));

    once complete above can i need continue another line such as 00 01 02 can be written as same as above command?

    thank once again for amit and markel guidance during this few day

  • Hello Kelvin,

    Yes, it can be done in the same manner. Suggestion would be to make a function of the above lines and then pass the data that you need to send to this function.

    Regards

    Amit

  • hi amit 

    thank for the answer will try sooner, as my code just started haven't completed. but one more, correct me if i have mistake, i am not sure about the i2c slave address for the tm4c123gh6pm but based on the reference on the datasheet 16.4.1 configure i2c module to tx single byte as a master, i reference it written as 0x3B, is the slave address for this case is 0x3B? 

    thank once again

  • Hello Kelvin,

    The Slave Address is as per the external device you are using and is fully programmable in the I2CMSA registers bits 7 downto 1. The 0x3B that may have been given in the example code.

    Regards

    Amit

  • hi Amit

    i have tried to put all the code into the uC , based on what i have sent you, but it does not work as expected, i not sure what happen but when i slowly step over and over again by clicking F5, found that there is a message show 

    Can't find a source file at "C:/DriverLib/build/DriverLib.test/driverlib/sysctl.c"
    Locate the file or edit the source lookup path to include its location.

    what is it, is it an error?

    below are the attachment show the program i written due to too long, i put in txt file

    #include <stdint.h>
    #include <stdbool.h>
    #include "test.h"
    #include "inc/hw_types.h"
    #include "inc/hw_memmap.h"
    #include "inc/hw_gpio.h"
    #include "inc/hw_ints.h"
    #include "inc/hw_uart.h"
    #include "inc/hw_sysctl.h"
    #include "inc/hw_i2c.h"
    #include "driverlib/fpu.h"
    #include "driverlib/systick.h"
    #include "driverlib/sysctl.h"
    #include "driverlib/pin_map.h"
    #include "driverlib/rom_map.h"
    #include "driverlib/debug.h"
    #include "driverlib/interrupt.h"
    #include "driverlib/gpio.h"
    #include "driverlib/uart.h"
    #include "driverlib/rom.h"
    #include "driverlib/i2c.h"
    
    #define SLAVE 0x3B
    //*****************************************************************************
    
    
    void
    PortFunctionInit(void)
    {
    
    	//
        // Enable Peripheral Clocks
        //
        MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
        MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_USB0);
        MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_I2C0);
        MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
        MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
        MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);
        MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
        MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
        MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
    
        /****
         * GPIO setting for output
         */
        //
        // Enable pin PA4 PA5 PA6 PA7 for GPIOOutput
        //
        MAP_GPIOPinTypeGPIOOutput(GPIO_PORTA_BASE, GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_6 | GPIO_PIN_7);
    
        //
        // Enable pin PC4 PC5 PC6 PC7 for GPIOOutput
        //
        MAP_GPIOPinTypeGPIOOutput(GPIO_PORTC_BASE, GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_6 | GPIO_PIN_7);
    
        //
        // Enable pin PD3 for GPIOOutput
        //
       // MAP_GPIOPinTypeGPIOOutput(GPIO_PORTD_BASE, GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3);
    
        //
        // Enable pin PE0 PE1 PE2 PE3 PE4 for GPIOOutput
        //
        MAP_GPIOPinTypeGPIOOutput(GPIO_PORTE_BASE, GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_4);
    
        //
        // Enable pin PF1 PF2 for GPIOOutput
        //
        MAP_GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_1 | GPIO_PIN_2);
    
        //
        //First open the lock and select the bits we want to modify in the GPIO commit register.
        //
        HWREG(GPIO_PORTF_BASE + GPIO_O_LOCK) = GPIO_LOCK_KEY;
        HWREG(GPIO_PORTF_BASE + GPIO_O_CR) = 0x1;
    
        //
        //Now modify the configuration of the pins that we unlocked.
        //Enable pin PF0 PF3 PF4 for GPIOOutput
        MAP_GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_0 | GPIO_PIN_4 | GPIO_PIN_3);
    
        /***
         * I2C0 set up
         */
    
        // Enable pin PB2 for I2C0 I2C0SCL
        //
        MAP_GPIOPinConfigure(GPIO_PB2_I2C0SCL);
        MAP_GPIOPinTypeI2CSCL(GPIO_PORTB_BASE, GPIO_PIN_2);
    
        //
        // Enable pin PB3 for I2C0 I2C0SDA
        //
         MAP_GPIOPinConfigure(GPIO_PB3_I2C0SDA);
        MAP_GPIOPinTypeI2C(GPIO_PORTB_BASE, GPIO_PIN_3);
    
        /*
         * UART set up
         */
        // Enable pin PA1 for UART0 U0TX
        //
        MAP_GPIOPinConfigure(GPIO_PA1_U0TX);
        MAP_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_1);
    
        //
        // Enable pin PA0 for UART0 U0RX
        //
        MAP_GPIOPinConfigure(GPIO_PA0_U0RX);
        MAP_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0);
    
        /*
         * USB Set up
         */
        // Enable pin PB0 for USB0 USB0ID
        //
        MAP_GPIOPinTypeUSBAnalog(GPIO_PORTB_BASE, GPIO_PIN_0);
    
        //
        // Enable pin PB1 for USB0 USB0VBUS
        //
        MAP_GPIOPinTypeUSBAnalog(GPIO_PORTB_BASE, GPIO_PIN_1);
    
        //
        // Enable pin PD4 for USB0 USB0DM
        //
        MAP_GPIOPinTypeUSBAnalog(GPIO_PORTD_BASE, GPIO_PIN_4);
    
        //
        // Enable pin PD5 for USB0 USB0DP
        //
        MAP_GPIOPinTypeUSBAnalog(GPIO_PORTD_BASE, GPIO_PIN_5);
    }
    
    
    
    int main(void)
    {
    	SysCtlClockSet(SYSCTL_SYSDIV_5|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN);
    	SysCtlDelay(10000);
    	PortFunctionInit();
    	while(1)
    	{
    	i2c();
    	}
    }
    
    int i2c(void)
    {
    	I2CMasterInitExpClk (I2C0_BASE, SysCtlClockGet(), false);
    	SysCtlDelay(10000);
    	I2CMasterSlaveAddrSet (I2C0_BASE, SLAVE, 0);
    
    	//Software Reset
    	I2CMasterDataPut(I2C0_BASE, 0x30);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x00);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x00);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x30);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x01);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x00);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    	while(!I2CMasterBusy(I2C0_BASE));
    
    	/*
    	 * 	Clock and Interface Settings
      	 * 	The codec receives: MCLK = 12.288 MHz,
     	 *	BLCK = 512 kHz, WCLK = 8 kHz
    	 */
    	I2CMasterDataPut(I2C0_BASE, 0x30);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x00);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x00);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    	while(!I2CMasterBusy(I2C0_BASE));
    
    	I2CMasterDataPut(I2C0_BASE, 0x30);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x04);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x03);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x91);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x08);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    	while(!I2CMasterBusy(I2C0_BASE));
    
    	I2CMasterDataPut(I2C0_BASE, 0x30);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x0B);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x82);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x88);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    	while(!I2CMasterBusy(I2C0_BASE));
    
    	I2CMasterDataPut(I2C0_BASE, 0x30);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x0D);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x03);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x00);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    	while(!I2CMasterBusy(I2C0_BASE));
    
    	I2CMasterDataPut(I2C0_BASE, 0x30);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x12);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x88);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x8C);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    	while(!I2CMasterBusy(I2C0_BASE));
    
    	/*
    	 * CONFIGURE PROCESSING BLOCK
    	 */
    	I2CMasterDataPut(I2C0_BASE, 0x30);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x00);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x00);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    	while(!I2CMasterBusy(I2C0_BASE));
    
    	I2CMasterDataPut(I2C0_BASE, 0x30);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x3C);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x02);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    	while(!I2CMasterBusy(I2C0_BASE));
    
    	I2CMasterDataPut(I2C0_BASE, 0x30);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x3D);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x02);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    	while(!I2CMasterBusy(I2C0_BASE));
    
    	/*
    	 * CONFIGURING POWER SUPPLY
    	 */
    	I2CMasterDataPut(I2C0_BASE, 0x30);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x00);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x01);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    	while(!I2CMasterBusy(I2C0_BASE));
    
    	I2CMasterDataPut(I2C0_BASE, 0x30);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x02);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x09);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    	while(!I2CMasterBusy(I2C0_BASE));
    
    	I2CMasterDataPut(I2C0_BASE, 0x30);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x01);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x08);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    	while(!I2CMasterBusy(I2C0_BASE));
    
    	I2CMasterDataPut(I2C0_BASE, 0x30);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x02);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x01);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    	while(!I2CMasterBusy(I2C0_BASE));
    
    	I2CMasterDataPut(I2C0_BASE, 0x30);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x0A);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x3B);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    	while(!I2CMasterBusy(I2C0_BASE));
    
    	I2CMasterDataPut(I2C0_BASE, 0x30);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x3D);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x00);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    	while(!I2CMasterBusy(I2C0_BASE));
    
    	I2CMasterDataPut(I2C0_BASE, 0x30);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x03);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x00);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x00);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    	while(!I2CMasterBusy(I2C0_BASE));
    
    	I2CMasterDataPut(I2C0_BASE, 0x30);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x47);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x32);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    	while(!I2CMasterBusy(I2C0_BASE));
    
    	I2CMasterDataPut(I2C0_BASE, 0x30);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x7B);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x01);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    	while(!I2CMasterBusy(I2C0_BASE));
    
    	/*
    	 * CONFIGURE ADC CHANNEL
    	 */
    	I2CMasterDataPut(I2C0_BASE, 0x30);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x00);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x01);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    	while(!I2CMasterBusy(I2C0_BASE));
    
    	I2CMasterDataPut(I2C0_BASE, 0x30);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x34);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x80);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    	while(!I2CMasterBusy(I2C0_BASE));
    
    	I2CMasterDataPut(I2C0_BASE, 0x30);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x36);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x80);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    	while(!I2CMasterBusy(I2C0_BASE));
    
    	I2CMasterDataPut(I2C0_BASE, 0x30);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x37);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x80);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    	while(!I2CMasterBusy(I2C0_BASE));
    
    	I2CMasterDataPut(I2C0_BASE, 0x30);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x39);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x80);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    	while(!I2CMasterBusy(I2C0_BASE));
    
    	I2CMasterDataPut(I2C0_BASE, 0x30);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x3B);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x0C);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    	while(!I2CMasterBusy(I2C0_BASE));
    
    	I2CMasterDataPut(I2C0_BASE, 0x30);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x3C);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x0C);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    	while(!I2CMasterBusy(I2C0_BASE));
    
    	I2CMasterDataPut(I2C0_BASE, 0x30);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x00);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x00);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    	while(!I2CMasterBusy(I2C0_BASE));
    
    	I2CMasterDataPut(I2C0_BASE, 0x30);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x51);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0xC0);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    	while(!I2CMasterBusy(I2C0_BASE));
    
    	I2CMasterDataPut(I2C0_BASE, 0x30);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x52);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x00);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    	while(!I2CMasterBusy(I2C0_BASE));
    
    	/*
    	 * CONFIGURE DAC CHANNEL
    	 */
    	I2CMasterDataPut(I2C0_BASE, 0x30);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x00);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x01);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    	while(!I2CMasterBusy(I2C0_BASE));
    
    	I2CMasterDataPut(I2C0_BASE, 0x30);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x14);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x25);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    	while(!I2CMasterBusy(I2C0_BASE));
    
    	I2CMasterDataPut(I2C0_BASE, 0x30);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x0C);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x08);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x08);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    	while(!I2CMasterBusy(I2C0_BASE));
    
    	I2CMasterDataPut(I2C0_BASE, 0x30);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x0E);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x08);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x08);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    	while(!I2CMasterBusy(I2C0_BASE));
    
    	I2CMasterDataPut(I2C0_BASE, 0x30);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x09);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x3C);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    	while(!I2CMasterBusy(I2C0_BASE));
    
    	I2CMasterDataPut(I2C0_BASE, 0x30);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x10);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x00);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x00);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    	while(!I2CMasterBusy(I2C0_BASE));
    
    	I2CMasterDataPut(I2C0_BASE, 0x30);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x12);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x00);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x00);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    	while(!I2CMasterBusy(I2C0_BASE));
    
    	I2CMasterDataPut(I2C0_BASE, 0x30);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x00);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x00);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    	while(!I2CMasterBusy(I2C0_BASE));
    
    	I2CMasterDataPut(I2C0_BASE, 0x30);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x41);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x00);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x00);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    	while(!I2CMasterBusy(I2C0_BASE));
    
    	I2CMasterDataPut(I2C0_BASE, 0x30);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x3F);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0xD6);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    	while(!I2CMasterBusy(I2C0_BASE));
    
    	I2CMasterDataPut(I2C0_BASE, 0x30);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x40);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    	while(!I2CMasterBusy(I2C0_BASE));
    	I2CMasterDataPut(I2C0_BASE, 0x00);
    	I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    	while(!I2CMasterBusy(I2C0_BASE));
    
    	return 0;
    }
    
    
     

  • Hello Kelvin,

    Looking at the error message it seems that it is not able to find the original driverlib.lib for the disassembly. You can import the driverlib.lib as a CCS project, recompile it and then use the resulting lib file in the Linker Path.

    Alternatively you can add sysctl.c to the Locate File Button.

    Regards

    Amit

  • hi Amit,

    do you mean like doing as same as the above pic?, if yes, i have linked my file into the project location

    the above are my file directory

  • Hello Kelvin,

    Import the driverlib as shown in the Snapshot, compile it and then use the output driverlib.lib which would be created in the workspace

    Regards

    Amit

  • hi amit

    thank, the error is dissapear, 1 more question, 

    in the i2c devices, it mentioned that

    30 00 00 mean [i2c address] [register] [data]

    curious to ask i m needed to write that data to send it to the devices unfortunately i try both type also not function such as writting register and data only

    I2CMasterDataPut(I2C0_MASTER_BASE, 0x00);
    I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    while(!I2CMasterBusy(I2C0_MASTER_BASE));
    I2CMasterDataPut(I2C0_MASTER_BASE, 0x00);
    I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    while(!I2CMasterBusy(I2C0_MASTER_BASE));

    and write included i2c address of the devices

    I2CMasterDataPut(I2C0_MASTER_BASE, 0x30);
    I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    while(!I2CMasterBusy(I2C0_MASTER_BASE));
    I2CMasterDataPut(I2C0_MASTER_BASE, 0x00);
    I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    while(!I2CMasterBusy(I2C0_MASTER_BASE));

    I2CMasterDataPut(I2C0_MASTER_BASE, 0x00);
    I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    while(!I2CMasterBusy(I2C0_MASTER_BASE));

    both are not function as i aspected, in the driverlib the i2c base address is from the uC but not from the devices, same the slave address from uC, but i not sure after i have set up, included write up the program, but still failed to work. is it correct i write only send i2c data without read data from the devices?

  • Hello Kelvin,

    We just did close the following post. It would be helpful as it has the information you need

    http://e2e.ti.com/support/microcontrollers/tiva_arm/f/908/t/359575.aspx

    Regards

    Amit

  • hi amit

    i have followed the reading through the post, i found out that if i include

    while(!( I2CMasterBusy(I2C0_BASE) ));

    the above code will keep looping non stop

    whileI2CMasterBusy(I2C0_BASE) );

    with the above there is no looping and continue from 1st until end, 

  • Hello Kelvin,

    The above mentioned line is due to the higher core frequency in TM4C129. On TM4C123 you can comment it or put a SysCtlDelay(10) (the latter in case you want to migrate it to TM4C129 later)

    Regards

    Amit

  • i think i have understand on about the explaination included the code. but refer to the one u send me i found that mine have extra component which is write command, since from above code i saw that we only have send and check master busy or not, but there is a write between 1st byte and 2nd byte. is it mean i have to put in an extra command to allow it write. or proceed with the previous way i written.

    thank a lot

  • Hello Kelvin,

    The section of diagram that you have highlighted is centric to any I2C operation. This is done by the API I2CMasterSlaveAddrSet with the third parameter set to false.

    Regards

    Amit

  • hi amit

    i have tried using osc scope, there is a data from SDA line, which mean the data i wanted to have, but just curious to ask, the other devices are non programmable, but need i2c to communicate with it. based on the image bi sent u, do i need to send SCL too for clock?

    each time i try to use the i2c sometime it stuck at command i2cmasterbusy, i have no idea why even with dalay

    there is an error which is cannot load from non-primitive location

    thank

  • Hello Kelvin,

    SCL and SDA are both mandatory for I2C. Can you attach the final code and mark it where it get's stuck?

    Regards

    Amit

  • #include <stdint.h>
    #include <stdbool.h>
    #include "test.h"
    #include "inc/hw_types.h"
    #include "inc/hw_memmap.h"
    #include "inc/hw_gpio.h"
    #include "inc/hw_ints.h"
    #include "inc/hw_uart.h"
    #include "inc/hw_sysctl.h"
    #include "inc/hw_i2c.h"
    #include "driverlib/fpu.h"
    #include "driverlib/systick.h"
    #include "driverlib/sysctl.h"
    #include "driverlib/pin_map.h"
    #include "driverlib/rom_map.h"
    #include "driverlib/debug.h"
    #include "driverlib/interrupt.h"
    #include "driverlib/gpio.h"
    #include "driverlib/uart.h"
    #include "driverlib/rom.h"
    #include "driverlib/i2c.h"
    
    #define SLAVE 0x3B
    //*****************************************************************************
    
    
    
    void
    PortFunctionInit(void)
    {
    
    	//
        // Enable Peripheral Clocks
        //
        MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
        MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_USB0);
        MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_I2C0);
        MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
        MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
        MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);
        MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
        MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
        MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
    
        /****
         * GPIO setting for output
         */
        //
        // Enable pin PA4 PA5 PA6 PA7 for GPIOOutput
        //
        MAP_GPIOPinTypeGPIOOutput(GPIO_PORTA_BASE, GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_6 | GPIO_PIN_7);
    
        //
        // Enable pin PC4 PC5 PC6 PC7 for GPIOOutput
        //
        MAP_GPIOPinTypeGPIOOutput(GPIO_PORTC_BASE, GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_6 | GPIO_PIN_7);
    
        //
        // Enable pin PD3 for GPIOOutput
        //
        MAP_GPIOPinTypeGPIOOutput(GPIO_PORTD_BASE, GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3);
    
        //
        // Enable pin PE0 PE1 PE2 PE3 PE4 for GPIOOutput
        //
        MAP_GPIOPinTypeGPIOOutput(GPIO_PORTE_BASE, GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_4);
    
        //
        // Enable pin PF1 PF2 for GPIOOutput
        //
        MAP_GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_1 | GPIO_PIN_2);
    
        //
        //First open the lock and select the bits we want to modify in the GPIO commit register.
        //
        HWREG(GPIO_PORTF_BASE + GPIO_O_LOCK) = GPIO_LOCK_KEY;
        HWREG(GPIO_PORTF_BASE + GPIO_O_CR) = 0x1;
    
        //
        //Now modify the configuration of the pins that we unlocked.
        //Enable pin PF0 PF3 PF4 for GPIOOutput
        MAP_GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_0 | GPIO_PIN_4 | GPIO_PIN_3);
    
        /***
         * I2C0 set up
         */
    
        // Enable pin PB2 for I2C0 I2C0SCL
        //
        MAP_GPIOPinConfigure(GPIO_PB2_I2C0SCL);
        MAP_GPIOPinTypeI2CSCL(GPIO_PORTB_BASE, GPIO_PIN_2);
    
        //
        // Enable pin PB3 for I2C0 I2C0SDA
        //
         MAP_GPIOPinConfigure(GPIO_PB3_I2C0SDA);
        MAP_GPIOPinTypeI2C(GPIO_PORTB_BASE, GPIO_PIN_3);
    
        /*
         * UART set up
         */
        // Enable pin PA1 for UART0 U0TX
        //
        MAP_GPIOPinConfigure(GPIO_PA1_U0TX);
        MAP_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_1);
    
        //
        // Enable pin PA0 for UART0 U0RX
        //
        MAP_GPIOPinConfigure(GPIO_PA0_U0RX);
        MAP_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0);
    
        /*
         * USB Set up
         */
        // Enable pin PB0 for USB0 USB0ID
        //
        MAP_GPIOPinTypeUSBAnalog(GPIO_PORTB_BASE, GPIO_PIN_0);
    
        //
        // Enable pin PB1 for USB0 USB0VBUS
        //
        MAP_GPIOPinTypeUSBAnalog(GPIO_PORTB_BASE, GPIO_PIN_1);
    
        //
        // Enable pin PD4 for USB0 USB0DM
        //
        MAP_GPIOPinTypeUSBAnalog(GPIO_PORTD_BASE, GPIO_PIN_4);
    
        //
        // Enable pin PD5 for USB0 USB0DP
        //
        MAP_GPIOPinTypeUSBAnalog(GPIO_PORTD_BASE, GPIO_PIN_5);
    }
    
    
    
    int main(void)
    {
    	SysCtlClockSet(SYSCTL_SYSDIV_5|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN);
    	SysCtlDelay(10000);
    	PortFunctionInit();
    	while(1)
    	{
    		I2CMasterInitExpClk (I2C0_MASTER_BASE, SysCtlClockGet(), false);
    		SysCtlDelay(10000);
    		I2CMasterSlaveAddrSet (I2C0_MASTER_BASE, SLAVE, 0);
    
    			I2CMasterEnable(I2C0_MASTER_BASE);
    			//Software Reset
    
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x30);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    		//	while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) ); //here onward keep looping
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x00);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    	//		while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x00);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    //			while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x30);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    	//		while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x01);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    		//	while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x01);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    //			while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    
    			/*
    			 * 	Clock and Interface Settings
    		  	 * 	The codec receives: MCLK = 12.288 MHz,
    		 	 *	BLCK = 512 kHz, WCLK = 8 kHz
    			 */
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x30);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    //			while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x00);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    //			while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x00);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    //			while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x30);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    	//		while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x04);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    		//	while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x03);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    //			while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x30);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    	//		while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x05);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    		//	while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x91);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    	//		while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x30);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    //			while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x06);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    		//	while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x08);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    		//	while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x30);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    //			while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x0B);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    	//		while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x82);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    		//	while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x30);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    //			while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x0C);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    	//		while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x88);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    //			while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x30);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    	//		while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x0D);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    		//	while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    						while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x03);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    //			while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x30);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    	//		while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x0E);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    		//	while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x00);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    	//		while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x30);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    		//	while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x12);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    //			while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x88);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    	//		while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x30);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    //			while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x13);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    //			while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x8C);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    		//	while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    
    			/*
    			 * CONFIGURE PROCESSING BLOCK
    			 */
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x30);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    //			while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x00);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    //			while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x00);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    	//		while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x30);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    		//	while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x3C);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    //			while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x02);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    	//		while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x30);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    		//	while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x3D);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    //			while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x02);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    	//		while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    
    			/*
    			 * CONFIGURING POWER SUPPLY
    			 */
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x30);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    		//	while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x00);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    //			while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x01);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    	//		while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x30);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    		//	while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x02);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    //			while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x09);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    	//		while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x30);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    		//	while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x01);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    //			while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x08);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    	//		while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x30);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    		//	while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x02);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    //			while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x01);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    	//		while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x30);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    		//	while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x0A);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    //			while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x3B);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    	//		while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x30);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    		//	while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x3D);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    //			while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x00);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    //			while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x30);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    	//		while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x03);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    		//	while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x00);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    //			while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x30);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    	//		while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x04);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    		//	while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x00);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    	//		while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x30);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    		//	while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x47);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    //			while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x32);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    	//		while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x30);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    		//	while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x7B);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    //			while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x01);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    	//		while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    
    			/*
    			 * CONFIGURE ADC CHANNEL
    			 */
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x30);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    		//	while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x00);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    //			while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x01);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    	//		while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x30);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    		//	while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x34);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    //			while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x80);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    	//		while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x30);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    		//	while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x36);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    //			while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x80);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    	//		while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x30);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    		//	while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x37);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    //			while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x80);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    	//		while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x30);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    		//	while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x39);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    //			while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x80);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    	//		while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x30);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    		//	while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x3B);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    //			while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x0C);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    	//		while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x30);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    		//	while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x3C);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    //			while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x0C);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    	//		while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x30);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    	//		while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x00);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    		//	while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x00);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    //			while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x30);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    	//		while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x51);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    		//	while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0xC0);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    //			while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x30);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    	//		while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x52);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    		//	while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x00);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    //			while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    
    			/*
    			 * CONFIGURE DAC CHANNEL
    			 */
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x30);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    	//		while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x00);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    		//	while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x01);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    //			while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x30);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    	//		while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x14);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    		//	while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x25);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    //			while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x30);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    	//		while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x0C);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    		//	while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x08);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    //			while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x30);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    //			while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x0D);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    //			while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x08);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    	//		while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x30);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    		//	while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x0E);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    //			while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x08);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    	//		while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x30);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    		//	while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x0F);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    //			while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x08);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    		//	while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x30);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    //			while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x09);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    	//		while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x3C);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    		//	while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x30);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    //			while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x10);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    	//		while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x00);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    		//	while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x30);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    //			while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x11);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    //			while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x00);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    //			while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x30);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    	//		while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x12);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    		//	while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x00);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    //			while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x30);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    	//		while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x13);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    		//	while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x00);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    	//		while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x30);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    		//	while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x00);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    //			while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x00);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    	//		while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x30);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    		//	while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x41);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    //			while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x00);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    	//		while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x30);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    //			while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x42);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    //			while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x00);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    		//	while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x30);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    //			while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x3F);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    	//		while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0xD6);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    		//	while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x30);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_START);
    //			while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x40);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
    	//		while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    			I2CMasterDataPut(I2C0_MASTER_BASE, 0x00);
    			I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
    		//	while(!( I2CMasterBusy(I2C0_MASTER_BASE) ));
    			SysCtlDelay(100);
    			while( I2CMasterBusy(I2C0_MASTER_BASE) );
    
    	}
    }
    

    the one in green comment (line number 156)

  • Hello Kelvin,

    That could be the case if you halted the code in the middle of a transmission that could have caused the Slave to get stuck.

    To ensure that the Master is not stuck, can you add the following code to the PortFunctionInit!!!

    MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_I2C0);

    with

    MAP_SysCtlPeripheralDisable(SYSCTL_PERIPH_I2C0);

    MAP_SysCtlPeripheralReset(SYSCTL_PERIPH_I2C0);

    MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_I2C0);

    Regards

    Amit

  • hi amit

    i m still stuck at the same line which i have mentioned just now

  • Hello Kelvin,

    The debug cannot happen without knowing what slave device you have. Can you send the datasheet of the slave device,

    Regards

    Amit

  • hi Amit

    below are data sheet of the devices

    http://www.ti.com/lit/ds/symlink/tlv320aic3204.pdf

    application reference guide

    http://www.ti.com/lit/ml/slaa557/slaa557.pdf

    thank a lot

    Kelvin

  • Hello Kelvin

    The I2C Address of this device is 0x18 and not 0x38. This is very clearly mentioned in the data sheet and application note, unless I am missing something in the documentation

    Regards

    Amit

  • hi amit

    i think i have mistake as i tot i using the slave address from uC rather than using the slave address from the device as i mentioned above

    i m still having problem of the program still keep looping meaning the i2c master are busy all the time after the 1st byte been sent out

  • Hello Kelvin,

    Can you attach a scope screenshot of what the transaction is looking as?

    Regards

    Amit

  • hi amit

    below are the scope for SDA, SCL will be zero all the time

    while i connect to the devices, there is noise occur and the i2c signal lost

    when i try using step over in CCS, found that it stuck at i2cMasterbusy

    therefore i have no idea why it stuck at i2cmasterbusy

  • Hello Kelvin

    I2C SCL cannot be 0. Is the Pull Up on SCL and SDA there on your board.

    Regards

    Amit

  • there is an pull up in other devices, but signal losses when it is connected to other board

  • Hello Kelvin,

    The Pull is needed for the bus to operate. So you should complement the pull up of the devices with an on-board pull up for the bus, so that even if you connect any new device which does not have an internal pull up, the protocol can work properly.

    I hope I am able to explain it well

    Regards

    Amit

  • which mean that, i need another pull up for the uC and another pull up for the devices?

    as i saw that there are a pull up in the devices which i need to i2c but no pull up for uC, 

    will try out and let u know sooner

  • Hello Kelvin,

    No. You would need only 1 set of Pull Up for both uC and the devices. However the Pull up needs to be there on SCL and SDA

    Can you draw a simple diagram of the connection between the uC and slave devices and where pull up's are present with what value. This is important as we need to understand and resolve why SCL line is always low.

    Regards

    Amit

  • hi amit

    below are my own design for i2c

    meanwhile on the other hand using evaluation board for the other devices as following

    where the iovdd is 3.3V

  • Hello Kelvin,

    It is correct: As long when configured for I2C, you see both SCL and SDA during bus idle state.

    In the second snapshot  are the Jumpers mounted and SCL and SDA shown coming from the uC which is somewhere in the schematic. The Pad SCL and SDA shown in the right side of the picture would be some header for other devices?

    Regards

    Amit

  • the 2nd pic is come from the evaluation board of the devices itself which i have sent u the data sheet and the application note

    i will try a trick which will be doing an external pull up for SDA and SCL