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: TMS570LS12x Hercules Development Kit (HDK) I2C not working

Part Number: TMS570LS1227
Other Parts Discussed in Thread: HALCOGEN

Hi,

I am trying to get the I2C on a TMS570LS12x Hercules Development Kit (HDK) (TMS570LS1227ZWT) working, but am not succeeding. SPI/SCI/CAN/etc. is working great, but I can't get I2C to work.

My hardware setup:
MCP23017 I/O Expander connected to the HDK.
SCL connected pin71 on J11 (pin C3 on ZWT)
SDA connected to pin 72 on J11 (pin B2 on ZWT)
MCP23017 is on a breadboard and is supplied with 3.3V (VDD), !RESET is also connected to 3.3V.
GND (VSS on MCP23017) is connected to both breadboard power supply and pin 80 on J11 on the HDK (GND). So there is common GND.
I have 2k2 pullups to 3V3 on both SDA and SCL. Address pins on the MCP23017 are all tied to GND so the slave address should be 0x20.

I attached a scope to both SCL and SDA lines.

I configured the project with HALCOGEN as follows:

My code:

int main(void)
{
/* USER CODE BEGIN (3) */
	uint16 MCP23017_ADDRESS = 0x20;
	uint8 IODIRA           = 0x00;

  i2cInit();
  i2cSetSlaveAdd(i2cREG1, MCP23017_ADDRESS);
  i2cSetDirection(i2cREG1, I2C_TRANSMITTER);
  i2cSetMode(i2cREG1, I2C_MASTER);
  i2cSetStop(i2cREG1);
  i2cSetStart(i2cREG1);
  i2cSendByte(i2cREG1, IODIRA);
  while(i2cIsBusBusy(i2cREG1));

  while(!i2cIsStopDetected(i2cREG1));

  i2cClearSCD(i2cREG1);
/* USER CODE END */

    return 0;
}

The code hangs on whule i2cIsBusy().
At program start, both SCL and SDA are high. When I set a breakpoint after i2cSetStart() I am seeing that both SCL and SDA are pulled low (0V) (???). During i2cSendByte I see the SDA is going high (3.3V) for a short period and then returning to low. SCL remains low. I don't see any clock pulses.

Any idea what I am doing wrong?

Any help is greatly appreciated!

Thanks,

Vincent