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.

CCS/TMS320F28335: Interfacing I2C driver with TMS320F28335

Part Number: TMS320F28335
Other Parts Discussed in Thread: C2000WARE

Tool/software: Code Composer Studio

hi Exports,

Now i am currently working on I2c Driver, but i don't have any example code to wrote.

i  have only EEPROM based code only , so could any one help me for Driver controller code.

 Thanks

hari

  • Hi Hari,

    This post contains some software that you can reference:

    https://e2e.ti.com/support/microcontrollers/c2000/f/171/t/773846

    You can also reference the i2c example in c2000ware through the following file path:

    C:\ti\c2000\C2000Ware_3_02_00_00\device_support\f2833x\examples\i2c_eeprom

    Thanks

  • thank you for the replay.

    here i am using the driver TM1640 i think the base address of this driver is 0x40 (is this base address correct ?).

    still am not getting the output, please follow my code.. and check if any corrections needs.

    ////////////////////////////////////////////////////////////////////////////////////////////

    in main() i am sending 
       {

    TM1640_init(0x8F);                                    Delay(0x55);
    TM1640_send_command(0x88 | 0x07);    Delay(0x55);
    TM1640_send_data(1, 0x32);                   Delay(0x55);
    TM1640_send_data(2, 0x33);                   Delay(0x55);

       }

    //***** setting 1 MHz clock for slave device *******//

    void I2CA_Init(void)
    {
    I2caRegs.I2CSAR = 0x0040;  //slave base address 
    I2caRegs.I2CPSC.all = 3;  //(150Mhz/(3+1) = 37.5 Mhz)
    I2caRegs.I2CCLKL = 10; 
    I2caRegs.I2CCLKH = 5; 
    I2caRegs.I2CIER.all = 0xC4;

    I2caRegs.I2CMDR.all = 0x0020; 
    I2caRegs.I2CFFTX.all = 0x6000; 
    I2caRegs.I2CFFRX.all = 0x2040;

    return;

    }

    ///************ data sending procedure **********///

    void TM1640_write( unsigned char Byte )
    {
      I2caRegs.I2CSAR = 0x40;

      I2caRegs.I2CCNT = 1;

      I2caRegs.I2CDXR = Byte;
      I2caRegs.I2CMDR.all = 0x6E20;

      Delay(0xFFF);//Delay(0xFFF);
    }

    interrupt void i2c_int1a_isr(void) //I2C_Int1
    {
     Uint16 IntSource;

     IntSource = I2caRegs.I2CISRC.all;
     if(IntSource == 0x0003 )
     {
        if(I2caRegs.I2CSTR.bit.NACK == 1)
        {
         I2caRegs.I2CMDR.bit.STP = 1;
         I2caRegs.I2CSTR.all = 0x0002;
        }

      }
     else{}

         PieCtrlRegs.PIEACK.all = PIEACK_GROUP8;

    }

    ///////////////end of data sending procedure //////////////////

    void TM1640_init(unsigned char brightness_level)
    {
       TM1640_send_command(auto_address);
       TM1640_send_command(brightness_level);
       TM1640_clear_display();
    }

    void TM1640_send_command(unsigned char value)
    {
       TM1640_write(value);
    }

    void TM1640_send_data(unsigned char address, unsigned char value)
    {
       TM1640_send_command(fixed_address);
      TM1640_write((0xC0 | (0x0F & address)));
      TM1640_write(value);
    }

    void TM1640_clear_display()
    {
        unsigned char s = 0x00;
        TM1640_write(start_address);
        for(s = 0x00; s < no_of_segments; s += 0x01)
      {
       TM1640_write(font[0]);
      }
    }

  • Hi Hari,

    Can you please find documentation and find out how to communicate with the TM1640 as this is not a device that we support.

    If you have a specific question about the  TMS320F28335 we can help there.

    Thanks

  • Thank you for the replay,

    as you say i am following the doc which you suggest and thank you for your replay

    i think it could resolve.

    thank you

    hari haran