BMP280 Digital Pressure Sensor

jpanhalt

Joined Jan 18, 2008
11,087
Wouldn't the SDI line mean "serial device in" . Typically, that would be the MCU sending commands to the BMP280. I would expect the data obtained by the BMP280 to be sent to the MCU on the SDO line.
 

Thread Starter

Gajyamadake

Joined Oct 9, 2019
310
Wouldn't the SDI line mean "serial device in" . Typically, that would be the MCU sending commands to the BMP280. I would expect the data obtained by the BMP280 to be sent to the MCU on the SDO line.
simplified diagram
1582385113921.png
The sensor will obtain a new value every time and after 8 clock master will get value

Example : If sensor has binary 10011101 in the serial register After 8 clocks the master will hold 10011101.

Sensor hold value 10011101 after 8 clock Master will hold 10011101
Sensor hold value 1110 1001 after 8 clock Master will hold 1110 1001
Sensor hold value 1101 1001 after 8 clock Master will hold 1101 1001

summary : This proves that the sensor obtain the data and stores its own register and the same data gets to the micro after 8 clock .
 

JohnInTX

Joined Jun 26, 2012
4,787
The converted values show up in a group of registers that you read via normal SPI.
The protocol to read the registers is shown in section 5.3 SPI Interface of the datasheet .
How to do the SPI using the built in peripheral was discussed with you here:
https://forum.allaboutcircuits.com/threads/inbuilt-spi-in-pic16f877a.166972/post-1476632

What other questions do you have? It seems like every time you have a new slave device, you want to start SPI from the beginning again.
 

JohnInTX

Joined Jun 26, 2012
4,787
Is digital value appear on SDI line ?
We may be getting confused here. If you are asking if the barometer data is read back on the SDI (MOSI) line, the answer is 'It depends on how you configure the BMP280'.

You can configure the BMP280's SPI for a non-standard 3 wire setup that makes SDI (MOSI) bi-directional and SDO (MISO) a don't care by writing a '1' to Bit 0 of Register 0xF5 - Section 4.3.5 in the datasheet. When 3 wire is enabled, you write the command to the barometer by sending data on SDI (MOSI) output as usual then change the direction of SDI(MOSI) to an input then clock and read the data on that line. That saves a wire but it would probably mean bit-banging. I don't think there are any standard SPI hardware peripherals that would do the change in direction. Certainly not the 16F877A.

The 4 wire SPI default looks like it works in the conventional manner.

But if your question is what happens inside the chip - as @jpanhalt says, it's not important to using the chip itself.

Have fun!
 
Top