MMA8451Q Data access using interrupt

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

MMA8451Q Data access using interrupt

ソリューションへジャンプ
2,297件の閲覧回数
anhnguyen
Contributor I

Hi all, i'm using MMA8451Q.
I'm accessing  data via hardware interrupt.
After i activate MMA8451Q , it asserts SRC_DRDY interrupt bit  indicating the presence of new data and/or data overrun.

I have tried to clear this bit by reading the X, Y, and Z data as datasheet said (page 25).

But this bit has not been cleared.

Any body, please tell me what is wrong here and what should i do?

Thanks,

タグ(1)
0 件の賞賛
返信
1 解決策
1,536件の閲覧回数
TomasVaverka
NXP TechSupport
NXP TechSupport

Hi,


Please make sure you read out all the OUT_X_MSB, OUT_Y_MSB and OUT_Z_MSB registers. You can use either a single multiple-byte read operation or read out those registers using a single byte read as shown in the below simple examples.

1.

Data_Ready = IIC_RegRead(MMA8451_IIC_ADDRESS, INT_SOURCE_REG);  

if (Data_Ready & 0x01)                                                                                            //Is new set of data ready?

      {

        IIC_RegReadN(MMA8451_IIC_ADDRESS, OUT_X_MSB_REG, 6, &AccData[0]);

        PTCD = PTCD ^ 0x01;   

      }

2.

Data_Ready = IIC_RegRead(MMA8451_IIC_ADDRESS, INT_SOURCE_REG);  

if (Data_Ready & 0x01)                                                                                            //Is new set of data ready?

      {

        IIC_RegRead(MMA8451_IIC_ADDRESS, OUT_X_MSB_REG );

        IIC_RegRead(MMA8451_IIC_ADDRESS, OUT_Y_MSB_REG );

        IIC_RegRead(MMA8451_IIC_ADDRESS, OUT_Z_MSB_REG );

        PTCD = PTCD ^ 0x01;

      }

I toggled the PTC0 pin to monitor the SRC_DRDY bit on my o-scope.

Hopefully this makes sense, but let me know if the problem continues.


Regards,

Tomas

元の投稿で解決策を見る

0 件の賞賛
返信
3 返答(返信)
1,537件の閲覧回数
TomasVaverka
NXP TechSupport
NXP TechSupport

Hi,


Please make sure you read out all the OUT_X_MSB, OUT_Y_MSB and OUT_Z_MSB registers. You can use either a single multiple-byte read operation or read out those registers using a single byte read as shown in the below simple examples.

1.

Data_Ready = IIC_RegRead(MMA8451_IIC_ADDRESS, INT_SOURCE_REG);  

if (Data_Ready & 0x01)                                                                                            //Is new set of data ready?

      {

        IIC_RegReadN(MMA8451_IIC_ADDRESS, OUT_X_MSB_REG, 6, &AccData[0]);

        PTCD = PTCD ^ 0x01;   

      }

2.

Data_Ready = IIC_RegRead(MMA8451_IIC_ADDRESS, INT_SOURCE_REG);  

if (Data_Ready & 0x01)                                                                                            //Is new set of data ready?

      {

        IIC_RegRead(MMA8451_IIC_ADDRESS, OUT_X_MSB_REG );

        IIC_RegRead(MMA8451_IIC_ADDRESS, OUT_Y_MSB_REG );

        IIC_RegRead(MMA8451_IIC_ADDRESS, OUT_Z_MSB_REG );

        PTCD = PTCD ^ 0x01;

      }

I toggled the PTC0 pin to monitor the SRC_DRDY bit on my o-scope.

Hopefully this makes sense, but let me know if the problem continues.


Regards,

Tomas

0 件の賞賛
返信
1,536件の閲覧回数
bergo
Contributor III

I'm wondering,

what is the PTC0 pin?

0 件の賞賛
返信
1,536件の閲覧回数
TomasVaverka
NXP TechSupport
NXP TechSupport

Hi Bergo,

I have used this pin just to monitor the SRC_DRDY bit, it does not have any connection with the previous instructions that are necessary to deassert the interrupt. You can ignore this line of the code - PTCD = PTCD ^ 0x01

Regards,

Tomas

0 件の賞賛
返信