连续读取x轴与Z轴导致FXTH870911芯片受损

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

连续读取x轴与Z轴导致FXTH870911芯片受损

1,653 Views
admin10
Contributor II

 问题描述:我每秒唤醒一次读取传感器XZ两轴数据,数据正确(改变倾斜角度值有变化),但唤醒后连续读取两次时数据一直为0x1FE或0,随后 我改回唤醒后只读取一次,发现只读一次也不能读取正确数据,怀疑是;连续读取导致芯片受损,希望高手解答。

如下方代码,我对XZ轴的数据连续获取两次,读出的数据不正确

SetSTOPMode(STOP4);
u8StatusAcq|=TPMS_READ_ACCEL_X(gu16UUMA, 1u, CLEAR, 7u);
u8StatusAcq|=TPMS_COMP_ACCEL_X((UINT16*)&u16CompAccelX, gu16UUMA);
u8StatusAcq |= TPMS_READ_ACCEL_Z(gu16UUMA, 1u, CLEAR, 6);
u8StatusAcq |= TPMS_COMP_ACCEL_Z((UINT16*)&u16CompAccelZ, gu16UUMA);
u8StatusAcq|=TPMS_READ_ACCEL_X(gu16UUMA, 1u, CLEAR, 7u);
u8StatusAcq|=TPMS_COMP_ACCEL_X((UINT16*)&u16CompAccelX, gu16UUMA);
u8StatusAcq |= TPMS_READ_ACCEL_Z(gu16UUMA, 1u, CLEAR, 6);
u8StatusAcq |= TPMS_COMP_ACCEL_Z((UINT16*)&u16CompAccelZ, gu16UUMA);

经过检测发现,是编译器优化了代码导致读取出错,加上 volatile 关键字后读取正常

Tags (2)
0 Kudos
Reply
2 Replies

1,499 Views
TomasVaverka
NXP TechSupport
NXP TechSupport

Hi,

 

Can you please translate your question to English? 

Thanks!

 

Best regards,

Tomas

0 Kudos
Reply

1,499 Views
admin10
Contributor II

Thanks, I have solved this problem.

0 Kudos
Reply