Razor IMU - Using extInterrupt for Int Pin of MPU

Hi,

i purchased the 9DoF Razor IMU M0 and working on low Power consumption Projekt.

The code that needs the Processor to wake up on an interrupt from the IMU chip (MPU9250)

The INT pin is routed to the Processor pin D4 witch is not an external interrupt Pin but a NMI pin.

That means this is not a Pin that can be used as an Interrupt Pin for the Arduino function “attachInterrupt()”

Is there a deeper meaning why this Pin not routed to an easily usable Interrupt pin but to this special NMI pin?

if yes how do i program the Processor to wake up on a falling edge on this pin D4?

As put the Processor to Sleep i can not poll the pin like in the provided example code.

EDIT:

On the Arduino Reference Page, it even says that the pin 4 is literally the only pin that can not be used as an interrupt Pin

Zero → all digital pins, except 4

(Arduino Zero has the same Processor as the Razor)

https://www.arduino.cc/reference/en/lan … interrupt/

It looks like the Razor M0 has a different pin mapping than the Zero does meaning the “Arduino” pin names like “D0” or “D4” go to different physical pins on the actual SAMD21 chip. Pin mapping is done in software so you don’t have to worry about where D0 or D4 actually connect, the IDE takes care of remapping that all for you at compile time. This re-routes the Arduino pin names to the appropriate physical pin on the SAMD21.

The Zero has Arduino pin D4 on SAMD21 physical pin 23 where the Razor M0 has the interrupt pin connected to SAMD21 physical pin 13. It appears the pin that’s not capable of being used as an interrupt on the Razor M0 is tied to the CS line on the SD card. That particular pin wouldn’t need interrupt capability. I think you’re going to be OK in this case since on the Razor M0, D4 is actually connected to a interrupt capable physical pin on the SAMD21.

Hi Chris,

Thanks for the fast response.

In the Razor Schematics (https://cdn.sparkfun.com/assets/learn_t … ematic.pdf) is says that the D4/INT line is connected to the chips Pin 13 → PA08 (I2C/AIN16/SER0:0+). Looking into the Atmel Docu for the SAMD21 http://ww1.microchip.com/downloads/en/D … 01882D.pdf it says on Page 28 that the PA08 Pin is the NMI Pin and is not an external interrupt pin. The pin number 13 is also matching with the column SAMD21G wich is in my understanding the chip in use.

If that Pin is none the less capable of external interrupt over the Arduino Framework I don’t know how.

The following Programm executes fine and triggers the interrupt routine (that here switches the build-in led)

#define PIN_INT 10

void setup()

{

pinMode(LED_BUILTIN, OUTPUT);

pinMode(PIN_INT, INPUT_PULLUP);

attachInterrupt(PIN_INT, blink, FALLING);

}

void loop()

{

}

void blink()

{

digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));

}

I have also a program that sets up the MPU9250 in a way that the int line goes LOW if for example a certain threshold in g is exceded. If I poll the pin 4 I get falling edges without a problem.

If a attach an interrupt routine to this pin in the same way as I did in the code example above, the interrupt routine is not called.

MPU9250_Basic_ExtInterrupt.zip (2.09 KB)I have compiled a simple example showing the problem.

It builds upon the Example Code provided with the MPU Library from Sparkfun.

The unchanged Example Code uses polling to read the Interrupt Pin triggering Data Readout upon the interrupt pin 4 switching to LOW (or more exact just upon the pin value beeing LOW)

I added a define that makes it possible to exchange the minimal amount of code to perform the Falling edge detection over the externalInterrupt Feature.

The Code as I provided works fine in polling mode but does not work with the external interrupt.

I really love the Razor product and i think it’s not only for me but for other people important to clear up how the D4/INT can be used to call an interrupt routine as that would be the best practise of use for this IMU feature.

This Threat might have gotten a bit lost over the New Years’ break.

I still have not solved this and i think this is a not so unimportant problem.

If it is indeed impossible I would like to have that confirmed.

It just bugs me that this is unresolved ^^

Greetings,

Jan

Hi Jan.

Unfortunately I don’t have any updates for you on this, but I started thinking that it’s possible that the MPU-9250 might need interrupts enabled before those started working. I came across [this thread that might be helpful to you.](interrupt pin not working? · Issue #57 · kriswiner/MPU9250 · GitHub)