Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 

    BMP388 first byte always zero

    o_o
    Contributor

    Re: BMP388 first byte always zero

    By definition, the SPI communication is always bi-directional, but in the Bosch SPI protocol, there is always only one valid byte.

     

    Could it simply be that your MCU code needs to throw away 2 bytes ? (one read while transferring the register address, then a second one for the dummy byte)

     

    In any case, are you able to provide a screenshot of a logic analyzer to make sure that your are decoding the bus transactions properly?

    Spanky
    New Poster

    Re: BMP388 first byte always zero

    It appears that this is a factor of the ODR and OSR. 3.4.1 in the data sheet mentions this, and is sort of what I thought would be the culprit. Oversampling controls the resolution and the low order bits are set to zero unless OSR is 32x. Having all 8 bits zeroed threw me off. Incidentally, the example code on github turns off oversampling. It would be helpful to add some examples of higher resolution settings.

    I still dont have a good feel for the optimal setting (i.e. what setting yeilds the fastest sample rate as well as highest resolution?)

    The API kicks out invalid combinations, but I'm still a bit lost for the proper settings. Do you have some cookie-cutter setting combinations?

    sebmadgwick
    Established Member

    Re: BMP388 first byte always zero

    I can confirm successful operation of BMP3-Sensor-API v1.1.0, 05 Apr 2018 using SPI.  The following SPI transactions were obtained by calling bmp3_get_sensor_data(BMP3_PRESS | BMP3_TEMP, ...).

    TX: 84 00 72 6B 75 20 EE 92
    RX: 00 00 66 6B 75 58 EE 92
    
    TX: 84 00 66 6B 75 58 EE 92
    RX: 00 00 6C 6B 75 C2 ED 92
    
    TX: 84 00 6C 6B 75 C2 ED 92
    RX: 00 00 61 6B 75 91 ED 92
    
    TX: 84 00 61 6B 75 91 ED 92
    RX: 00 00 39 6B 75 AD ED 92

    The first byte is zero because this is the byte received during the transmission of the control byte (0x84).  The second byte is zero because this is the "dummy byte" as described on page 42 of datasheet v1.1.


    @Spanky wrote:

    Do you have some cookie-cutter setting combinations?


    Page 16 of datasheet v1.1 describes the recommended settings for six use cases.  I use the following initialisation code to implement the "drone" use case. This achieves an ODR of 50 Hz. Lower ODRs can result in a large phase lag that I judge not to be worth the reduction in noise.

        // Configure device structure
        bmp3.intf = BMP3_SPI_INTF;
        bmp3.read = Bmp3Read;
        bmp3.write = Bmp3Write;
        bmp3.delay_ms = Bmp3Delay;
    
        // Initialise device
        bmp3_init(&bmp3);
    
        // Perform soft reset
        bmp3_soft_reset(&bmp3);
    
        // Configure settings for drone use case as per datasheet
        bmp3.settings.press_en = BMP3_ENABLE;
        bmp3.settings.temp_en = BMP3_ENABLE;
        bmp3.settings.odr_filter.press_os = BMP3_OVERSAMPLING_8X;
        bmp3.settings.odr_filter.temp_os = BMP3_NO_OVERSAMPLING;
        bmp3.settings.odr_filter.iir_filter = BMP3_IIR_FILTER_COEFF_3;
        bmp3.settings.odr_filter.odr = BMP3_ODR_50_HZ;
        bmp3_set_sensor_settings(BMP3_PRESS_EN_SEL | BMP3_TEMP_EN_SEL | BMP3_PRESS_OS_SEL | BMP3_TEMP_OS_SEL | BMP3_IIR_FILTER_SEL | BMP3_ODR_SEL, &bmp3);
    
        // Set the power mode to normal mode
        bmp3.settings.op_mode = BMP3_NORMAL_MODE;
        bmp3_set_op_mode(&bmp3);  

     

    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