How to enable interrupt pin for motion detect of MMA8452 How to enable interrupt pin for motion detect of MMA8452? my (initial interrupt) code for mma8452 following , it doesn't work ..... WriteByte(MMA8451, 0x15 , 0x78);// MT Configure , 78 or f8 WriteByte(MMA8451, 0x17 , 0x30);// Moction Threshold , 0x30 WriteByte(MMA8451, 0x18 , 0x30);// Debounce Count WriteByte(MMA8451, 0x2a , 0x18);// Ctrl_reg1 WriteByte(MMA8451, 0x2b , 0x00);// Ctrl_reg2 ,ALPE WriteByte(MMA8451, 0x2d , 0x04);// Enable Int function FF_MT , 04 WriteByte(MMA8451, 0x2e , 0x04);// Int enable : MT by int1:1 or int2:0 WriteByte(MMA8451, 0x2C , 0x0A);// Sleep bypass , int active low , pushpull Re: How to enable interrupt pin for motion detect of MMA8452 Hi Ryan, A couple of suggestions that might help: 1. Since IPOL = 1 (active high), make sure that your MCU interrupt pin is configured as GPIO input with an interrupt on rising edge. 2. Try to decrease the threshold value to ~1.5g (0x18) for example. 3. In your ISR you need to acknowledge an IRQ and read the FF_MT_SRC register to clear the SRC_FF_MT bit in the INT_SOURCE register (0x0C) and deassert the INT pin. You might find useful my simple example code that is available here. Hope it helps. Regards, Tomas
記事全体を表示