Bosch Sensortec Community

    Showing results for 
    Search instead for 
    Did you mean: 

    BMA400 Generic Interrupt reference update not working (manual and one-time, vs every time)

    New Poster

    BMA400 Generic Interrupt reference update not working (manual and one-time, vs every time)

    While testing the BMA400, the reference values do not update correctly.
    I'm  using Development Desktop 2.0 with the BMA400 shuttle board to test the Generic Interupt functions.
    Both GEN1 and GEN2 are enabled. 
    They are configured the same, except for the "activity reference update": 
    - GEN1 is set for "every time by data source"
    - GEN2 is set for "one time".


    I constantly move the board around, while pressing "Read".
    - The reference values for GEN1 update as expected. 
    - The reference values for GEN2 do not update at all.  It behaves the same as "manual" mode.

    I have confirmed that GEN2INT_CONFIG0.act_refu=01.

    Updating the  reference values "every time" means that slow changes are not detected.  For this, we need "one time".  
    "Manual" updates would work, but this increases the MCU comms traffic.  Is there another solution?

    I have new insight, but it does not solve the problem.  

    I am now playing with the "manual update" mode.  I can write to the reference registers (0x53, 0x54).  
    However, once written, the registers cannot be changed while the interrupt is enabled.

    In the datasheet, section 4.7:
    "Any change of an interrupt configuration must be executed when the corresponding interrupt is disabled." 

    So, to change the reference values in "manual update" mode:
    1.  disable the interrupt
    2.  change the register value
    3.  enable the interrupt.  (Oddly, we need to enable the interrupt to make the change appear in the register.)

    Using this information, I tried the "one time" update mode again.
    The "one time" update mode works, but only by toggling the interrupt "enable" bit, off and on, each time the interrupt fires.

    Is this how it was designed?  This seems bizarre.  

    Additionally, toggling the "enable" bit causes the reference registers to update, even if the interrupt has not fired. 
    This is not expected behaviour.

    2 REPLIES 2
    Community Moderator

    Re: BMA400 Generic Interrupt reference update not working (manual and one-time, vs every time)

    Hello dsherman,

    First, could we know what functions do you want to implement with GEN1 and GEN2?

    New Poster

    Re: BMA400 Generic Interrupt reference update not working (manual and one-time, vs every time)

    I'm just trying to figure out how this interrupt works.  The application is irrelevant, but I'll give you an example.

    A self-balancing robot (like a Segway) needs to know when its inclination changes.  Options are:
    1.  Don't use interrupts, use continuous polling.
    2.  Use the "orientation changed" interrupt
    3.  Use the "generic" interrupt
    Let's assume we want to use interrupts, so the first option is excluded.
    The "orientation changed" interrupt is good, but it does not force a wakeup from low-power mode.
    That leaves the "generic" interrupt.
    To use the generic interrupt in "manual" reference update mode, I would have to manually set the reference incline:
    1.  Measure the X, Y, and Z accelerations (read 6 data registers)
    2.  Disable the interrupt.
    3.  Write these values to the 6 reference registers.
    4.  Enable the interrupt.
    It seems easier to use the automatic features of the BMA400.  The automatic options are "every time" or "one time".
    If we use the "every time" update mode, the robot responds too slowly.  As the robot starts to fall over, the angle creeps slowly at first.  In "every time" mode, the reference registers update at every tick of Filter2.  This means the change will go unnoticed until the change from one tick to the next tick exceeds the threshold.  Small changes (say, 3/4 of the threshold value) will not trigger the interrupt.  Then the reference values update, which allows another full threshold of movement.  Another small change, and then another small change, and then another... the robot is leaning quite far before the interrupt fires.   
    The "one time" update option seems perfect.  Instead of updating the reference at EVERY tick, the BMA400 leaves the reference values constant until the threshold is exceeded.  When the threshold is exceeded, the interrupt triggers, which alerts the MCU.  Also when the interrupt triggers, the reference values should update.  The reference values should now indicate the current inclination of the robot, so further movement of the robot can be detected and handled the same way.  This is the behaviour that is described in the datasheet -- but this is not what happens.
    This is what happens (for "one time" reference updates):
    - When the generic interrupt is enabled, the reference values update.
    - When the device enters normal mode, the reference values update.  
    - When the interrupt triggers, the reference values do NOT update.  This is unexpected, and contrary to the datasheet.
    This means that this interrupt cannot be used for this application, unless we toggle the interrupt enable, or put the device in low-power mode between each interrupt.  Maybe we could use the generic interrupt when the device is in low power mode, and switch to the "orientation changed" interrupt when the device is in normal mode.  This seems strange to use two interrupt functions for a single purpose.  We could use one, but only if the generic interrupt behaved as the datasheet describes.
    Again, this isn't my real application.  I don't need help with a specific application.  I am just trying to understand how the device works.  I believe there are inconsistencies between the device behaviour and the documentation.  Any insight you can offer would be appreciated.