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 Burst Sending Error

Other Parts Discussed in Thread: TM4C1294NCPDT

Hi,

I've been trying to use the Launchpad (with the tm4c1294ncpdt) to send data to an Arduino Due, only so I can test the feature so I can use on a slave device I have.

When I use the "I2C_MASTER_CMD_SINGLE_SEND" command it works as expected, with all the data showing on the arduino without problems.

The problem is when I try to use the "Bust" option, because then the code doesn't get stuck or anything like that (verified using breakpoints) but the arduino doesn't receive anything.

Here's the code I've been using:

#include <stdbool.h>
#include <stdint.h>
#include <string.h>
#include "inc/hw_i2c.h"
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "driverlib/gpio.h"
#include "driverlib/i2c.h"
#include "driverlib/pin_map.h"
#include "driverlib/sysctl.h"
#include "driverlib/uart.h"
#include "utils/uartstdio.h"

#define NUM_I2C_DATA 26
//#define SLAVE_ADDRESS 0x78
#define SLAVE_ADDRESS 0x3C

int main(void) {

	int32_t ui32SysClock;

	char pui32DataTx[NUM_I2C_DATA];
	uint32_t ui32Index;

	//Hadware Configure
	ui32SysClock = SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480), 120000000);

	SysCtlPeripheralEnable(SYSCTL_PERIPH_I2C0);
	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
	GPIOPinConfigure(GPIO_PB2_I2C0SCL);
	GPIOPinConfigure(GPIO_PB3_I2C0SDA);

	GPIOPinTypeI2CSCL(GPIO_PORTB_BASE,GPIO_PIN_2); //SCL
	GPIOPinTypeI2C(GPIO_PORTB_BASE, GPIO_PIN_3); //SDA

	//I2C Configure
	I2CMasterInitExpClk(I2C0_BASE, ui32SysClock, false); //false
	I2CMasterSlaveAddrSet(I2C0_BASE, SLAVE_ADDRESS, false);

	pui32DataTx[0] = 0x00;
	pui32DataTx[1] = 0xae;
	pui32DataTx[2] = 0xa8;
	pui32DataTx[3] = 0x3f;
	pui32DataTx[4] = 0xd3;
	pui32DataTx[5] = 0x00;
	pui32DataTx[6] = 0x40;
	pui32DataTx[7] = 0xa1;
	pui32DataTx[8] = 0xc8;
	pui32DataTx[9] = 0xda;
	pui32DataTx[10] = 0x12;
	pui32DataTx[11] = 0x81;
	pui32DataTx[12] = 0x7f;
	pui32DataTx[13] = 0xa4;
	pui32DataTx[14] = 0xa6;
	pui32DataTx[15] = 0xd5;
	pui32DataTx[16] = 0x80;
	pui32DataTx[17] = 0x8d;
	pui32DataTx[18] = 0x14;
	pui32DataTx[19] = 0xd9;
	pui32DataTx[20] = 0x22;
	pui32DataTx[21] = 0xdb;
	pui32DataTx[22] = 0x30;
	pui32DataTx[23] = 0x20;
	pui32DataTx[24] = 0x00;
	pui32DataTx[25] = 0xaf;


	while (1){
		//for(ui32Index = 0; ui32Index < NUM_I2C_DATA; ui32Index++){
		I2CMasterDataPut(I2C0_BASE, pui32DataTx[0]);
		I2CMasterControl(I2C0_BASE, I2C_MASTER_CMD_BURST_SEND_START);
		//I2CMasterControl(I2C0_BASE, I2C_MASTER_CMD_SINGLE_SEND);
		while(I2CMasterBusy(I2C0_BASE))
		{
		}
		//SysCtlDelay(ui32SysClock/3/1000); //delay 1ms
		for(ui32Index = 1; ui32Index < NUM_I2C_DATA ; ui32Index++){
			I2CMasterDataPut(I2C0_BASE, pui32DataTx[ui32Index]);
			if (ui32Index != (NUM_I2C_DATA-1))
				I2CMasterControl(I2C0_BASE, I2C_MASTER_CMD_BURST_SEND_CONT);
			else
				I2CMasterControl(I2C0_BASE, I2C_MASTER_CMD_BURST_SEND_FINISH);
				//I2CMasterControl(I2C0_BASE, I2C_MASTER_CMD_SINGLE_SEND);
			while(I2CMasterBusy(I2C0_BASE))
			{
			}
			//SysCtlDelay(ui32SysClock/3/1000); //delay 1ms

		}
	}

	return 0;
}

Do I need to do something so the launchpad will wait for an acknowledge  or is the while(I2CMasterBusy(I2C0_BASE)) enough?

Thank you