Interfacing/Initialising an ADXL312 with I2C

OP #2432499
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?
OP #2432509
BTW, this is a complete register dump, done with a multi-byte read.
1
xe5 x02 x00 x00    0:DEVID, R, R, R
2
x00 x00 x00 x00    4:R, R, R, R
3
x00 x00 x00 x00    8:R, R, R, R
4
x00 x00 x00 x4a   12:R, R, R, R
5
x82 x00 x32 x00   16:R, R, R, R
6
x00 x80 x80 x80   20:R, R, R, R
7
x00 x00 x00 x63   24:R, R, R, R
8
x00 x00 x00 x00   28:R, R, OFSX, OFSY
9
x00 x00 x00 x00   32:OFSZ, R, R, R
10
x00 x00 x00 x00   36:THRESH_ACT, THRESH_INACT, TIME_INACT, ACT_INACT_CTL
11
x00 x00 x00 x00   40:R, R, R, R
12
x0a x08 x80 x00   44:BW_RATE, POWER_CTL, INT_EN, INT_MAP
13
x02 x0b x00 xf0   48:INT_SOURCE, DATA_FORMAT, X0, X1
14
x00 xf0 x00 xf0   52:Y0, Y1, Z0, Z1
15
x00 x00           56:FIFO_CTL, FIFO_STATUS
16

17
R: Rerved/Not in use
OP #2458450
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

A question of your own? This thread is over 14 years old. Ask it in a thread of its own – more people read along there, and it gets answered more often and sooner.

Start a new thread

A fix, an addition or feedback on this thread? Then reply here.

Formatting
  • [c]C-Code[/c]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.