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.

TMS570LS1227 HDK using I2C

Other Parts Discussed in Thread: TMS570LS1227, HALCOGEN

Hi,


i want to know what I have to activate to use the I2C-pins of my TMS570LS1227 ZWT 337.

I activated the I2C driver and I2C under PINMUX. In the Technical Reference Manual I found the SDA and SCL-Pin in the Bottom-Line under B2 and C3.

But when I connect these pins and run the command i2cSetStart, the i2c-port does not pull the line down to mass.

Do I have to calibrate anything more to use the bottom connectors of the board?


Greeetings,

Rene

  • First of all, you need to have strong pull up resistors (~5K) on those two I2C pins. If you want to check I2C communication, you need to have a I2C master/slave pair. Without acknowledgement from slave, Master will stop after sending the address/R/W byte.

    To check if pinmux is done correctly, you can set those two pins as GPIO output by configuring the I2C pin control registers and check if they can be toggled. By default, they are configured as GPIO inputs.

    Thanks and regards,

    Zhaohong
  • I am confused which resistors i have to use now.
    So I will set 5K resistors from Vdd to SDA and SCL.
    What is with the I2C Port Settings in HALCoGe? Do I have to disable the SDA pullup and SCL pullup there?

    Rene
  • The internal pull up/down resistors are only useful when the I/O is configured as GPIO when you want to the pin to be floating. They are very weak and not suitable for I2C operation. Enable or disable them does not make a difference.

    Thanks and regards,

    Zhaohong
  • It seems I have a configuration problem.
    I use the same example like in HALCoGen TMS570LS12x Help 04.04.00 example_i2cMaster_TX_RX.c
    As slave I use a SainSmart IIC/I2C/TWI 1602 Serial LCD Module Display with Address 0x3F.
    For now it does not matter if the example is not made for the I2C display. Like you said I need to have a slave for ACK.
    I just wanted to obseve the I2C-signals of my TMS570 as master on my oscilloscope, but i do not see any movements in the signals.
    The voltage levels are constant on 5V without any movement. Pullup resistors on SDA and SCL are 5K Ohm.

    Is there a step by step guide how i configure I2C for my TMS570 board?
    I found a pdf to emulate I2C with N2HET. Maybe i can drive I2C over this?

    Thanks for help!

    Rene
  • First, you need to check if pinmux is configured correctly for I2C. You can use the method I propose earlier. You can only test I2C function after verifying that the pinmux is done correctly.

    Thanks and regards,

    Zhaohong
  • I dont know exactly how i change the I2C-pins to GIO.
    Is it in the I2C Port-Tab in HalCoGen or do I just have to use gio-methods and i2cPORT1 like:

    gioSetDirection(i2cPORT1, 0xFFFFFFFF);

    for (i = 0; i < 32; i++)
    gioSetBit( i2cPORT1, i, 1 );

    Can you give me a hint how i can toggle I2C-pins with gio-methods?

    Thanks!

    Rene
  • Now i could toggle the SCL pin, but not SDA.
    I configured I2C Port to GIO in HalCoGen. My example looks like this:

    i2cInit();

    gioSetDirection(i2cPORT1, 0x00000000);

    for (i = 0; i < 1000000; i++);

    gioSetDirection(i2cPORT1, 0x00000003);

    for (i = 0; i < 1000000; i++);

    gioSetDirection(i2cPORT1, 0x00000000);

    for (i = 0; i < 1000000; i++);

    gioSetDirection(i2cPORT1, 0x00000003);

    When I change pins direction of the port i observe toggling the SCL signal on my oscilloscope, but SDA is not moving.
    Do you know why there is no reaction?
    For my understanding SCL is bit 0 and SDA is bit 1 in i2cPORT1.

    Thanks!
    Rene
  • You can try the following steps.

    (1) In Halcogen, first enable I2C driver. In the I2C config page, select pin function as GIO and enable the output buffer. Generate the code.
    (2) use the following code sequence.

    i2cInit(); //set I2C pins as GIO output and output low
    while(1)
    {
    i2cREG1->DOUT = 0x3; //set both pins high
    for (i = 0; i < 1000; i++); //delay
    i2cREG1->DOUT = 0x0; //set both pins low
    for (i = 0; i < 1000; i++);
    }

    You should see both pins toggling continuously if the pinmux is configured correctly.

    Thanks and regards,

    Zhaohong
  • I was able to test the program on another TMS570 HDK, lets name it Board B.

    It works like a charm on B. No problem with I2C at all.

    Board A otherwise has problems with I2C pins. But i can use the CAN ports and GIOPortA-pins without any problems.

    I noticed that the temperature of the TMS570LS1227 case on the board gets very hot when i feel it with my finger.

    Could it be a production fault?


    Thanks and Regards

    Rene

  • If the supply voltages and the clock are correct at the device, there could be some issue in the device.

    Thanks and regards,

    Zhaohong