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 codes for tms320c5515

Other Parts Discussed in Thread: TMS320C5515

Hi everyone,

I am running the code "CSL_I2C_PollExample" given in CSL library.While going through the code I have found out that the i2c slave register is only getting loaded with corresponding slave address.And in that code we are not transmitting the slave address to I2C bus explicitly.I am not understand how can the value of slave register of c5515 will get transmitted automatically.I have checked the ICDXR register.From there i have not seen any slave being transmitted except my data.Can anyone explain to me how it is getting transmitted or do i need to transmit it explicitely.i hav eused the same API as mentioned in that example code.But I am unable to get any data from my SLave device.I am not even understanding that my slave is responding or not.Please help me with this

Thanks

Arun

  • Hi,

    Team is working on and your request will be addressed as soon as they can.

    Thanks & regards,

    Sivaraj K

  • Hi,

    Refer to the section 2.11.1 of the sprufo1a. This provides the details on I2C operation.

    For I2C to start  "Start the transfer by setting STT = 1 in ICMDR. The I2C controller will start the transfer using the 7-bit addressing format (format as described in section 2.6.1 in sprufo1a)

    Also ensure that, value should be selected in such a way that the frequency is between 6.7 and 13.3 MHz. This configuration is done in ICPSC register.

    You could also refer to other I2C CSL example like "CSL_I2C_CodecTestExample" which is close to what you are looking for.

    Hope the above helps.

    - Vasanth

     

     

  • Hi  Sivaraji ,vasanth

    I have gone through the details as you suggested.I have checked the scl and sda line with logic sniffer.My scl and sda lines are always high.I have used the same API s as described in the I2C examples.But my SCL line is always high.As i think if clock line is not acting as a clock then the rest of the I2c operation will also not possible.Help me with this.

    thanks

    Arun

  • Hi Sivaraj

    Thanks for your reply.I have monitored my I2c line with logic sniffer and i have found out that my SCL and SDA line are always in high impedence state.they are both pulled to vcc.I have initialised the I2C module using the I2c_init Api as described in the CSL examples.I am not understanding what I am missing.Your any sorts of help will be highly appreciated.

    Thanks

    Arun

  • Hi Arun,

    As mentioned above, setting the STT in ICMDR the I2C state-machine will initiate the I2C transfer and the 7/10-bit slave address will be sent on the bus, IF everything as mentioned in Section6.2.11.1 "Configuring the I2C in Master Receiver Mode and Servicing Receive Data via CPU" (The initialization sequence for transmitter is similar to receiver except for the TRX bit which has to be set instead of being cleared)

    http://www.ti.com/lit/ug/spruh16/spruh16.pdf

    Would you be using the C5515 EVM or a custom board? The I2C POLL example used as-it-is is tried and tested on the EVM. If you're using a custom board, and the I2C SCL and SDA lines are in highh-impedence, it might mean any of the following: the I2C module isn't initialized properly, might still be stuck in reset, didn't find a slave with the address that the test uses. The I2C POLL example configures the I2C as a master in the transmitter mode and tries to write and read from an EEPROM which is the I2C slave with the slave-address 0x2F. If the slave isn't found, the i2c bus would remain suspended (scl high-impedence).

    Best Regards.

  • Hi KRaviS,

    I am using the tms320c5515 ezdsp usbstick board.I did some mistake earlier i think,now i can see the clock line in logic siniffer.I am confused about the fact that do i have to send the slave address of my ADC explicitely as a data or it would transmitted automatically if i write into slave register with that slave address.I have given the start condition but my sda line is not getting low from the initial high state.As per the document mentioned after being in master mode i should write into the start bit of ICMDR register.But i am not seeing any start condition to happen in sda line.

    Thanks alot

    Arun

  • Hi Arun,

    You don't have to send the slave address explicitly as a data byte. If it would have been so, a Slave Address register ICSAR wouldn't have been needed at all. As soon as the STT bit is set, if all initialization steps as mentioned in the section cited above are followed, the I2C state machine should send out the slave address on the bus looking for an acknowledgement from a slave having the sent address. The I2C controller waits for a single SCL cycle after teh R/nW bit for the slave to insert the acknowledgement bit. If the same is received by the master, the master transmits subsequent set of data bytes. If it doesn't the I2C bus becomes free to be used by other devices on it.

    If the C5515 I2c is being used as the master and the ADC as a slave, first two things to be checked would be if the C5515 I2C is generating the SCL clock according to the specifications in the manual, and if the slave address of the ADC is rightly fed in the ICSAR register bfore setting STT.

    Best Regards.