paparazzi-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Paparazzi-devel] I2C AMSYS databyte problem


From: Leandro Chelini
Subject: Re: [Paparazzi-devel] I2C AMSYS databyte problem
Date: Fri, 18 Mar 2011 16:40:40 +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

I solved the problem by myself. It was a complication between the default i2c address and the user defined address.

Bruzzlee

Am 18.03.11 13:39, schrieb Leandro Chelini:
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



_______________________________________________ Paparazzi-devel mailing list address@hidden http://lists.nongnu.org/mailman/listinfo/paparazzi-devel

reply via email to

[Prev in Thread] Current Thread [Next in Thread]