[TriEmbed] ATSAMD21G18 or Arduino Zero interrupts

Scott Hall scottghall1 at gmail.com
Thu Nov 9 07:35:41 CST 2017


I just got through reading an article on the Feather M0 (I just bought 3 of them
for experimenting on) and indeed you are only going to get 1 interrupt to work
with the default setup in some cases.

Even using the TimerOne library, both the author and the others on the forums
state that it could be incompatible with SAMD architecture.

The issue is that some interrupts are shared between pins.  If you go look at
the pinout page for the M0 on Adafruit's site, the image which shows the layout
and pin information included info on the interrupts:
https://learn.adafruit.com/adafruit-feather-m0-basic-proto/pinouts  The
following pins share external interrupts in the zero variant:

  * |EXTERNAL_INT_2|: A0, A5, 10
  * |EXTERNAL_INT_4|: A3, 6
  * |EXTERNAL_INT_5|: A4, 7
  * |EXTERNAL_INT_6|: 8, SDA
  * |EXTERNAL_INT_7|: 9, SCL
  * |EXTERNAL_INT_9|: A2, 3
  * |EXTERNAL_INT_10|: TX, MOSI
  * |EXTERNAL_INT_11|: RX, SCK


Check out section 20 "EIC - External Interrupt Controller" of the datasheet:
https://cdn-learn.adafruit.com/assets/assets/000/030/130/original/atmel-42181-sam-d21_datasheet.pdf?1453847579
for the low-level setup and using the external interrupts.

One poster complained "the code that Adafruit provides for their Feather M0 is
clearly not properly setting the processor up for interrupts".

I hope some of this helps.

- sgh

On 11/07/2017 08:15 AM, Alex Davis via TriEmbed wrote:
> Anyone use the ATSAMD21G18 M0 aka Arduino Zero or Adafruit Feather M0? I’m
> having issues with getting more than one interrupt attached using the Arduino
> IDE.
>
> Basically, I need the thing to sleep and be woken up by either having my
> LIS3DH accelerometer raise a pin (based on a threshold) or by the user
> pressing a button. I can get one or the other working but not both. If I try
> to attach a second interrupt, even after having detached the first, I get a
> hard crash.
>
> The Adafruit forums haven’t been any help. Most likely this is going to
> require actual setting of registers by hand, but does anyone have any M0
> interrupt experience?
>
> By the way, I did consider using something like a 32u4 (which I know would
> work regarding interrupts), but the issue is in the feather form factor, it
> doesn’t have interrupt capable pins assigned to the buttons on the Feather
> OLED/button shield I’d like to use. Also, 32u4 lacks an integral RTC, and I
> don’t want to stack another shield as that would make it un-wearable.
>
> Maybe I need to get an actual Arduino Zero with a JTAG header and buy
> something like a Segger J-Link.

-- 
Scott G. Hall
Raleigh, NC, USA
ScottGHall1 at GMail.Com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.triembed.org/pipermail/triembed_triembed.org/attachments/20171109/5d24290e/attachment.htm>


More information about the TriEmbed mailing list