Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 3 of 3

Thread: How to use T3.5 with RCT DS3231 using i2c_t3 library

  1. #1
    Junior Member
    Join Date
    Dec 2016
    Posts
    18

    How to use T3.5 with RCT DS3231 using i2c_t3 library

    Hi guys, I have a T3.5 and I want to use the second i2c (wire2 with the i2c_t3 library) to get the time from Adafruit DS3231. Using the example ds1307 from DS1307RTC library I get the time using the SCL0 and SDA0, but I will use this bus to connect a MPU9150 device.
    Do you know how to use this second bus?
    Thank you

  2. #2
    Senior Member
    Join Date
    Dec 2016
    Location
    Montreal, Canada
    Posts
    3,112
    if it doesnt support changing in the class, edit the CPP file and replace all instances of "Wire." with "Wire1." and "Wire.h" to "i2c_t3.h"

  3. #3
    Senior Member ninja2's Avatar
    Join Date
    Aug 2016
    Location
    Adelaide, Australia
    Posts
    151
    Here are example initialisation commands for three I2C buses on T3.5:
    Code:
    #include <i2c_t3.h>
    
    void setup(){
    
    Wire.begin (I2C_MASTER,0x00,I2C_PINS_18_19,I2C_PULLUP_EXT,400000); // device 1 on SDA0/SCL0 
    Wire1.begin(I2C_MASTER,0x00,I2C_PINS_37_38,I2C_PULLUP_EXT,400000); // device 2 on SDA1/SCL1
    Wire2.begin (I2C_MASTER,0x00,I2C_PINS_3_4,I2C_PULLUP_EXT,400000); // device 3 on SDA2/SCL2
    But as tonton says, if the DS1307 library is not aware of Wire2 you'll have to edit it (in the Sketches/libraries folder) and just replace all "Wire." with "Wire2."

    Connect your device into pins 3 & 4 with a 2.2K pull-up resistor on each leg (unless DS3231 has them built in).

    For more info on i2c_t3 usage see the documentation for the i2c_t3 Library on GitHub
    Last edited by ninja2; 02-09-2017 at 11:10 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •