Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 

    BMA456 FIFO issue

    keizerr
    New Poster

    Re: BMA456 FIFO issue

    Excuse me, 
    I have already made a brief description of my  application in this post:
    https://community.bosch-sensortec.com/t5/MEMS-sensors-forum/Possible-bug-in-BMA456-driver/m-p/46299#...
    and as it might be apparent, I decided to focus on hearable features of BMA456.
    So, I would like to know, what information about my application do you exactly need? What shall be added to this description in order to start a conversation about the issues I raised on the forum?

    Regards,
    Roman

    BSTRobin
    Community Moderator

    Re: BMA456 FIFO issue

    Hello keizerr,

    I setup SW code based on github code "https://github.com/BoschSensortec/BMA456-Sensor-API/blob/master/examples/bma456/generic/fifo_waterma...", BMA456 FIFO works.
    Please refer attachment example code.

     

    Weaver
    Member

    Re: BMA456 FIFO issue

    Hi BSTRobin and keizerr,

    I've run into the same issue. I can read the tap detection when bma456h_write_config_file(&bma) is included, but not the FIFO. When this command is omitted, the FIFO operates, but the tap detection does not. I suspect the error is in my configuration. Although I am setting the FIFO interrupt to map to BMA4_INTR2_MAP, it appears on BMA4_INTR1_MAP (an indication that the config file needs to be written, I think).

    keizerr, have you had any luck in solving this issue?

    BSTRobin, unless I am mistaken, the code sample you provided is for the BMA456 rather than BMA456h.

    I would be happy to use the BMA456 feature set, except that I was unable to get tap detection working using it. The project comprises a wearable that intermittently records high resolution accelerometer data and uses tap detection for user inputs. Do you have any advice on which feature set would be preferred?

    Cheers,

    Michael.

    Weaver
    Member

    Re: BMA456 FIFO issue

    Regarding the INT1 vs INT2 for FIFO usage in the API: 

    Ok, no sure if the API definitions have been fully updated or not, but after a deeper look at function "bma4_map_interrupt" in "bma4.cpp", it seems it can only target the INT1 output. Here is the originally provided interrupt masks and mapping function:

     

    /**\name    INTERRUPT MASKS        */
    #define BMA4_FIFO_FULL_INT                       UINT16_C(0x0100)
    #define BMA4_FIFO_WM_INT                         UINT16_C(0x0200)
    #define BMA4_DATA_RDY_INT                        UINT16_C(0x0400)
    #define BMA4_MAG_DATA_RDY_INT                    UINT16_C(0x2000)
    #define BMA4_ACCEL_DATA_RDY_INT                  UINT16_C(0x8000)
    
    
    /*!
     *  @brief API sets the interrupt to either interrupt1 or
     *  interrupt2 pin in the sensor.
     */
    int8_t bma4_map_interrupt(uint8_t int_line, uint16_t int_map, uint8_t enable, struct bma4_dev *dev)
    {
        int8_t rslt;
        uint8_t data[3] = { 0, 0, 0 };
        uint8_t index[2] = { BMA4_INT_MAP_1_ADDR, BMA4_INT_MAP_2_ADDR };
    
        /* Check the dev structure as NULL */
        rslt = null_pointer_check(dev);
    
        if (rslt == BMA4_OK)
        {
            rslt = bma4_read_regs(BMA4_INT_MAP_1_ADDR, data, 3, dev);
            if (rslt == BMA4_OK)
            {
                if (enable == TRUE)
                {
                    /* Feature interrupt mapping */
                    data[int_line] = (uint8_t)(int_map & (0x00FF));
    
                    /* Hardware interrupt mapping */
                    data[2] = (uint8_t)((int_map & (0xFF00)) >> 8);     // <------------------------ does not allow for INT2
                }
                else
                {
                    /* Feature interrupt un-mapping */
                    data[int_line] &= (~(uint8_t)(int_map & (0x00FF)));
    
                    /* Hardware interrupt un-mapping */
                    data[2] &= (~(uint8_t)((int_map & (0xFF00)) >> 8)); // <------------------------ does not allow for INT2
                }
    
                rslt = bma4_write_regs(index[int_line], &data[int_line], 1, dev);
                if (rslt == BMA4_OK)
                {
                    rslt = bma4_write_regs(BMA4_INT_MAP_DATA_ADDR, &data[2], 1, dev);
                }
            }
        }
    
        return rslt;
    }

     

     

    The 'int_line' argument has no influnce on the data being sent to 0x58 (INT_MAP_DATA), data[2]. After changing  'int_map' from 0x0200 to 0x2000 ( see datasheet below ) the INT2 mapping is successful, so it is basically ignored.

     

    From the datasheet (Rev 3.0_112020):

    Weaver_0-1635995664142.png

    The function seems to be modifiable to correct this by simply changing the amount of bit shifting based on the line selected, as follows:

    // ...
    
    /* Hardware interrupt mapping */
    data[2] = (uint8_t)((int_map & (0xFF00)) >> (4 * (2 - int_line)));     // Shift 8 bits for INT1, 4 for INT2
    
    //...

     

    Please correct me if I have misunderstood the correct use of this API function though. 🙂

     Cheers,

    Michael.

    BSTRobin
    Community Moderator

    Re: BMA456 FIFO issue

    Hello Weaver,

    The code I provided has the same function as the code on GitHub and works normally.
    BMA456 also support TAP detection, you could see example code from here: https://github.com/BoschSensortec/BMA456-Sensor-API/blob/master/examples/bma456/generic/tap.c

    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