Teensy 3.1 & FRAM - 3.1-specific compile problem

Status
Not open for further replies.

happyinmotion

Well-known member
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?
 
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.
 
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!
 
I just tried it here. It compiled for Teensy 3.1 without any error. I used Teensyduino 1.19.

fram.png
(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.
 
Status
Not open for further replies.
Back
Top