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.

EK-TM4C1294XL I2C communication problem

Hello,

I'm trying to communicate with the chip FT5306, which is a Capacitive Touch Panel Controller. It already came pre-assembled on a controller board, and I used a 6-pin ribbon cable to connect the launchpad to that controller board witt the FT5306 on it. The 6 pins are: 1) VDD; 2) GND; 3) SCL; 4) SDA; 5) INT; 6) RESET. When I press down on the touch panel, the INT signal goes LOW, showing detection, so I know that that part is connected properly. However, when I try to send and read data to the touch panel, it doesn't seems to be doing anything. Thus, I believe that if I can solve my problem with the I2C communication, my other problem should also go away as well.

I hooked up an oscilloscope and attached 2 probes, one to the SDA signal and one to the SCL signal. The waveform looks.....wack. It doesn't look like a normal I2C waveform (based on the pictures I've seen online; I'm very new to I2C). Also, I would like to mention that I have a 4.7 kOhm pull-up resistor on both SDA and SCL (not sure if that's an okay resistance). So below are the 4 pics that I took of the oscilloscopes. The dark blue is SDA, while the teal is the SCL. The picture will be in the following order: 1) Probe on SDA, not touching the touch panel; 2) Probe on SDA, touching the panel; 3) Probe on SDA & SCL, no touch; 4) Probe on SDA & SCL, touch.

Here is my I2C initialization code:

void initTouchPanel()
{
	//
	// Enable the peripherals to be used.
	//
	MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_I2C0);
	MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
	MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOL);

	//
	// Waits for peripherals to be ready.
	//
	while (!MAP_SysCtlPeripheralReady(SYSCTL_PERIPH_I2C0) &&
			!MAP_SysCtlPeripheralReady(SYSCTL_PERIPH_GPIOL) &&
			!MAP_SysCtlPeripheralReady(SYSCTL_PERIPH_GPIOB));

	//
	// Configure PB2 and PB3 for I2C
	//
    MAP_GPIOPinConfigure(GPIO_PB2_I2C0SCL);
    MAP_GPIOPinConfigure(GPIO_PB3_I2C0SDA);

    //
    // Select I2C function for PB2 and PB3
    //
    MAP_GPIOPinTypeI2CSCL(GPIO_PORTB_BASE, GPIO_PIN_2);
    MAP_GPIOPinTypeI2C(GPIO_PORTB_BASE, GPIO_PIN_3);

	//
	// Configure pin PL4 as input. INT. (Remember to change to PL6 later)
	//
	MAP_GPIOPinTypeGPIOInput(GPIO_PORTL_BASE, GPIO_PIN_4);

	//
	// Configure pin PL5 as output. RESET. (Remember to change to PL7 later)
	//
	MAP_GPIOPinTypeGPIOOutput(GPIO_PORTL_BASE, GPIO_PIN_5);

	//
	// Drive PL5 HIGH. (Data sheet says to keep it HIGH).
	//
	MAP_GPIOPinWrite(GPIO_PORTL_BASE, GPIO_PIN_5, 0x20);
}

Interface Functions:

bool touchPanelInputDetect()
{
	int32_t interrupt_signal = 0;

	//
	// Read interrupt signal sent from touch panel.
	//
	interrupt_signal = MAP_GPIOPinRead(GPIO_PORTL_BASE, GPIO_PIN_4);

	//
	// Input detected if interrupt signal is LOW.
	//
	if (!interrupt_signal)
	{
		return true;
	}

	return false;
}

void touchPanelReset(uint32_t g_ui32SysClock)
{
	MAP_GPIOPinWrite(GPIO_PORTL_BASE, GPIO_PIN_5, 0x00);
	MAP_SysCtlDelay(g_ui32SysClock / 3 / 2); // 500 ms delay
	MAP_GPIOPinWrite(GPIO_PORTL_BASE, GPIO_PIN_5, 0x20);
}

void touchPanelRead(uint32_t g_ui32SysClock)
{
	uint32_t touch_points = 0;

	//
	// Configure and enable master.
	//
	MAP_I2CMasterInitExpClk(I2C0_BASE, g_ui32SysClock, false);

	//
	// Set slave address.
	//
	MAP_I2CMasterSlaveAddrSet(I2C0_BASE, 0x39, true);

	//
	// Initiate master single receive.
	//
	MAP_I2CMasterControl(I2C0_BASE, I2C_MASTER_CMD_SINGLE_RECEIVE);

	//
	// Wait for master to finish transaction.
	//
	while (MAP_I2CMasterBusy(I2C0_BASE));

	//
	// Perform error check.
	//
	if (MAP_I2CMasterErr(I2C0_BASE) == I2C_MASTER_ERR_NONE)
	{
		//
		// Get data from touch panel.
		//
		touch_points = MAP_I2CMasterDataGet(I2C0_BASE);

		UARTprintf("%d touch points detected.\n\n", touch_points);
	}
	else
	{
		UARTprintf("Error = %d\n\n", MAP_I2CMasterErr(I2C0_BASE));
	}
}

void touchPanelWrite(uint32_t g_ui32SysClock, uint8_t ui8Data)
{
	//
	// Configure and enable master.
	//
	MAP_I2CMasterInitExpClk(I2C0_BASE, g_ui32SysClock, false);

	//
	// Set slave address.
	//
	MAP_I2CMasterSlaveAddrSet(I2C0_BASE, 0x38, false);

	//
	// Place data to be send into FIFO.
	//
	MAP_I2CMasterDataPut(I2C0_BASE, ui8Data);

	//
	// Initiate master single send.
	//
	MAP_I2CMasterControl(I2C0_BASE, I2C_MASTER_CMD_SINGLE_SEND);

	//
	// Wait for master to finish transaction.
	//
	while (MAP_I2CMasterBusy(I2C0_BASE));

	//
	// Perform error check.
	//
	if (MAP_I2CMasterErr(I2C0_BASE) == I2C_MASTER_ERR_NONE)
	{
		return;
	}

	UARTprintf("Error = %d\n\n", MAP_I2CMasterErr(I2C0_BASE));
}

Sorry for the long post. I don't think there's anything wrong with my code, but since I'm new to I2C, there probably is. I based it off of the examples from the Tiva C library.