Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 

    BMA400 Watermark Issue

    BMA400 Watermark Issue

    Mari
    New Poster

    Hi to all,

    I have issue with my BMA400, the sensor is managed by a PIC18 on I2C bus. I configured the sensor by following the official example code on GitHub. 

    The configuration of the sensor is:

    - ODR=25Hz => 25frame/s => 175bytes/secondo @12-bit di risoluzione
    - range=2g
    - normal power mode set
    - interrupt active low, push-pull on INT1 pin

    - active FIFO watermark on x,y, z axis, watermark=217bytes ( => 31(frame)x7), NO sensortime, teaming mode enabled.
    - set latching mode (interrupt cleaned after status interrupt read out)
    - FIFO_WM_INT is enabled and mapped on INT1 pin

    The init phase follow the diagram above:

    Mari_0-1709222600426.png

    One flush cmd is sent before to enable the interrupt.

    Every time the FIFO wm trigger the interrupt, a dedicated routine was called, the flow chat of is:

    fifo_wm.png

    the operations are more or less the same on example code done in the example file (https://github.com/boschsensortec/BMA400_SensorAPI ).

    And now the problem that I see:

    - if I use ODR>25Hz, after the first FIFO wm complete acquisition, the other are incomplete, by increasing the ODR, the lost frame are increasing too, but with the oscilloscope I can see the change of the pin state;

    - so, i fixed the ODR to 25Hz, but I  notice that the accelerations are very similar for every fifo wm, for example in picture below, in left side the sensor is upside-down compared with the position (and acceleration) on right side

    fifo compare.png

    - after the extraction and print of the accelerations, a flush cmd is sent and after that I must repeat the FiFO configuration, otherwise I can't see a new interrupt.

    I also used as refernce the documents "How to use BMA400 FIFO.pdf".

    I'm sure that the problem is on FIFO configuration, but I don't know/understund what I'm missing or what I'doing wrong. I hope, someone in the community could help me....

    To exclude an hardware problem, I also simulate a FIFO wm by using "data ready" with interrupt and in my opinion, it is working, I can modify the configurations and I read correclty the acceleration data when the sensor is moved in all the directions!

    Thanks to all,

    Mari

     

     

     

    6 REPLIES 6

    BSTRobin
    Community Moderator
    Community Moderator

    Hi Mari,

    I setup BMA400 FIFO watermark example code for your reference, hope it is helpful for you.

    It runs well on my side:

    BMA400 25 Hz FIFO watermark interrupt.png

    Hi BSTRobin,

    thanks for your sample code. I used it to compare the mine and understand the problem, at the end I have find out the problem in my code: in the library of the sensor, I modified one routine because, as it is implemented, it fail on compiling phase.

    The routine is "bma400_get_regs()" and the problem is the declaration of the local array "uint8_t temp_buff[(len + lun_dummy)] ", in which the dimension  is fixed by using a variable, this is not allowed with XC8 compiler and I fixed it to 100bytes. So, it is not enought for all data, with a bigger array, data are correct and it are alligned with the position of the accelerometer. 

    Marilena

     

    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