-
Notifications
You must be signed in to change notification settings - Fork 274
Open
Description
In my case the lines that read the dig_T1,...dig_T3 that is:
dig_T1 = i2c_smbus_read_word_data(bmp280_i2c_client, 0x88);
dig_T2 = i2c_smbus_read_word_data(bmp280_i2c_client, 0x8a);
dig_T3 = i2c_smbus_read_word_data(bmp280_i2c_client, 0x8c);
if(dig_T2 > 32767)
dig_T2 -= 65536;
if(dig_T3 > 32767)
dig_T3 -= 65536;
are incorrect. the 0x88 0x8a and 0x8c contain just the LSB of dig_T1,...dig_T3 , the most significant bits are in 0x89 0x8b 0x8d.
To get correct measurements I had to change them into:
dig_T1=i2c_smbus_read_byte_data(bmp280_i2c_client,0x88);
dig=i2c_smbus_read_byte_data(bmp280_i2c_client,0x89);
dig_T1+=dig<<8;
dig_T2=i2c_smbus_read_byte_data(bmp280_i2c_client,0x8a);
dig=i2c_smbus_read_byte_data(bmp280_i2c_client,0x8b);
dig_T2+=dig<<8;
dig_T3=i2c_smbus_read_byte_data(bmp280_i2c_client,0x8c);
dig=i2c_smbus_read_byte_data(bmp280_i2c_client,0x8d);
dig_T3+=dig<<8;
where "dig" is some helper variable
Metadata
Metadata
Assignees
Labels
No labels