MMA8652FC & Transients

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MMA8652FC & Transients

Jump to solution
1,354 Views
haroldmccabe
Contributor I

This accelerometer on my prototype board detects transient interrupts OK. But when I read the transient source reg (0x1E) I often see 0x00; at other times I see the event flag and other axis/polarity bits set as expected.

Why do I get a transient interrupt but the transient source reg = 0x00?

I tried setting the ELE bit in the transient config reg (0x1D) but then, once I get a transient interrupt I cannot clear it and the accelerometer interrupts continually.

My initialization is as follows:

// Reset and pause at least 1 ms

SMB_Write(&accel_write_reset); // reg 0x2B <- 0x40

stop_time = (U8)ticks + 2;

while ((U8)ticks < stop_time) ;

// Transient configuration register

SMB_Write(&accel_write_trans_cfg_reg); // reg 0x1D <- 0x1E

// Transient threshold register

SMB_Write(&accel_write_trans_thresh_reg); // reg 0x1F <- 0x90

// Time threshold (width) of transient

SMB_Write(&accel_write_trans_count_reg); // reg 0x20 <- 0x01

// Use high-pass filter

SMB_Write(&accel_write_xyz_data_config); // reg 0x0E <- 0x10

SMB_Write(&accel_write_hpf);

// Configure interrupt as open drain

SMB_Write(&accel_write_control_reg_3); // reg 0x2C <- 0x01

// Write portrait/landscape config

SMB_Write(&accel_write_pl_config); // reg 0x11 <- 0x40

// Write debounce count

SMB_Write(&accel_write_pl_count); // reg 0x12 <- 0xFF

// Take defaults for PL_BF_ZCOMP and PL_THS_REG

// Route interrupts

SMB_Write(&accel_write_control_reg_5); // reg 0x2E <- 0x30

// Enable interrupts

SMB_Write(&accel_write_control_reg_4); // reg 0x2D <- 0x30

// Write to control register 1: active, ODR, fast read mode

SMB_Write(&accel_write_control_reg_1); // reg 0x2A <- 0x0B

Labels (1)
0 Kudos
1 Solution
1,061 Views
TomasVaverka
NXP TechSupport
NXP TechSupport

Hi Harold,

It looks like you have both transient and orientation interrupts enabled and routed to the same INT1 pin. Are you reading first the INT_SOURCE register to distinguish between the transient and orientation interrupt and then only an appropriate event source register (either PL_STATUS or TRANSIENT_SRC) as illustrated below?

IntSource = I2C_ReadRegister(MMA845x_I2C_ADDRESS, INT_SOURCE_REG);

                    

if (IntSource & 0x20)      // Transient interrupt?

{

TransientSource = I2C_ReadRegister(MMA865x_I2C_ADDRESS, TRANSIENT_SRC_REG);     // Service and clear the transient interrupt 

}

if (IntSource & 0x10)      // Orientation interrupt?

{

PLStatus = I2C_ReadRegister(MMA865x_I2C_ADDRESS, PL_STATUS_SRC);      // Service and clear the orientation interrupt 

}

Regards,

Tomas

PS: If my answer helps to solve your question, please mark it as "Correct" or “Helpful”. Thank you.

View solution in original post

0 Kudos
2 Replies
1,062 Views
TomasVaverka
NXP TechSupport
NXP TechSupport

Hi Harold,

It looks like you have both transient and orientation interrupts enabled and routed to the same INT1 pin. Are you reading first the INT_SOURCE register to distinguish between the transient and orientation interrupt and then only an appropriate event source register (either PL_STATUS or TRANSIENT_SRC) as illustrated below?

IntSource = I2C_ReadRegister(MMA845x_I2C_ADDRESS, INT_SOURCE_REG);

                    

if (IntSource & 0x20)      // Transient interrupt?

{

TransientSource = I2C_ReadRegister(MMA865x_I2C_ADDRESS, TRANSIENT_SRC_REG);     // Service and clear the transient interrupt 

}

if (IntSource & 0x10)      // Orientation interrupt?

{

PLStatus = I2C_ReadRegister(MMA865x_I2C_ADDRESS, PL_STATUS_SRC);      // Service and clear the orientation interrupt 

}

Regards,

Tomas

PS: If my answer helps to solve your question, please mark it as "Correct" or “Helpful”. Thank you.

0 Kudos
1,061 Views
haroldmccabe
Contributor I

Yes, both transient and orientation interrupts were enabled and going to the same pin.

I found the ELE bit in the transient config reg must be set to latch the transient axis/polarity info into the transient source reg. Otherwise the axis/polarity info may change between when the transient interrupt is asserted and when the transient source reg is read.

Earlier, I was not actually getting continual interrupts with ELE set: I was mislead by my debug setup.

Thank you, Tomas.

0 Kudos