Bosch Sensortec Community

    Showing results for 
    Search instead for 
    Did you mean: 

    BMA456 functionality

    BMA456 functionality

    New Poster

    My questions relate to use of the BMA456 accelerometer. In our application the microcontroller will initiate accelerometer readings via the I2C bus then the micro will be required to enter a low-power mode due to restrictions resulting from battery capacity. I note the BMA456 device includes a FIFO buffer of 1024 bytes, so I was wondering if the device can be programmed such that this memory be configured to store the measured readings ? Then it would cause an interrupt to the microcontroller which would wake and read these stored values via I2C. Ideally we would take 1000 readings, but I don't believe this many can be stored simultaneously ? If one "reading" actually corresponds to obtaining 6 bytes of data (2 bytes each for the x, y and z axes) then 160 readings equates to a total of 960 bytes which can be stored in the FIFO - is this understanding correct assuming only data is stored without any associated headers ?  We program the device to interrupt the micro when the FIFO reaches a level of 960 bytes and of course the acquisition data rate is also programmed so, for example, these readings may be acquired at 12.5Hz (or whatever).  Repeating this process 6 times would result in 960 readings which is near enough to our target of 1000.  I have read the datasheet but don't fully understand the operation hence require confirmation on some points, please, before confirming our hardware design.  I think the alternate to this approach is to take 960, or 1000, individual readings with the microcontroller never entering a sleep mode, but I think that would take much longer and the micro would be consuming more power ?  Thanks


    5 REPLIES 5

    Community Moderator
    Community Moderator

    Hello TMunb,

    BMA456 have FIFO watermark interrupt, you can set a watermark length, such as 960 bytes, and configure the sensor to work in low power mode. When the data stored in FIFO reaches 960 bytes, the interrupt triggers MCU to read FIFO data.

    The current consumption of 50 Hz ODR is shown in the table below:

    BMA456 current consumption.png

    Thank-you very much, BSTRobin.

    Just some follow-up questions if I may, please.

    I understand the point about the watermark length which I can set to 960 (through registers FIFO_WTM_0 and _1).  Is it correct that if I choose the non-header setting then 160 readings will result in exaclty 960 bytes of data (3 channels each producing 2 bytes of data, msb and lsb) - have I understood correctly here ?

    The part of your answer I'm not sure about relates to placing the device in low-power mode.  For low-power mode the datasheet says, on page 20/102, "The samples acquired during the normal mode will be averaged and the result will be the output data".  For example, if I choose acc_bwp = 0x00, which is for no averaging, then will I simply receive the result of 160 individual samples ?  If I choose acc_bwp = 0x01, which is the setting for average 2, then is each of the 160 results actually based on two samples and it is the average of these two that is provided as the result ?

    How does this mode compare to performance mode ?  Is it simply that in performance mode no averaging is performed and so it is just one sample provided for each result ?  If so how is this different to low-power mode with no averaging ?

    And is the time taken to wait for 160 samples to be written to FIFO plus the time needed to read this data equal to the time it would take to request and immediately receive a single sample and then to do this serially 160 times ?  Is it correct that for this second approach we do not need FIFO and can simply read the relevant registers (DATA_0 to DATA_5) directly after each set of samples is ready ?  As well as a time difference is there also a difference in current consumption between the two approaches.

    The tables on pages 24 and 25 show what I believe is the FIFO buffer.  With the auxiliary sensor disabled, our case, will the first reading be stored at address 0 ?  So ACC_X LSB at address 0, ACC_X MSB at address 1, ACC_Y LSB at address 2, etc.  And how do we use command FIFO_DATA to read this data ?

    I'm trying to learn this device, so thanks for your understanding.

    kind regards,

    Community Moderator
    Community Moderator

    Hello TMunb,

    I understand the point about the watermark length which I can set to 960 (through registers FIFO_WTM_0 and _1). Is it correct that if I choose the non-header setting then 160 readings will result in exaclty 960 bytes of data (3 channels each producing 2 bytes of data, msb and lsb) - have I understood correctly here ?
    Reply: Yes

    ACC_CONF.acc_bwp setting affects the internal average sampling, and FIFO data is processed data. The larger the average sampling, the smaller the noise and the higher the power consumption.

    BMA456 current consumption in low power mode.pngBMA456 power mode.png


    There was example code in github for your reference.


    hi again BSTRobin,

    I'm back onto this task and having read the bma46 datasheet don't sufficiently understand fifo watermark headerless mode. This sounds like the mode to use for our application where we would like to instruct the bma456 to take a fixed number of samples, having earlier configured the various parameters such as odr, bandwidth, and range, and then for it to toggle either the int1 or int2 output pin/s when it has completed that task.

    I've looked at the sample code but note that it never moves beyond the "if" statement; ie, it continuously reads the the int status:

    while (1)
    rslt = bma456_read_int_status(&int_status, &dev);
    bma4_error_codes_print_result("bma4_read_int_status", rslt);

    if ((rslt == BMA4_OK) && (int_status & BMA4_FIFO_WM_INT))
    rslt = bma4_get_fifo_length(&fifo_length, &dev);

    You confirmed, above, that my understanding on one point was correct; ie, I can set the watermark length to, say, 960 (through registers FIFO_WTM_0 and _1) and with the non-header setting this would equate to 160 readings (with 3 channels each producing 2 bytes of data that's 6 bytes and 6 x 160 = 960).

    I appreciate that the sample code uses different values, for example wm_lvl = BMA456_FIFO_WATERMARK_LEVEL = 600 which I believe means it is set for 100 actual samples of x, y, and z, but why does it not move beyond the "if" statement ?

    In your earlier answer, above, you say "When the data stored in FIFO reaches 960 bytes, the interrupt triggers MCU to read FIFO data." - I assume you mean the int1 and/or int2 pin/s ? Is the sample code also written to cause an interrupt to the MCU albeit at the 600 byte mark ? If so what is the intention of continually reading the int status through bma456_read_int_status(&int_status, &dev) ?

    In another topic on this forum, "BMA400 FIFO Watermark Question", someone asked "When using the FIFO watermark feature of the BMA400 accelorometer, it does stop filling at the watermark? I pretty sure it does but, I can't quite provide it..." to which your colleague responded "No, even though FIFO reaches to watermark level and you don't read FIFO, it can be overflowed.". Is the same true of the BMA456 ? What does this mean in practice ? The int1 and/or int2 pin/s are activated by the BMA456, and then we begin to read the data - what if we don't begin or complete this process quickly enough ? I know the BM456 has an option to discard new data when FIFO becomes full, but in this case FIFO should not ever become full as we have set a watermark level which is obviously less than the full amount - is that understanding correct, and if so how does the FIFO overflow when we are instructing the device to stop at a lower level say at 960 bytes ? By setting the, lower, watermark level are we in fact telling it to stop at that point or does it keep going ?

    The datasheet mentions ... Please check "Application note - wearable feature set" or "Application note - hearable feature set" ... from where can I obtain these app notes, and are they relevant to this topic ?