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.

LAUNCHXL2-RM57L: get data from Arduino via I2C

Part Number: LAUNCHXL2-RM57L


Hi,

I am building a project with Arduino (slave) and Launchpad Rm57L (master) to get data from Arduino and send it to Http server.

I cant get data from I2C.I have not Analyzer because i build a Arduino for i2c sniffer and there is no data on i2c line.

I am using example code for RM57 and 2 4.7k pull-up resistor for i2c line.i2c line connected to J1 header 9 and 10 ports.

And this github.com/.../i2c-sniffer-100kBaud-Arduino-Mega for Arduino.Rm57 code get stuck in

        while(i2cIsBusBusy(i2cREG1) == true);


infinite loop.

int main(void)
{
/* USER CODE BEGIN (3) */

	int repeat = 0; int delay =0;

///////////////////////////////////////////////////////////////
//        Master Transfer Functionality                      //
///////////////////////////////////////////////////////////////
	/* I2C Init as per GUI
	 *  Mode = Master - Transmitter
	 *  baud rate = 100KHz
	 *  Count = 10
	 *  Bit Count = 8bit
	 */
	i2cInit();

	/* Configure address of Slave to talk to */
	i2cSetSlaveAdd(i2cREG1, Slave_Address);

	/* Set direction to Transmitter */
	/* Note: Optional - It is done in Init */
	i2cSetDirection(i2cREG1, I2C_TRANSMITTER);


	for(repeat = 0; repeat < 2; repeat++)
	{
		/* Configure Data count */
		/* Note: Optional - It is done in Init, unless user want to change */
		i2cSetCount(i2cREG1, DATA_COUNT);

		/* Set mode as Master */
		i2cSetMode(i2cREG1, I2C_MASTER);

		/* Set Stop after programmed Count */
		i2cSetStop(i2cREG1);

		/* Transmit Start Condition */
		i2cSetStart(i2cREG1);

		/* Tranmit DATA_COUNT number of data in Polling mode */
		i2cSend(i2cREG1, DATA_COUNT, TX_Data_Master);

		/* Wait until Bus Busy is cleared */
		while(i2cIsBusBusy(i2cREG1) == true);

		/* Wait until Stop is detected */
		while(i2cIsStopDetected(i2cREG1) == 0);

		/* Clear the Stop condition */
		i2cClearSCD(i2cREG1);

		/* Simple Dealya before starting Next Block */
		/* Depends on how quick the Slave gets ready */
		for(delay=0;delay<1000000;delay++);

	}

	///////////////////////////////////////////////////////////////
	//        Master Receive Functionality                      //
	///////////////////////////////////////////////////////////////

	/* Configure address of Slave to talk to */
	i2cSetSlaveAdd(i2cREG1, Slave_Address);

	/* Set direction to receiver */
	i2cSetDirection(i2cREG1, I2C_RECEIVER);

	for(repeat = 0; repeat < 2; repeat++)
	{
		/* Configure Data count */
		/* Note: Optional - It is done in Init, unless user want to change */
		i2cSetCount(i2cREG1, DATA_COUNT);

		/* Set mode as Master */
		i2cSetMode(i2cREG1, I2C_MASTER);

		/* Set Stop after programmed Count */
		i2cSetStop(i2cREG1);

		/* Transmit Start Condition */
		i2cSetStart(i2cREG1);

		/* Tranmit DATA_COUNT number of data in Polling mode */
		i2cReceive(i2cREG1, DATA_COUNT, RX_Data_Master);

		/* Wait until Bus Busy is cleared */
		while(i2cIsBusBusy(i2cREG1) == true);

		/* Wait until Stop is detected */
		while(i2cIsStopDetected(i2cREG1) == 0);

		/* Clear the Stop condition */
		i2cClearSCD(i2cREG1);

		/* Simple Dealya before starting Next Block */
		/* Depends on how quick the Slave gets ready */
		for(delay=0;delay<1000000;delay++);

	}

	asm(" nop");
	asm(" nop");
	asm(" nop");

	while(1);

/* USER CODE END */

    return 0;
}