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

Thread: Teensy 3.1 & FRAM - 3.1-specific compile problem

  1. #1

    Teensy 3.1 & FRAM - 3.1-specific compile problem

    Hi there,

    I'm trying to use a I2C FRAM with a Teensy 3.1. The FRAM is the Adafruit one, as is the library and MB85RC256V example code.

    This all compiles fine in the Arduino 1.0.5 IDE if the board is set to Teensy 3.0, 2.0, Arduino Due, Nano, or Uno. However, if I set the board to Teensy 3.1 (which is what I'm wanting to use), then it spits the dummy and I get a whole bunch of undefined references from the Adafruit_FRAM_I2C code to functions in the Wire library, starting with:

    Code:
    Adafruit_FRAM_I2C\Adafruit_FRAM_I2C.cpp.o: In function 'Adafruit_FRAM_I2C::write8(unsigned short, unsigned char)':
    C:\....\Adafruit_FRAM_I2C.cpp.o:90: undefined reference to 'TwoWire::beginTransmission(unsigned char)'
    etc...
    So it looks to me like the Adafruit_FRAM_I2C library isn't picking up on the definitions in the Wire library, but only when compiling for Teensy 3.1.

    Anyone else come across this? And what to do about it?

  2. #2
    Senior Member
    Join Date
    Jan 2013
    Posts
    966
    What version of Teensyduino are you working with ?

    In general, for this project I'd replace the Wire library with the i2c_t3 alternative I2C library as it allows you to take full advantage of the 1MHz I2C frequency this FRAM can run at.

  3. #3
    1.15, so I'll try updating that tomorrow evening.

    And yes, on the list of things to do is re-write the FRAM library to use i2c_t3. But I also have to rewrite all the other hardware interface libraries too, as this project uses a bunch of sensors and other gubbins. Hence I was hoping to use the existing example libraries to validate the hardware before getting stuck into optimising the code. But yes, I should stop bitching and get rewriting.

  4. #4
    Senior Member
    Join Date
    Jan 2013
    Posts
    966
    The i2c_t3 library is basically command compatible with the are library.
    you change the:

    #include <wire.h> to
    #include <i2c_t3.h>

    This is how I do it in the library for my LED shields:

    Code:
    #if defined(__MK20DX128__) || defined(__MK20DX256__) //Teensy 3.x
    #include "i2c_t3.h" //Can be down loaded from http://forum.pjrc.com/threads/21680-New-I2C-library-for-Teensy3
    #else
    #include "Wire.h"
    #endif
    then when you call the Wire.begin(method):

    Code:
    #if defined(__MK20DX128__) || defined(__MK20DX256__) //Teensy 3.0 or Teensy 3.1
    	Wire.begin(I2C_MASTER, 0, I2C_PINS_18_19, I2C_PULLUP_EXT, I2C_RATE_1000);
    #else
    	Wire.begin();
    #endif
    And that should do the trick. The i2c_t3 library has a number of other tricks up its sleeve but i have not yet worked with those.
    Definitely update to Teensy 1.19!

  5. #5
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    23,974
    I just tried it here. It compiled for Teensy 3.1 without any error. I used Teensyduino 1.19.

    Click image for larger version. 

Name:	fram.png 
Views:	152 
Size:	22.3 KB 
ID:	2544
    (click for full size)

    From only the limited info in your message, I can't tell why it's not working for you. More info, like the complete output with File > Prefs set to verbose, might help show what's wrong.

    At least you can see it does work when the library is installed properly. Something must be wrong with your setup.

  6. #6
    Upgraded to Teensyduino 1.19 and it seems to be working.

    Weird.

Posting Permissions

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