EmbDev.net

Forum: µC & Digital Electronics Interfacing/Initialising an ADXL312 with I2C


Author: Matthias N. (nippey)
Posted on:

Rate this post
0 useful
not useful
Hi,

<< to those of you who already used the ADXL312 or similar >>

I have an SPI/I2C-Accelerometer (ADXL312) from Analog Devices which I 
want to use in combination with an ATXmega128A1.

I have already successfully set up the I2C connection, but I cant get 
any valid data from the x,y and z registers.

I can read the DEVICE_ID and my initialisation looks as follows:
DATA_FORMAT: 0x08
POWER_CTL: 0x08
INT_ENABLE: 0x80

After that, the only data I get from the X0,X1,Y0,.. registers are 
those:
x00 xf0   X0,1
x00 xf0   Y0,1
x00 xf0   Z0,1

Does anyone know what might be the reason for that? Did I forget a part 
of the initialisation?

Author: Matthias N. (nippey)
Posted on:

Rate this post
0 useful
not useful
BTW, this is a complete register dump, done with a multi-byte read.
xe5 x02 x00 x00    0:DEVID, R, R, R
x00 x00 x00 x00    4:R, R, R, R
x00 x00 x00 x00    8:R, R, R, R
x00 x00 x00 x4a   12:R, R, R, R
x82 x00 x32 x00   16:R, R, R, R
x00 x80 x80 x80   20:R, R, R, R
x00 x00 x00 x63   24:R, R, R, R
x00 x00 x00 x00   28:R, R, OFSX, OFSY
x00 x00 x00 x00   32:OFSZ, R, R, R
x00 x00 x00 x00   36:THRESH_ACT, THRESH_INACT, TIME_INACT, ACT_INACT_CTL
x00 x00 x00 x00   40:R, R, R, R
x0a x08 x80 x00   44:BW_RATE, POWER_CTL, INT_EN, INT_MAP
x02 x0b x00 xf0   48:INT_SOURCE, DATA_FORMAT, X0, X1
x00 xf0 x00 xf0   52:Y0, Y1, Z0, Z1
x00 x00           56:FIFO_CTL, FIFO_STATUS

R: Rerved/Not in use

Author: N3o (Guest)
Posted on:

Rate this post
0 useful
not useful
Hi,

check Vdd (range 2.0-3.6V). If you have a logic level analyzer link an 
image of the data.

Everything else looks fine, but check the UG anyway: 
http://www.analog.com/static/imported-files/user_g...

Unfortunately I've used it with 4-wire SPI bus, on Atmega328.

Check my first steps here:
http://infotirona.tripod.com/embedded.html

Regards!

Author: Matthias N. (nippey)
Posted on:
Attached files:

Rate this post
0 useful
not useful
Hey,

I solved the problem, I did a Design-Mistake with some 'Do-Not-Connect' 
Pins ;)

You'll find my code in the attachment, in case someone or 'whatisthis' 
will need it.. ;)
The twi_master_driver.* files are based on a AppNote from Atmel for the 
XMEGA-TWI.

Cheers

Reply

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]




Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.