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.

TM4C1231E6PM - I2C interface issue

Other Parts Discussed in Thread: TM4C1231E6PM

Hi, I am facing issue with I2C interface with TM4C1231E^PM. Kindly verify my program and advise

TM4C1231E6PM  PA6 SDA and PA7 SCL connected with RTC DS1307.

program written same as given in application example. please suggest

what exactly problem with software.

our code as follows.
/ i2c init
           
            SysCtlPeripheralReset(SYSCTL_PERIPH_I2C1);
          SysCtlPeripheralEnable(SYSCTL_PERIPH_I2C1);
            SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);

    //
    // Enable port PA7 for I2C1 I2C1SDA
    //
            GPIOPinConfigure(GPIO_PA7_I2C1SDA);
            GPIOPinTypeI2C(GPIO_PORTA_BASE, GPIO_PIN_7);

    //
    // Enable port PA6 for I2C1 I2C1SCL
    //
            GPIOPinConfigure(GPIO_PA6_I2C1SCL);
            GPIOPinTypeI2CSCL(GPIO_PORTA_BASE, GPIO_PIN_6);
       
            I2CMasterInitExpClk(I2C1_BASE, SysCtlClockGet(), false);    // data rate 100kbps   
            I2CMasterEnable(I2C1_BASE); // master enable
           
            I2CMasterSlaveAddrSet(I2C1_BASE,0xD0,false); // a write
           
            while(I2CMasterBusBusy(I2C1_BASE));
   
            I2CMasterDataPut(I2C1_BASE,00); // write address(MSB) for the starting location
            I2CMasterControl(I2C1_BASE,I2C_MASTER_CMD_BURST_SEND_START); //start a burst write operation
            while(I2CMasterBusy(I2C1_BASE)); //check if the operation is over; 1 = busy
            I2CMasterDataPut(I2C1_BASE,0x00); // write address(MSB) for the starting location
            I2CMasterControl(I2C1_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
            while(I2CMasterBusy(I2C1_BASE)); //check if the operation is over; 1 = busy
                           
            I2CMasterDataPut(I2C1_BASE,0x07); // write address(MSB) for the starting location
            I2CMasterControl(I2C1_BASE,I2C_MASTER_CMD_SINGLE_SEND); //start a burst write operation
            while(I2CMasterBusy(I2C1_BASE)); //check if the operation is over; 1 = busy
            I2CMasterDataPut(I2C1_BASE,0x90); // write address(MSB) for the starting location
            I2CMasterControl(I2C1_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
            while(I2CMasterBusy(I2C1_BASE)); //check if the operation is over; 1 = busy

 Regards     Atul Bhakay

  • Hello Atul,

    But what exactly is the problem? Bus Fault, I2C IO not working, I2C IO working but code hung?

    Regards

    Amit

  • Hi, I am not able to communicate wit external IC which is on I2C protocol. So what could be the issue?

    Regards   Atul Bhakay

  • Atul Bhakay said:
      I2CMasterSlaveAddrSet(I2C1_BASE,0xD0,false); // a write

    Is that (highlight, above) really a valid, Slave, I2C Address?  Recall that Stellaris/rebrand-Ware automatically supply the R/W bit.  Thus - your Dallas (now Maxim) RTC must have a specified I2C address of 0x7X for such translation here to, "0XDX." 

    Suspect that you'd better assist Amit (& this reporter) by providing a brief narrative - outlining your code's intent - along w/the code listing...