[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Paparazzi-devel] I2C AMSYS databyte problem
From: |
Leandro Chelini |
Subject: |
[Paparazzi-devel] I2C AMSYS databyte problem |
Date: |
Fri, 18 Mar 2011 13:39:19 +0100 |
User-agent: |
Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; de; rv:1.9.2.15) Gecko/20110303 Lightning/1.0b2 Thunderbird/3.1.9 |
Hi all
I want to readout 4 bytes of values (2 bytes pressure , 2 bytes
temperature), but the first buffer has allways the decimal value "8"
(0b1000).
I think the problem is, that the AMSYS sensors sends an ACK bit flowed
by the first data byte after it has received a request. So the ACK bit
is written in the first buffer. The master (PPRZ) sends a ACK back
before he received the real data. After the master has sent the ACK, the
slave (sensor) sends the second byte of the pressure, witch is
transmitted correctly. All bytes are transmitted correctly except the
first one!
What do you think about?
If it is the problem like i think, how can it be fixed?
Time line:
-Start (from
master)-
-Slave Address
(from master)-
-Read bit (from
master)-
--Acknowledge (from slave)--
--1st Data Byte (from slave)--
-Acknowledge
(from master)-
--2st Data Byte (from slave)--
-Acknowledge
(from master)-
--3st Data Byte (from slave)--
-Acknowledge
(from master)-
--4st Data Byte (from slave)--
-Acknowledge
(from master)-
-Stop (from
master)-
My baro and differential pressure sensors are:
AMS 5812-0003-D (differential)
AMS 5812-0150-A (absolute)
The code I use to readout the values:
....
void baro_amsys_read_periodic( void ) {
....
I2CReceive(BARO_AMSYS_I2C_DEV, baro_amsys_i2c_trans, BARO_AMSYS_ADDR, 4);
....
}
void baro_amsys_read_event( void ) {
....
pBaroRaw = (baro_amsys_i2c_trans.buf[0] << 8) |
(baro_amsys_i2c_trans.buf[1]);
tBaroRaw = (baro_amsys_i2c_trans.buf[2]<<8) |
baro_amsys_i2c_trans.buf[3];
....
....
}
Datasheet:
http://www.amsys.info/sheets/amsys.en.ams5812_e.pdf
Thx Bruzzlee
amsys_readout.jpg
Description: JPEG image
- [Paparazzi-devel] I2C AMSYS databyte problem,
Leandro Chelini <=