Teensy 3.1 ADXL345 accelerometer freeze/does not work - wire.endTransmission

Status
Not open for further replies.

efplaya

New member
I took an ADXL345 accelerometer sketch /example from here:
http://www.i2cdevlib.com/usage

which works on arduino uno flawlessly with the following pins connected:

Arduino -> ADXL345
Ground -> Ground
VCC -> 3v3 V
CS -> 3v3 V
SDA -> SDA
SCL -> SCL


However that same code and equivalent connection does not work on Teensy3.1. The program always freezes on wire.endTransmission ( this is supposed to finish sending the single via i2c).
My pinout for teensy is the following:

Teensy -> ADXL345
Ground -> Ground (before the 0 pin)
VCC -> 3v3 V (before pin 23/9A)
CS -> 3v3 (same as above)
SDA -> SDA (pin 18/A4)
SCL -> SCL (pin 19/A5)

I get other responses from the board while commenting out the i2c code but as soon as I attempt to read i2c with the accelerometer; it freezes.

Can anyone please offer some advice as I'm not sure what could be wrong?

Thanks!
 
My first step would put off any I2C interaction like "accel.initialize();" - set up the USB(serial) - wait for it to come online - pause a few seconds and print some cheery messages . . . then do the i2c setup and init and communication - with more debug spew as you go for any return values where you can.

The Teensy boots fast and catches some devices by surprise.

Some code like this in setup - QBlink
 
My first step would put off any I2C interaction like "accel.initialize();" - set up the USB(serial) - wait for it to come online - pause a few seconds and print some cheery messages . . . then do the i2c setup and init and communication - with more debug spew as you go for any return values where you can.

The Teensy boots fast and catches some devices by surprise.

Some code like this in setup - QBlink


Thank you for the comments. I appreciate it very much. I noticed that the teensy does boot up extremely fast and I was missing beginning Serial debug and had to put in a while (!serial) wait command. Now I'm able to see all debugging. This debugging has led me down to Wire.EndTransmission() call. I have not put debugging in there but judging by the source code all it does it send a message via i2c to a particular address. Maybe this is hardware related?? Can anyone verify that my hookup makes sense? Do I need a pullup resistor (I didn't need one on arduino). I measured voltage accross my 3v3 connection and it read about 3.2/3.1 etc but never exactly 3.3?
 
Status
Not open for further replies.
Back
Top