atsame70q21 io use has external interrupt source

Go To Last Post
3 posts / 0 new
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Does anyone have experience setting up an io pin has the source for an external interrupt,
or know of a application note or sample project that has details about how this is done?


I'm new to ARM and the API's which were generated with atmel start are hard for me to follow
as I'm used to operating on registers directly, as opposed to accessing through API.


From application note AT12784 the following steps are copied for reference:

Configuring an interrupt source requires six steps:
1. Implement interrupt handler if necessary:
The first step is to re-implement the interrupt handler with the same name as the default interrupt
handler in the vector table as just mentioned if necessary, so that when the corresponding interrupt
occurs, the reimplemented interrupt handler will be executed instead of the default interrupt
2. Disable the interrupt in case it was enabled
An interrupt triggering before its initialization completion may result in unpredictable behavior of the
system. To disable the interrupt, the Interrupt Clear-Enable Register (ICER) of the NVIC must be
written with the interrupt source ID to mask it. The following interface can be used directly:
static inline void NVIC_DisableIRQ(IRQn_Type IRQn);
3. Clear any pending interrupt, if any
Setting the Interrupt Clear-Pending Register bit puts the corresponding pending interrupt in the
inactive state. It is also written with the interrupt source ID to mask it. The following interface can be
used directly:
static inline void NVIC_ClearPendingIRQ(IRQn_Type IRQn);
4. Configure the interrupt priority
NVIC interrupts are prioritized by updating an 8-bit field within a 32-bit register (each register
supporting four interrupts). Priorities are maintained according to the ARMv7-M prioritization
scheme. The following interface can be used directly:
static inline void NVIC_SetPriority(IRQn_Type IRQn,uint32_t priority);
5. Enable the interrupt at peripheral level
6. Enable the interrupt at NVIC level
The interrupt source can be enabled, both on the peripheral (in a mode register usually) and in the
Interrupt Set-Enable Register (ISER) of the NVIC. On the side of NVIC, the following interface can
be called directly:
static inline void NVIC_EnableIRQ(IRQn_Type IRQn);
Refer to core_cm7.h for more interfaces about NVIC which can be used directly.

Atmel AT12874: Getting Started with SAM S70/E70 [APPLICATION NOTE]
Atmel-42532A-Getting-Started-with-SAM-S70-E70_AT12874_Application Note-09/2015


Some questions I have are:

step 1, How do I re-implement the interrupt handler for PIOA? The default handler is "Dummy_Handler".
Would I just create a new handler function for PIOA and replace that function into the Dummy_Handler
void PIOA_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler")));

also the interrupt handler is only mapped to PIOA_Handler at irq10. How would I assign this to a single port pin?

Any help here would be greatly appreciated.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ASF Getting-Started Application - SAME70 XPLD is an example using external interrupts, uses callback and answers most of your questions.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks, this looks like it will help.


- 11/13/17 update.  With the help of ASF example project listed above I was able to understand, and use IO has external interrupt source. What I had to do though was to revert my project back to an ASF supported project format from the newer Atmel Start supported project. If possible I would like to convert forward, back into Atmel Start.


Any info on using the newer Atmel Start hpl_pio_ext.c library?   


- 11/14/17 update. For using the newer, "ASF4" or Atmel Start google the for following user guide:   © 2017 Microchip Technology Inc. Draft User Guide DS50002633A-page 1

That explained how to use Start and configure the software components, IO modules, and System clock configuration.


Last Edited: Wed. Nov 15, 2017 - 04:57 AM