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.

TMS320F28377S: I2c bit shift

Part Number: TMS320F28377S
Other Parts Discussed in Thread: C2000WARE

I using the  f28377 with  i2c epprom library,   the problem is the data presented to the bus is shifted shifted to the left.

for example, writing 0xF0 (address) then observing  the o-scope  the first byte out is 0xE0. 

code:

I2caRegs.I2CSAR.all = 0xF0, 

Settings:

I2caRegs.I2CMDR.bit.FDF = 0;
I2caRegs.I2CMDR.bit.XA = 0;
I2caRegs.I2CMDR.bit.BC = 0x7;

why is this the case?

  • Hi JB,

    With your setup your data should look something like this (But R/~W being 0 instead of 1 for write).

    When you say you're using the I2C epprom library do you mean you're going off of the eeprom example in C2000Ware which uses FIFO mode? Could you share your I2C initialization code?

    Thanks,

    Kevin

  • the library file is i2c_eeprom, from  C2000Ware_1_00_01_00.

    I2Cinit(){

    I2caRegs.I2CSAR.all = 0x0050; // Slave address - EEPROM control code

    I2caRegs.I2CPSC.all = 6; // Prescaler - need 7-12 Mhz on module clk
    I2caRegs.I2CCLKL = 10; // NOTE: must be non zero
    I2caRegs.I2CCLKH = 5; // NOTE: must be non zero
    I2caRegs.I2CIER.all = 0x24; // Enable SCD & ARDY __interrupts

    I2caRegs.I2CMDR.all = 0x0020; // Take I2C out of reset
    // Stop I2C when suspended

    I2caRegs.I2CFFTX.all = 0x6000; // Enable FIFO mode and TXFIFO
    I2caRegs.I2CFFRX.all = 0x2040; // Enable RXFIFO, clear RXFFINT,

    I2caRegs.I2CMDR.bit.FDF = 0;
    I2caRegs.I2CMDR.bit.XA = 0;
    }

    The address write:

    I2caRegs.I2CSAR.all = 0xF0;  //msg->SlaveAddress;

    thanks JB

  • Hi JB,

    I don't see an i2c_eeprom "library" within c2000ware, only example programs.

    Regardless of that, could I see your I2C write function that you're having the issue with? That will give me more clarity than just the init function. Also if you could provide a screen capture of the waveform seen when writing the address to the slave.

    Thanks,
    Kevin
  • found the problem thanks
  • Great! Happy you discovered what was wrong.

    Would you mind sharing what the problem/solution was? This could help someone else in the future that is facing the same issue.