AnsweredAssumed Answered

MMA8652FC tap detection

Question asked by Daniel Berenguer on Aug 1, 2014
Latest reply on Aug 4, 2014 by Daniel Berenguer

I'm currently working with a MMA8652FC 3-Axis, 12-bit Digital Accelerometer. I've been able to configure the sensor and read axis data (acc) from a MSP430 MCU but now I want to go a step further. This time I want the MMA8652FC to cause an interrupt whenever a tap or a double-tap is detected but I've been unable to find any related documentation or example in the web. Only AN4083 explains how to configure generic interrupts but the pulse detection seems to be much more complicated with all those partial enabling bits and threshold values.

 

This is how I'm configuring the sensor so far:

 

// Enter STANDBY mode

accel.write(MMA8652_CTRL_REG1  0);

// Dynamic range

accel.write(MMA8652_XYZ_DATA_CFG  0);  // Dynamic range = +-2g

// Enable interrupts

accel.write(MMA8652_CTRL_REG3, 0x10)   // Pulse function interrupt can wake-up system

// Enable Pulse detection

accel.write(MMA8652_CTRL_REG4, 0x04)   // Enable Pulse Detection Interrupt

// Enable pulse detection on each axis

accel.write(MMA8652_PULSE_CFG, 0x55);  // Enable single Pulse Detection on all axis

// Pulse thresholds

accel.write(MMA8652_PULSE_THSX, 0x0A); // Threshold X = 10

accel.write(MMA8652_PULSE_THSY, 0x0A); // Threshold Y = 10

accel.write(MMA8652_PULSE_THSZ, 0x0A); // Threshold Z = 10

// Enter ACTIVE mode

accel.write(MMA8652_CTRL_REG1  0x21);    // ACTIVE mode, Normal mode, data rate = 400 Hz

 

The above code is supposed to generate a (falling) interrupt on INT2 when a tap or double-tap event is detected but it's not the case. Is there any sample code where I could get some ideas from?

 

Thanks in advance for your time.

 

Daniel.

Outcomes