Description: I'm using one of your MMA8451 3axis devices with a Nordic
Semi nrf51822. I'm using the built-in function to detect a tap and
a flip. The tap is directed to INT1 and the flip is directed to INT2.
I can currently detect both interrupts and distinguish between
them based on which GPIO pin on the nrf51822 is driven. The
GPIO pins are configured as pull-up's.
I've been using int1 and the tap detection for a while with no
problem. I added the flip detection to INT2 today and now,
occasionally, after the int serv. routine is triggered one, or the
other (depending on which was triggered) will not reset after
reading the appropriate status register. I do read both status
registers each time to be safe - PL_STATUS_REG and
PULSE_SRC_REG - and the values look correct.
I'm measuring the INT pin voltages and once this occurs either
INT1 or INT2 stays low and no more interrupts are generated by
the accel until a power cycle.
Can you help with some suggestions as to what I'm doing
wrong?
The init routing to set up the accel is in the attached file after the
pre-processor.
void accel_init(void)
{
uint8_t regValue, newRegValue;
turn_off_accel();
newRegValue = 0x10;
regValue = twi_read_register(0x3A, 0x2A);
twi_write_register(0x3A, 0x2A, (regValue & 0xC7) | 0x10);
twi_write_register(0x3A, 0x21, (0x00 | 0 << 6 | 0 << 5 | 1 << 4 | 0 << 3 | 1 << 2 | 0 << 1 | 1 << 0));
uint8_t ac = ((uint8_t)((double)1.575/0.063));
twi_write_register(0x3A, 0x23, ((uint8_t)((double)1.575/0.063)));
twi_write_register(0x3A, 0x24, ((uint8_t)((double)1.575/0.063)));
twi_write_register(0x3A, 0x25, ((uint8_t)((double)2.65/0.063)));
twi_write_register(0x3A, 0x26, ((uint8_t)(50 / 2.5)));
twi_write_register(0x3A,0x27, ((uint8_t)(140 / 5.0)));
twi_write_register(0x3A, 0x2A, 0x10 | 0 << 2);
twi_write_register(0x3A, 0x2B, (0x00 | 1 << 0 | 1 << 3 | 1 << 1 | 1 << 4 | 0 << 2));
twi_write_register(0x3A, 0x2C, 0x00);
twi_write_register(0x3A, 0x2D, (0x00 | 0 << 2 | 1 << 3 | 1 << 4));
twi_write_register(0x3A, 0x2E, (0x00 | 0 << 2 | 1 << 3 | 0 << 4));
twi_write_register(0x3A, 0x11, 0x40);
twi_write_register(0x3A, 0x13, 0xC0);
twi_write_register(0x3A, 0x14, (0x07 << 3 | 0x01));
twi_write_register(0x3A, 0x12, ((uint8_t)(100 / 5.0)));