I'm currently working on a SAME70 board made by Atmel. I plugged on it an extention OLED1 board (Atmel too) on EXT1 port. My goal is to recover the information about interrupt type (falling or raising) when I'm pressing the button 3 on OLED1 board. I have a function which allows me to set the different registers related to an interrupts. But unfortunately the register which indicates the polarity (FLHSR) stay always at 0 whatever the state of the button. Below my code.
#include <asf.h> void set_Interupt_Pin() { uint32_t mask = 1 << 19; /*bitmasking*/ PIOA->PIO_IER = mask; /*enable interruptions*/ PIOA->PIO_AIMER = mask; /*add new interruption*/ PIOA->PIO_ESR = mask; /*set interrupt source on edge*/ PIOA->PIO_REHLSR = mask; /* set interrupt to rising edge*/ PIOA->PIO_FELLSR= mask; /* set interrupt to falling edge*/ NVIC_DisableIRQ(ID_PIOA); NVIC_ClearPendingIRQ(ID_PIOA); NVIC_EnableIRQ(ID_PIOA); /*set NVIC to get interruptions from PIOA*/ NVIC_SetPriority(ID_PIOA, 4); /*priority 4*/ } void PIOA_Handler(void) { printf("FRLHSR: %x\n",PIOA->PIO_FRLHSR); /*state of polarity event */ printf("ISR: %x\n",PIOA->PIO_ISR); printf("ELSR: %x\n",PIOA->PIO_ELSR); printf("AIMMR: %x\n",PIOA->PIO_AIMMR); } int main(void) { const usart_serial_options_t usart_serial_options = { .baudrate = CONF_UART_BAUDRATE, .charlength = CONF_UART_CHAR_LENGTH, .paritytype = CONF_UART_PARITY, .stopbits = CONF_UART_STOP_BITS }; sysclk_init(); board_init(); stdio_serial_init(CONF_UART, &usart_serial_options); set_Interupt_Pin(); while(1){} }
You can see here the result of print when I press button (first part) and I release button (second part).