MMA8652FC & Transients

取消
显示结果 
搜索替代 
您的意思是: 
已解决

MMA8652FC & Transients

跳至解决方案
708 次查看
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

标签 (1)
0 项奖励
1 解答
415 次查看
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 项奖励
2 回复数
416 次查看
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 项奖励
415 次查看
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 项奖励