I am trying to build a bmp3xx driver for my stm32 projects and am having an issue reading data. (or more precisely getting the bmp to stay out of sleep). I follow the application note instructions (https://www.bosch-sensortec.com/media/boschsensortec/downloads/application_notes_1/bst-mps-an006.pdf) by softreseting, reading the ID, and Reading the trimming data. I then attempt to change the PWR_CTRL register (0x1B) to 0x33 (00110011) or Normal mode with the temp and press sensor active. When I immediately read back the PWR_CTRL register the value is correct (0x33) however when I attempt to read it again the chip has returned to sleep mode (0x03 or 00000011) according to the data sheet (https://www.bosch-sensortec.com/media/boschsensortec/downloads/datasheets/bst-bmp384-ds003.pdf) on page 29 bits 4 and 5 of the PWR_CTRL are the "Mode Bits". I have NOT tested the timing of this read/write cycle. ie. I am not sure if it is me reading the register that wipes the MODE selection or if after some number of ms the register wipes. I can also comment out the read section of code with no change. In all of these cases the STATUS register returns data not ready (0's in the 5th and 6th bit). When I check for errors (0x02) there are none. And when i check the EVENT register (0x10) a successful soft-reset is shown.
I am using 4 wire SPI, MODE 0, and tested at 21Mbit/s down to 656 Kbit/s.
Additionally I am fairly new to this (this is my second driver ever - and my first bosch sensor) so I may be missing something obvious.
Thanks In Advance.
You could refer github example code read_sensor_data.c that demonstrated how to configure BMP3 under normal mode and read sensor data.