Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 

    questions on upload_file

    questions on upload_file

    victorheca01
    Established Member

    Hi, All

    I am working on the BMI270 driver.    In the function of upload_file(), what does the following 2 lines mean?

     rslt = bmi2_set_regs(BMI2_INIT_ADDR_0, addr_array, 2, dev);

     rslt = bmi2_set_regs(BMI2_INIT_DATA_ADDR, (U8 *)config_data, write_len, dev);

    does it mean to set register BMI2_INIT_ADDR_0 with 2 bytes of addr_array? set register of BMI2_INIT_DATA_ADDR with 46 bytes of config_data?

    Questions 1:

    As index will increment from 0 to 8088 (which is the config_file size) the addr_array will also increased to 8088, but max value BMI270's register address is just 0x7f, will this cause a problem? 

    Question 2:

     after I successfully run the upload_file function, I get internal_staus by

    rslt = bmi2_get_internal_status(&load_status, dev);

    and found that load_status is 0xff and 

    sensor_data.acc.x = -1;

    sensor_data.acc.y = -1;

    sensor_data.acc.z = -1;

    what is the problem for this result? Thanks in advance.

    Victor

     

    1 REPLY 1

    BSTRobin
    Community Moderator
    Community Moderator

    Hi victorheca01,

    You can refer to the comments for the code in function upload_file().
    /* Write the 2 bytes of address in consecutive locations */
    rslt = bmi2_set_regs(BMI2_INIT_ADDR_0, addr_array, 2, dev);

    /* Burst write configuration file data corresponding to user set length */
    rslt = bmi2_set_regs(BMI2_INIT_DATA_ADDR, (uint8_t *)config_data, write_len, dev);

    The config file is not written at once, it is segmented and written to the sensor. Please refer to the following code:
    /* Write the configuration file */
    for (index = 0; (index < config_size) && (rslt == BMI2_OK); index += dev->read_write_len)
    {
    rslt = upload_file((dev->config_file_ptr + index), index, dev->read_write_len, dev);
    }

    For loading config file failed, you can strictly compare your code and BMI270 example code https://github.com/boschsensortec/BMI270-Sensor-API/tree/master/bmi270_examples

    I also uploaed a example code on STM32 for your reference.

    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