I'm trying to get my TeensyLC to communication with the FRAM chip on Adafruits website(Details here). I used a slightly modified master_writer code (below) to try and test a read, write, and re-read in a loop. However it never seems to work as it gets stuck after printing "Reading from address". At first I thought it was the pull up resistors not being there, but they are included on the board. My circuit is super simple. I just connect the 3.3v and GND to VCC and GND respectively. Then pin 19 to SCL and pin 18 to SDA. No idea why this isn't working.
Code:
#include <Wire.h>
void setup()
{
delay(5000);
Wire.begin();
Serial.begin(9600);
}
void loop()
{
byte write_num = 0;
byte read_num = 0;
// set the 24C256 eeprom address to 0
Serial.println("Setting address");
Wire.beginTransmission(80);
Wire.write(0); // address high byte
Wire.write(0); // address low byte
Wire.endTransmission();
// read 1 byte, from address 0
Serial.println("Reading from address");
Wire.requestFrom(80, 1);
while(Wire.read()) {
read_num = Wire.receive();
}
Serial.print("read_num = ");
Serial.println(read_num, DEC);
// increment num
write_num = write_num + 1;
// write "num" to 24C256 eeprom at address zero
Serial.println("Writing new value");
Wire.beginTransmission(80);
Wire.write(0); // address high byte
Wire.write(0); // address low byte
Wire.write(write_num); // any more send starts writing
Wire.endTransmission();
// next time loop runs, it should retrieve the
// same number it wrote last time... even if you
// shut off the power
delay(5000);
}