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.

TMS570LS3137: I2C Problem

Other Parts Discussed in Thread: HALCOGEN

Hi everyone, I am new to i2c and TMS570. I have some issues developing communication between my TMS570LS3137ZWT and MPL3115A2 pressure sensor using i2c interface. I first use the oscilloscope to check the signal from TMS570 without connecting to the sensor.

Here is my setting in HALCoGen:
1. Enable I2C Driver only
2. Check I2C only in Pinmux
3. Others pls check the image below


http://i.imgur.com/FTXpMnUl.jpg 
http://i.imgur.com/J47o0L3l.jpg
http://i.imgur.com/ILXJ3lOl.jpg
http://i.imgur.com/e9aPJkll.jpg

And for all the case below the own_add is 0x20

I have eight questions about the i2c question:

1. How can I avoid the own_address in the start condition or it is unavoidable?

i2cInit();
i2cSetOwnAdd(i2cREG1,own_add);
i2cEnableLoopback(i2cREG1);
i2cSetStart(i2cREG1);
i2cSendByte(i2cREG1,0xFF);
while(1);

from the above the codding I expected there is only a start condition followed by a oxFF signal,However, the first byte is always the own_add (you can change it by you can't remove).  is it normal or is it unavoidable?

Case1 - With Setstart and 0xFF
http://i.imgur.com/LwTdTnU.jpg

Case2 - SetStart without 0xFF
http://i.imgur.com/0DeuztY.jpg

 

2. Why EnableLoopBack function  is necessary?

from same set of code the EnableLoopBack function is necessary. Without that signal an unknown is found. It is normal? What is the purpose of it?

Case3 - EnableLoopBack with 0xAA
http://i.imgur.com/GhB5Elb.jpg

Case4 - Without EnableLoopBack
http://i.imgur.com/nljdZe4.jpg


3) How can I generate the second start condition

I try to ignore the own_address and EnableLoopBack issue, I cannot generate the second start condition.

Case5 - First Setstart before 0xFF, Second SetStart after 0xFF
http://i.imgur.com/RuaFanR.jpg

Case6 - First SetStart Only, no second one
http://i.imgur.com/BkHkphb.jpg

4)  Why I can only send 2 bytes ?

In Case 7 there should be 3 0xFF signal but at last only two are generated.

Case7 - Three SendByte Function
http://i.imgur.com/xEvUL1W.jpg

5) In the official example from HALCoGen, only 8 characters (8 bytes are sent)

Case8 - LES
http://i.imgur.com/RFllUHZ.jpg

Case9 - LEZ
http://i.imgur.com/KAFGBrW.jpg

6) I cannot generate a Stop Condition

Case10 - With SetStop function
http://i.imgur.com/m15N3bF.jpg

Case11 - Without SetStop function
http://i.imgur.com/JY02owC.jpg



7) ~transmitter

I set ~ transmitter after 0xFF, but the changes appear before 0xFF. How does it happen?

Case 12 - with ~I2CTRANSMITTER after 0xFF
http://i.imgur.com/6DN7YLu.jpg

Case13 - without ~I2CTRANSMITTER after 0xFF
http://i.imgur.com/MfMSYDq.jpg

 

8) Ack Bit

In fact the TMS570 only connected to oscilloscope. I expected that the ack bit is always 1 as no sensor is present. However, in all the case above the ack bit is always 0, how does it happen?

At last, I just want to generate a basic communication like:

Start Condition - Slave Address Write - Start Condition - Slave Address Read - Feedback from Sensor - Stop

Can you suggest how can I do this?

Thanks for your kind attention.

Man Choi

  • (1) For a I2C master, the data and clock pins are open drain. You have to add external resistors on those two pins.
    (2) In master transmission, the data pin becomes input during the ACK phase. You have to hookup to a working slave to see the ACK signal. You will be able to see the transmission data in the receive register when the loopback mode is enabled. However, you will not be able to see the ACK signal in loopback mode.

    Please check the I2C section in the TRM or I2C protocol spec for more details.

    Thanks and regards,

    Zhaohong
  • Hi Zhaohong, Thanks for your reply. (1) I am using the development kit with breakout board. Do you mean that I should not connect it to the oscilloscope directly to observe the signal generated by the MCU (2) What I mean is, when I connect it to the oscilloscope directly with no slave present, the ACK bit is 0, which I expect that it should be 1 as neither the MCU nor any slave pull down the signal. Thanks Man