Wakeup of ATSAMD21

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

Hi

I have some problems to wakeup my ATSAMD21 xplained board. 

Have chosen the sw0 / PA15 as interrupt (both edges) and wakeup. 

Interrupt is working. Board is going to sleep (4uA), but can't wake up..... 

#include <atmel_start.h>
struct io_descriptor *io;
static void button_on_PA15_pressed(void) {io_write(io,"interrupt...\n\r", 14);}
static void tx_cb_USART_0(const struct usart_async_descriptor *const io_descr){}
static void rx_cb(const struct usart_async_descriptor *const io_descr){}
static void err_cb(const struct usart_async_descriptor *const io_descr){}
int main(void)
{	atmel_start_init();
	ext_irq_register(PIN_PA15, button_on_PA15_pressed);
	usart_async_register_callback(&USART_0, USART_ASYNC_TXC_CB, tx_cb_USART_0);
	usart_async_register_callback(&USART_0, USART_ASYNC_RXC_CB, rx_cb);
	usart_async_register_callback(&USART_0, USART_ASYNC_ERROR_CB, err_cb);
	usart_async_get_io_descriptor(&USART_0, &io);
	usart_async_enable(&USART_0);
	io_write(io,"demo start..\n\r", 14);
	while (1) {	delay_ms(1000);
		        io_write(io,"goto sleep 2\n\r", 14);
				delay_ms(1000);
				io_write(io,"goto sleep 1\n\r", 14);
				delay_ms(1000);
				sleep(3);
				io_write(io,"from sleep 0\n\r", 14);	}	
}

project is attached... br joachim

 

 

 

Attachment(s): 

This topic has a solution.
Last Edited: Tue. Jan 28, 2020 - 07:05 PM
This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The "both edges" is a problem, you need EIC to work asynchronously:

When an external interrupt is configured for level detection and when filtering is disabled, detection is done asynchronously.

/Lars 

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

Hi Lars

Thanks a lot... problem is solved. br Joachim 

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

Hi Now I have a new problem... how to do the edge detection. interrupt is permanently firing. how to do the edge detection in software?

br Joachim