Bosch Sensortec Community

    Showing results for 
    Search instead for 
    Did you mean: 

    BMA400 interrupt for single sample that exceeds threshold

    New Poster

    BMA400 interrupt for single sample that exceeds threshold


    In our application, we would like to configure the accelerometer to hold pre-trigger information in FIFO (BMA400 must be configured in normal mode). If a single sample exceeds the pre-defined threshold we need to wake up the main uC and read the entire FIFO.  

    We thought that wake-up interrupt will be able to do this but it looks like it works low power mode only. We were considering generic interrupt but the datasheet states that "The data rate for the filter output must be 100Hz" which is too low in our application (at least 400 Hz is required).

    Is it possible to configure BMA400 to generate pin interrupt if a single sample exceeds the pre-defined threshold in normal mode, please?

    Kind regards,

    Tags (1)
    2 REPLIES 2
    Community Moderator

    Re: BMA400 interrupt for single sample that exceeds threshold


    Thanks for your inquiry.

    BMA400 Gen1 and Gen2 interrupts can select ACC_Filt1 or ACC_Filt2. If you choose ACC_Filt2, then it is fixed at 100Hz data samples for Gen1 and Gen2 interrupt engine. If you configure BMA400 ODR to ACC_Filt1 and select ACC_Filt1 as data source for Gen1 or Gen2, then the ODR becomes 400Hz. You can also select threshold and duration of 2.5ms which stands for one single sample.

    Here is the pseudo code for +/-4g full scale range, 104mg threshold, 400Hz ODR for both data and Gen1 interrupt, every time data source to see if the  difference between current sample and previous sample exceeds the threshold or not. If yes, then INT1 pin will have a pulse for the Gen1 interrupt.

    void init_BMA400(void)


    // configure common control registers

                Write 0x02 to register 0x19;               // bring BMA400 to normal mode from sleep mode

                Write 0x4A to register 0x1A;              // set BMA400 to 400Hz ODR, +/-4g full scale range and 0 over sampling rate (OSR) meaning one single 

                                                                                      measurement without averaging. The current consumption is about 3.5uA

                Write 0x00 to register 0x1B;               // select acc_filt1 400Hz as source for data registers


    // configure generic interrupt 1 parameters

                Write 0xE8 to register 0x3F;              // enable X/Y/Z axis for interrupt evaluation. Gen1 interrupt engine data source is acc_filt1 which is 400Hz ODR or

                                                                                      2.5ms time interval. Every time from data source update and hysteresis 0mg

               Write 0x02 to register 0x40;               // select activity detection which means the interrupt will be generated when the sample is beyond the +/-

                                                                                      threshold zone. Select OR logic meaning that any axis can trigger the interrupt

                Write 0x0D to register 0x41;              // set inactivity threshold to 0x0D = 13LSBs = 13LSBs * 8mg/LSB = 104mg (can be fine-tuned)

                Write 0x00 to register 0x42;               // set MSB of Gen1 interrupt duration to 0x00

                Write 0x01 to register 0x43;              // set LSB of Gen1 interrupt duration to 0x01 = 1LSBs = 1 * 2.5ms =2.5ms (can be fine-tuned). This corresponds to

                                                                                      one single sample

    // configure interrupt registers

                Write 0x04 to register 0x1F;               // enable generic interrupt 1 (Gen1)

                Write 0x04 to register 0x21;               // route Gen1 interrupt signal to INT1 pin

                Write 0x22 to register 0x24;               // set INT1 pin and INT2 pin both to push-pull and active-high


    Now when you tap the table that BMA400 is sitting on, BMA400 Gen1 will generate an interrupt on INT1 pin. It is very sensitive. You can fine tune the threshold and duration to reduce the sensitivity.


    New Poster

    Re: BMA400 interrupt for single sample that exceeds threshold

    Hello FAE_CA1, 

    Thank you very much, I confirm that this works as you described. I think we were confused by the statement that filter output "must be" 100 Hz for generic interrupts.

    Kind regards,