Hi Jim,
When you mention that you read 0xFF, it implies that the address phase
is incomplete most likely
Please not that, some Bus Master's have broken REPEATED_START's.
In such cases, the workaround is to use an additional START instead,
which has worked in all my situations till now.
https://cdn-shop.adafruit.com/datasheets/BST-BMP180-DS000-09.pdf
You need to do the complete transaction, exactly in the same order.
as described in the datasheet.
W (S + slave_address 7b)
W (reg_address)
R (S + slave_address 7b)
READ result
READ result
W=Write Bit
R=Read Bit
S=START bit
The W is nothing but the absence of the READ flag, but I put W in there to
make it a bit more clear.
The 2nd write of the SLAVE_ADDR, you need to set the READ flag in there too.
After which you can read both the result registers.
If your transaction is borked in some way, you will get 0xFF.
Also, important to note that the result accuracy can be extended to 19bits.
How to read 19bits is defined only in the Bosch software alone.
Cheers,
Manu
Post by Manu AbrahamManu,
Looking at the BMP180 datasheet, do you see the Slave ACK's from the
BMP180 ?
YES. The first data byte coming back is 0xFF which shouldn't be.
Additionally, according to the datasheet, to read the converted result,
you need
to read with a REPEATED START as described in Figure9: Timing diagram
read 16 bit
A/D conversion result.
NOTED. However, I've tried it both ways, ie.. using a RESTART, and
using START.
Either way, the result is the same. The first byte back is 0xFF.
The normal read will put a STOP bit after your first read, which will
mess things completely.
The library in MikroCPro does not put a stop after a read. You put a
stop function
where you need it when you're done communicating. This is also
verified when looking
on the scope as I'm monitoring the SDA and SCK signals.
I do appreciate your insight. I'll look again at the points you make
just to be sure.
Regards,
Jim
-------- Original Message --------
Subject: Re: [PIC]: I2C Communications With A BMP180
Temperature/Pressure/Altitude Sensor
Date: Tue, March 20, 2018 1:34 pm
Hi Jim,
Looking at the BMP180 datasheet, do you see the Slave ACK's from the BMP180 ? < YES >
Additionally, according to the datasheet, to read the converted
result, you need to read with a REPEATED START
as described in Figure9: Timing diagram read 16 bit A/D conversion result.
ie, you cannot read the result register, the same way you are reading
the ID register, to put it simple.
The normal read will put a STOP bit after your first read, which will
mess things completely.
Cheers,
Manu
Post by j***@jpes.comAll,
Does anyone have any experience with this sensor? I have tried
getting the temperature and pressure
conversions to work, but I'm having no luck so far. I am using
MikroCPro for PIC compiler with the I2C
library. to write my program. I can get the unit ID and the
calibration data from EEPROM. But no matter
what I do, I cannot get the temperature or pressure values.
I've looked on the web for examples, and I'm believe I'm doing
everything correctly. I was just
wondering if there is something that I'm missing. If anyone has any
ideas, please let me know.
Thanks all,
Regards,
Jim
--
http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist
--
http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist
--
http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist
--
http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist