The BMA400 datasheet may be wrong about the logical combination in the Generic interrupts: Register 0x40, page 86, and 0x4B, page 92 gen1/2_comb_sel: 0x00 = logical OR << in reality, 0x00 requires ALL enabled axes to comply (AND/all) 0x00 = logical AND << in reality, 0x01 requires ONE of the enabled axes to comply (OR/any) I found this while experimenting with the BMA400 shuttle board and the Development Desktop 2.0 software. This may be causing your problem. EDIT: Actually, maybe not. My experiments were with manual reference updates and one-time reference updates. I just tried it with the "every time" reference update mode (the mode you are using). The "every time" mode appears to have valid combinational logic -- although it's hard to tell, because the reference is always changing. In "every time" mode, interrupts happen more often when the bit is set to 0x00, so I think that's an indication of a logical OR operation.
... View more
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.
... View more