Bosch Sensortec Community

    BMP388 first byte always zero

    Highlighted
    New Poster

    BMP388 first byte always zero

    I am trying to implement the BMP388 (for what its worth, I've done a bunch with the BMP280, so I sort of know my way around).

    The problem is, when I read the block from address 0x04 (the start of the data registers), the first byte in the pressure and the first byte in the temperature are always zero. The whole dummybyte in the SPI got me for a while, but that is not the issue here (i've tried starting at address 0x03, and read through to 0x09 to verify)

    I've also read the 3 bytes in sensortime (addr 0x0C) and am seeing the bytes incriment as expected. I'm using the same code for reading the pressure bytes, so I'm at a loss for why the first byte is good in the sensortime, but always zero for the pressure or temperature blocks.

     

    For clarification, here is what I am seeing:

    Addr[0x04] = 0x00 <=== shouldn't this be non-zero, or change over subsequent reads?
    Addr[0x05] = 0xF2 this fluctuates, which is expected
    Addr[0x06] = 0x6C this is mostly static, but since it is the high bits, I would expect this behavior as well
    Addr[0x07] = 0x00 <=== shouldn't this be non-zero
    Addr[0x08] = 0xBC
    Addr[0x09] = 0x81

    I've tried reading these registers a number of different ways:
    Single-byte reads for each of the above registers
    Block read for 0x04-0x06 (and another block read from 0x07-0x09
    Block read starting at 0x03
    Block read starting at 0x04

    From everything I can see, it appears that the first byte for temperature and pressure is just not being set. Any idea what is going on here?

     

    Tags (1)
    7 REPLIES 7
    Highlighted
    Community Moderator

    Re: BMP388 first byte always zero

    There is no special limitations in BMP380 interface.  you should able to read data from register with burst read action. 

    DO you follow our standard API for BMP380 on Github?  which parameters are used when you want to measure the temperature and pressure. 

    How much time you wait after change work mode until read out the data? 

    Highlighted
    New Poster

    Re: BMP388 first byte always zero

    I'm not using it directly, but I am refering to it for writing my code. My best guess at this point is some configuration register is controling those low-order bytes on the raw pressure and temperature data. I was hoping this condition would be something obvious.

    I am setting the POWER_CTRL register to 0x33, which should set it to normal mode and turn on the temperature and pressure readings. (Incidentally, there is a bit of a type-o or section missing at 4.3.15 in the data sheet). I am leaving all the other parameters defaulted after the powerup, which I believe should be sufficient to populate the 3 pressure and 3 temperature data registers.

    At startup, I am also reading the calibration data, but I am not currently doing the final conversion. I am just looking at the raw data bytes for now.

    On the pressure data, when I treat the 3 raw bytes as an int (again, not converted, just raw data), I can tell it is reading some sort of pressure. I can see the reading change according to a relatively significnt elevation change (~10ft), but I am only getting the top 16 bits (of the 24) because the low byte is always reading 0x00

    I am reading in a loop following that initial setting of the POWER_CTRL register. I've also doublechecked by way of a read on that POWERCTRL reg as well as checking the DRDY bits in the STATUS register before reading the press/temp data registers.

    Highlighted
    Community Moderator
    Community Moderator

    Re: BMP388 first byte always zero

    Hi Spanky,

    it is hard to tell why your code is not functioning properly, but I would strongly suggest that you simply use the provided API, which is known to work.

    It requires only a read/write function, and a delay function to work.
    Highlighted
    New Poster

    Re: BMP388 first byte always zero

    I went back through and implemented the API from github. Same end results:

    Just recapping, I expect to read 3 bytes of raw pressure data. The low byte is always zero.

    Here's the debug output from my read function, which is called by way of the API through bmp3_get_sensor_data(). This is a burst read from addr 0x04

    E (210089) SENSOR_TASK: addr=0x84 index=0 val = 0x00 (len=7) <<<< this is the dummy byte at 0x04
    E (210089) SENSOR_TASK: addr=0x84 index=1 val = 0x00 (len=7) <<<< this should be the first data byte at 0x04 (which is always zero)
    E (210089) SENSOR_TASK: addr=0x84 index=2 val = 0xA7 (len=7) <<<< middle pressure byte
    E (210099) SENSOR_TASK: addr=0x84 index=3 val = 0x6D (len=7) <<<< upper pressure byte
    E (210099) SENSOR_TASK: addr=0x84 index=4 val = 0x00 (len=7) <<<< this should be the first temperature byte at 0x07 (which is always zero... just like the first pressure byte)
    E (210109) SENSOR_TASK: addr=0x84 index=5 val = 0xC8 (len=7) <<<< middle temperature byte
    E (210119) SENSOR_TASK: addr=0x84 index=6 val = 0x84 (len=7) <<<< upper temperature byte

     

    Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist