Jump to content
43oh

I2C problem on a EK-TM4C1294XL connected Lauchpad


Recommended Posts

Hi,

 

I am trying to get i2c working on a EK-TM4C1294XL on energia. I am trying to user i2c channel 0. So they should be on pb2 and pb3. Thing is, I do not see any signal on sda or sck on the scope except for the pullup.

 

On the serial debug I see "Start" and "Loop" but "Loop2" never appears. As simpel as this program is, I am not getting it or something is wrong in the libraries.

 

Hope you can help,

 

cheers

 

John

#include <Wire.h>


void setup()
{
  Wire.setModule(0);
  Wire.begin();                // join i2c bus (address optional for master)
  Wire.setModule(0);
  Serial.begin(115200);          // start serial communication at 9600bps
  pinMode(PC_7, OUTPUT);
  pinMode(PB_2, INPUT_PULLUP);
  pinMode(PB_3, INPUT_PULLUP);
  Serial.println("Start");
}


void loop()
{
  Serial.println("Loop");
  
  Wire.beginTransmission(112); // transmit to device #112 (0x70)
  Wire.write(byte(0x00));      // sets register pointer to the command register (0x00)  
  Wire.write(byte(0x50));      // command sensor to measure in "inches" (0x50) 
  Wire.endTransmission();      // stop transmitting


  Serial.println("Loop2");


  digitalWrite(PC_7,HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(250);                  // wait a bit since people have to read the output 
  digitalWrite(PC_7, LOW);    // turn the LED off by making the voltage LOW
  delay(250);                  // wait a bit since people have to read the output 
}
Link to post
Share on other sites

 

Hi,

 

I am trying to get i2c working on a EK-TM4C1294XL on energia. I am trying to user i2c channel 0. So they should be on pb2 and pb3. Thing is, I do not see any signal on sda or sck on the scope except for the pullup.

 

On the serial debug I see "Start" and "Loop" but "Loop2" never appears. As simpel as this program is, I am not getting it or something is wrong in the libraries.

 

Hope you can help,

 

cheers

 

John

#include <Wire.h>


void setup()
{
  Wire.setModule(0);
  Wire.begin();                // join i2c bus (address optional for master)
  Wire.setModule(0);
  Serial.begin(115200);          // start serial communication at 9600bps
  pinMode(PC_7, OUTPUT);
  pinMode(PB_2, INPUT_PULLUP);
  pinMode(PB_3, INPUT_PULLUP);
  Serial.println("Start");
}


void loop()
{
  Serial.println("Loop");
  
  Wire.beginTransmission(112); // transmit to device #112 (0x70)
  Wire.write(byte(0x00));      // sets register pointer to the command register (0x00)  
  Wire.write(byte(0x50));      // command sensor to measure in "inches" (0x50) 
  Wire.endTransmission();      // stop transmitting


  Serial.println("Loop2");


  digitalWrite(PC_7,HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(250);                  // wait a bit since people have to read the output 
  digitalWrite(PC_7, LOW);    // turn the LED off by making the voltage LOW
  delay(250);                  // wait a bit since people have to read the output 
}

 

 

i'm sorry if i'm alredy answering here @@bluehash but i know the answer i belive.

 

That launchpad doesn't have internal pull-ups in the I2C operation mode. you need external resistors for that. 

By doing pinMode(PB_2,INPUT_PULLUP); you are un-configuring the pin from I2C mode.

Also, you should do setModule before Wire.begin only

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...