AnsweredAssumed Answered

MMA7660 Auto-Wake / Auto Sleep mode

Question asked by A Kircher on Dec 10, 2015
Latest reply on Dec 14, 2015 by A Kircher

Hello,

I try to set up mma7660, that it runs in Auto Sleep with high sample rate and in Auto-Wake in low sample rate.

During the transition from Auto-Wake to Auto-Sleep I would like to fire an interrupt.

The interrupt trigger should be the Delta G condition.

Unfortunately I can not make it work. The initialisation looks like this:

 

 

void setup(){

   write(MODE,0x00);//0x00 = Stan dby Mode -- allows config to be written

    write(INTSU, INTSU_ASINT );// Interrupts for exiting Auto sleep

    write(PDET,PDET_XDA|PDET_YDA|PDET_ZDA);//Tap detection is disabled, no threshold

    write(PD,0x0);//No Tap Filtering

    write(SR,SR_AMSR_AM16 |SR_AWSR_AW1); // Sampling Rate aktive 16 hz ; sleep 16 hz

    write(SPCNT, 16);    //  counts for sleep counter register until sleep / wake occurs

    write(MODE,MODE_MODE| MODE_AWE  /*|MODE_ASE /*|MODE_IAH*/ );// MODE_MODE = Active Mode ; MODE_AWE = Auto Wake ;

           

 

    }

 

To understand MMA7660 is in sleep or active mode I use following code

 

uint8_t GetwakeState(){

    uint8_t   s =  read(SRST);

    if ( s & SRST_AMSRS )    return 1 ;  // AUTO SLEEP == active

    if ( s & SRST_AWSRS )  return 0 ;  // AUTO WAKE  == sleeping

    return -1;

}

Unfortunately between the transistions (sleep to wake or vice versa) I do not get always an interrupt,

If an interrupt occurs there are plenty in a row and not necessarly linked to the state change.

 

Output of log file

Ws: 0 = sleep ; 1 = active

Int : number of recived interrups

x,y,z = accelarations in x,y,z direction

 

Ws 0 Int 92 x = 2 y = -3 z = -13

Ws 0 Int 92 x = 2 y = -3 z = -13

Ws 0 Int 92 x = 4 y = -3 z = -21

Ws 0 Int 109 x = 4 y = -3 z = -21

Ws 0 Int 112 x = 4 y = -6 z = -25

Ws 2 Int 112 x = 3 y = -3 z = -21

Ws 2 Int 112 x = 3 y = -3 z = -21

Ws 0 Int 112 x = 2 y = -3 z = -17

Ws 0 Int 118 x = 2 y = -3 z = -17

Ws 0 Int 121 x = 4 y = -4 z = -27

Ws 0 Int 121 x = 4 y = -4 z = -27

Ws 1 Int 121 x = -3 y = 1 z = -18

Ws 1 Int 121 x = 1 y = 5 z = -23

Ws 1 Int 121 x = 1 y = 5 z = -23

Ws 1 Int 121 x = 1 y = 2 z = -22

Ws 1 Int 121 x = 1 y = 2 z = -22

Ws 2 Int 121 x = 3 y = 0 z = -17

Ws 2 Int 121 x = 3 y = 0 z = -17

Ws 1 Int 121 x = 1 y = 3 z = -19

Ws 1 Int 121 x = 1 y = 3 z = -19

Ws 0 Int 121 x = -2 y = -2 z = -24

Ws 1 Int 135 x = -7 y = -2 z = -20

Ws 1 Int 135 x = -7 y = -2 z = -20

Ws 2 Int 135 x = -1 y = 1 z = -23

 

If you can provide any sample code making use of the sleep / wake functionlity would be helpfull

 

Thanks a lot Andreas

Outcomes