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

Thread: I am having problem loading i2c_t3 library

  1. #1

    I am having problem loading i2c_t3 library

    Hi everyone.

    I have some code using the i2c_t3 library. I tried running the code and got some error messages including "I2C_MASTER was not declared in this scope". Then, in Arduino software, I went to examples and tried a few of the i2c_t3 examples and none of them worked.

    I am on a Mac, OS 10.13.6. I searched for i2c_t3 and I didn't find anything. So I googled it, found a github link, downloaded it and put the folder in the folder where I keep all my Arduino libraries. I tried running the example code and my code and still it didn't work.

    Then I deleted Arduino software and Teensyduino and reinstalled them both. Still nothing worked. When I do a search for i2c_t3 on my computer all I see is the version I downloaded. I can't find the version that comes with Teensyduino.

    So how can I get this code to work? and Where is i2c_t3 library for Teensy stored on a Mac when you install Teensyduino? If you have any ideas of what I can try please let me know.

    Thanks.

    Nick

    EDIT: I found the i2c_t3 library in the Arduino software folder, along with the examples. I am still getting error messages when I try and verify the code.

    When verifying the "advanced loopback" example I get thiese errors:
    Code:
    Arduino: 1.8.13 (Mac OS X), TD: 1.53, Board: "Teensy 4.1, Serial + MIDI, 600 MHz, Faster, US English"
    
    
    
    
    
    
    
    
    
    
    
    advanced_loopback:43: error: variable or field 'printStatus' declared void
     void printStatus(i2c_status status);
                      ^
    advanced_loopback:43: error: 'i2c_status' was not declared in this scope
    advanced_loopback: In function 'void setup()':
    advanced_loopback:78: error: 'Wire' was not declared in this scope
         Wire.begin(I2C_MASTER, 0x00, WIRE_PINS, I2C_PULLUP_EXT, 400000);
         ^
    advanced_loopback:78: error: 'I2C_MASTER' was not declared in this scope
         Wire.begin(I2C_MASTER, 0x00, WIRE_PINS, I2C_PULLUP_EXT, 400000);
                    ^
    advanced_loopback:23: error: 'I2C_PINS_18_19' was not declared in this scope
     #define WIRE_PINS   I2C_PINS_18_19
                         ^
    /Applications/Arduino.app/Contents/Java/hardware/teensy/avr/libraries/i2c_t3/examples/advanced_loopback/advanced_loopback.ino:78:34: note: in expansion of macro 'WIRE_PINS'
         Wire.begin(I2C_MASTER, 0x00, WIRE_PINS, I2C_PULLUP_EXT, 400000);
                                      ^
    advanced_loopback:78: error: 'I2C_PULLUP_EXT' was not declared in this scope
         Wire.begin(I2C_MASTER, 0x00, WIRE_PINS, I2C_PULLUP_EXT, 400000);
                                                 ^
    advanced_loopback: In function 'void rwSlave(uint8_t)':
    advanced_loopback:147: error: 'Wire' was not declared in this scope
         Wire.beginTransmission(target);         // slave addr
         ^
    advanced_loopback: In function 'void printWireStatus()':
    advanced_loopback:221: error: 'Wire' was not declared in this scope
     void printWireStatus(void) { printStatus(Wire.status()); }
                                              ^
    advanced_loopback:221: error: 'printStatus' was not declared in this scope
     void printWireStatus(void) { printStatus(Wire.status()); }
                                                           ^
    /Applications/Arduino.app/Contents/Java/hardware/teensy/avr/libraries/i2c_t3/examples/advanced_loopback/advanced_loopback.ino: At global scope:
    advanced_loopback:231: error: variable or field 'printStatus' declared void
     void printStatus(i2c_status status)
                      ^
    advanced_loopback:231: error: 'i2c_status' was not declared in this scope
    Multiple libraries were found for "i2c_t3.h"
     Used: /Applications/Arduino.app/Contents/Java/hardware/teensy/avr/libraries/i2c_t3
     Not used: /sequences/Arduino/libraries/i2c_t3-master
    variable or field 'printStatus' declared void
    /Applications/Arduino.app/Contents/Java/hardware/teensy/avr/libraries/i2c_t3/examples/advanced_loopback/advanced_loopback.ino
    
    
    This report would have more information with
    "Show verbose output during compilation"
    option enabled in File -> Preferences.
    Last edited by Frank B; 01-11-2021 at 09:55 PM.

  2. #2
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    8,891
    I could be wrong, but the last time I looked this library was not yet supported on a Teensy 4.x

    The last post from him (@nox771) on that was back near the end of 2019 and his last changes to the library were back in 2018.

  3. #3
    Hey KurtE,

    Yes you might be right. When I changed board type to Teensy 3.6 the code verified.
    Is there a way that I can update the library for use on a 4.1? It might be hard for me to switch at this point in my project.

  4. #4
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    8,891
    Sorry,

    I am not much of an I2C person so I normally just use Wire library when I need I2C support. It would be probably easy to get most of the Master mode support in, but would take someone who plays a lot with the slave mode code to know how to change it.

    so the real question is how much of the functionality differences of this library versus the Wire library do you need? Again so far only have seen the error messages and not the source code so hard to know how big of a job that would be.

  5. #5
    KurtE,

    Thanks for helping me diagnose this issue. I did find this library, that apparently works with Teensy 4.0

    https://github.com/Richard-Gemmell/teensy4_i2c

    I am trying to see if it will work with a 4.1. If not I will try Wire.

Posting Permissions

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