Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 
    SOLVED

    BMM350 not updating data after suspend mode

    BMM350 not updating data after suspend mode

    444
    Member

    I have been using BMM350.  I am initialising it using APIs from the library and setting power mode suspend and then when I put it in forced mode and see data , it returns me same data all the time ? what can be the problem ?

    following is my code.

    if I do not put sensor in suspend mode , it runs ok! @BSTRobin 
    --------

     bmm350_init(&dev);/* Initialize BMM350 */

    /* Set ODR and performance */
     bmm350_set_odr_performance(BMM350_DATA_RATE_1_5625HZ, BMM350_NO_AVERAGING, &dev);

    /* Enable all axis */
    rslt = bmm350_enable_axes(BMM350_X_EN, BMM350_Y_EN, BMM350_Z_EN, &dev);

    rslt = bmm350_set_powermode(BMM350_NORMAL_MODE, &dev);

    rslt = bmm350_delay_us(10000, &dev);

     

    rslt = bmm350_get_compensated_mag_xyz_temp_data(&mag_temp_data, &dev);

    bmm350_set_powermode(BMM350_SUSPEND_MODE,&dev); // power saving while not in use
    while (1){
    bmm350_set_powermode(BMM350_FORCED_MODE,&dev); // power saving while not in use

    bmm350_get_compensated_mag_xyz_temp_data(&mag_temp_data, &dev);
    delay(1000);
    }


    I can not see updated data if sensor is not sampling at ODR rate as can be seen in the following picture. Only when I see periodic current consumption at ODR rate I see updated data. The time between two current peak is around 663 ms which is inverse of 1.5625 Hz.

    Screenshot from 2024-03-12 10-23-13.png

    7 REPLIES 7

    @BSTRobin
    I am using exactly same code without any change.
    I am using Renesas MCU  and sensor interfaced as shown in following figure. VCC is having 1.8V
    Screenshot from 2024-03-21 10-15-49.png

    I also tried to put a loop around PMU busy and it seems like it is busy always, never gets free.
    loop looks like this

     

     

        /* Check PMU busy */
        rslt = bmm350_get_pmu_cmd_status_0(&pmu_cmd_stat_0, &dev);
        bmm350_error_codes_print_result("bmm350_get_pmu_cmd_status_0", rslt);
    
        printf("Expected : 0x07 : PMU cmd busy : 0x0\n");
        printf("Read : 0x07 : PMU cmd busy : 0x%X\n", pmu_cmd_stat_0.pmu_cmd_busy);
    
    
        while(pmu_cmd_stat_0.pmu_cmd_busy != 0){
            /* Check PMU busy */
            rslt = bmm350_get_pmu_cmd_status_0(&pmu_cmd_stat_0, &dev);
            bmm350_error_codes_print_result("bmm350_get_pmu_cmd_status_0", rslt);
    
            printf("Expected : 0x07 : PMU cmd busy : 0x0\n");
            printf("Read : 0x07 : PMU cmd busy : 0x%X\n", pmu_cmd_stat_0.pmu_cmd_busy);
    
            R_BSP_SoftwareDelay(100, BSP_DELAY_UNITS_MILLISECONDS);
        }

     

     

    output looks like this Always,  you can also see my code in the attachment
    Expected : 0x07 : PMU cmd busy : 0x0

    Read : 0x07 : PMU cmd busy : 0x1
    Also I tried to put a loop around error checking which is returning 0xff always!

    And I want to know what is the correct way to put sensor in low power mode and read valid values occasionally. It is not clear from the examples.
    shold I configure it
    1. init -> Normal mode -> suspend mode -> loop [forced mode -> read]
    2. init -> Normal mode -> suspend mode -> loop [read ]  --- this is in example , but as you said it is not useful
    3.
    init -> forced mode -> loop[read] -- I tried forced mode example but results are not changing the same as this one, I have attached that logs and code as well.

    @BSTRobin 

    I am putting this sensor in Suspend mode and reading it after putting it into forced mode, it seems all the registers have FF
    init->normal mode -> suspend mode -> loop [ forced mode -> wait 2s -> read]
    Screenshot from 2024-03-21 12-36-22.png


    The issue is solved by lowering the baud rate on I2C from around 300k to around 100k. 

    correct sequence to read in suspend mode is

    init -> settings -> suspend mode -> loop [forced mode -> read sensor]
    combination 1 in example of forced mode is not following the above mentioned sequence and not producing updated value in each loop.

    Thanks a lot for your help @BSTRobin 

    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