[KL46Z] Magnetometer MAG3110 interrupt

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

[KL46Z] Magnetometer MAG3110 interrupt

966件の閲覧回数
rafcio100
Contributor I

I have a problem with configuring MAG3110  interrupts. The PTD1 pin is always HIGH.

#include "mbed.h"
#include "MAG3110.h"
MAG3110 mag(PTE25, PTE24);
Serial pc(USBTX, USBRX);
MotionSensorDataCounts mag_raw;
InterruptIn mag_interrupt(PTD1);

void flip() {
    mag.getAxis(mag_raw);
    float x;
    x = ((float) mag_raw.x) / 10.0f;
    pc.printf("Mag x=%4.1f\r\n", x);
    wait(1.0);
}

int main(void){
    pc.baud(9600);
    mag.enable();
    mag_interrupt.rise(&flip);
    while(1) {
      sleep();
    }
}
0 件の賞賛
返信
2 返答(返信)

865件の閲覧回数
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Rafal Jablonski,

   About the MAG3110 interrupt usage, you need to follow these step:

pastedImage_1.png

   Please check it on your side, do you finish these step?

If you still have question after the test, please tell me the updated information.

 

Wish it helps you!

Have a great day,
Kerry

 

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛
返信

865件の閲覧回数
rafcio100
Contributor I

Hi Kerry Zhou,

I was finished this steps before I wrote that post, but it doesn't work. Pin INT is always HIGH, even when I read 0x01 OUT_X_MSB register.

0 件の賞賛
返信