Jump to content
potw

I2C on TM4c1294 doesn't work

Recommended Posts

Hello everyone,

I'm trying to use I2C0 on tm4c1294 to communicate with rtc ds1307/ am2315 but it doesn't work. I was tried read many threads about i2c issue on tiva c with no luck. Here are one of them:

Have anyone successful using I2C on tiva C (tm4c1294ncpdt)? Guide me, pls.

Share this post


Link to post
Share on other sites
8 hours ago, Rei Vilo said:

Help yourself:

  • perform a search on DS1307 on this very forum,
  • read the datasheet.

Hint: voltage.

Dear Rei,

Thank you for your reply. I don't think it is voltage problem. i already had a logic converter(GTL2003) which convert 3.3V to 5V. I tested I2C bus which arduino uno/mega. It works well.

Share this post


Link to post
Share on other sites

Good to know. The TM4C129 LaunchPad has multiple I²C ports. Have you tried the other ones?

3109053_orig.thumb.jpeg.38bc6d96860c5b617cb7fa2763113688.jpeg

To use a specific I²C port, you may need to specify e.g. for port 0

Wire.begin();
Wire.setModule(0);

 

Share this post


Link to post
Share on other sites

Thank Rei for your infomations.

Unfortunately, it still doesn't work. With am2315 i received all 0-byte and with ds1307 i received random bytes. 

I'm using Adafruit_AM2315 and rtclib libs.

Share this post


Link to post
Share on other sites

Yep, I tried. I have 2 modules for each of them. All have same issue when works with tm4c. But they work well with arduino Uno/mega2560.

Share this post


Link to post
Share on other sites

Just tried to read some data from a DS1307 using my TivaC and the (slightly changed - use the i2c1 module) master_reader example from the wire library.

The DS answers (ACK) to the addressing (0x68) and gives back some data. No idea if the data is correct, but the logic analyzer can decode it. 

Hardware connections:

DS     Launchpad
Vdd -> +5V 
Gnd -> Gnd
SDA -> SDA1 (PN_4, Launchpad pin 50), 10KOhm -> +3V3
SCL -> SCL1 (PN_5, Launchpad pin 49), 10KOhm -> +3V3

The working code:

#include <Wire.h>

void setup()
{
  Serial.begin(115200);  // start serial for output
  delay(200);
  Serial.println("Serial interface OK");
  Wire.setModule(1);
  Wire.begin();        // join i2c bus (address optional for master)
}

void loop()
{  
  Serial.println("ask some data");
  delay(500);
  Wire.requestFrom(0x68, 5,false);    // request 6 bytes from slave device #2

  while(Wire.available())    // slave may send less than requested
  { 
    char c = Wire.read(); // receive a byte as character
    Serial.print(c);         // print the character
  }
  Serial.println();
//  delay(500);
}

 

Edited by LiviuM
added the Launchpad's pins used.

Share this post


Link to post
Share on other sites
11 hours ago, Rei Vilo said:

If you have a logic analyser, check the speed of the I²C port. The IC may not be compatible with 400 kHz.

Dear Rei,

I have checked it before. I set I2C port  to 100kHz standard.

Share this post


Link to post
Share on other sites

Dear All,

I'm havig here I2C mulfuctioning as well, on EK-TM4C129 4XL Launchpad. The I2C bus is wired with 1 KoHM resistors. I tested it on Arduino Mega, Uno same string of devices, works. On Launchpad does not. When I start a I2C scanner it shows me that there are dozens of devices on Bus, but in real just 4 devices. I tried above mentioned troublshooting and nothing really changed.

any help highly appreciated

 

Share this post


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...