SAMB11 - going to sleep

AT91EB40A, EB55, EB42 Evaluation Boards , AT91RM9200-DK, RM3400-DK will be the focus of the discussions: hardware guidance, embedded software, use,...

Moderator: nferre

DK999
Posts: 1
Joined: Mon May 16, 2016 3:46 pm

SAMB11 - going to sleep

Mon May 16, 2016 3:51 pm

I can't figure out how to get into sleep-mode. The BluSmartSDK mentions an ULP-Mode and the use of acquire/release-sleep-lock and the status of an AO_GPIO-Pin, but I can't figure out how to use it. The AON Sleep Timer example isn't helpful either.

I wrote an example program but it always sends data to my uart, seemingly ignoring the WFI-command. Is there anyone who can help?

Code: Select all

#include <asf.h>
#include "console_serial.h"

static void aon_sleep_timer_callback(void)
{
	serial_write_data("Sleep Timer Overflow\n\r");
}

static void configure_aon_sleep_timer(void)
{   // Create Timer-Struct and register it in Reload-Mode with Interrupt every 10sec
	struct aon_sleep_timer_config config_aon_sleep_timer;
	aon_sleep_timer_get_config_defaults(&config_aon_sleep_timer);
	config_aon_sleep_timer.mode = AON_SLEEP_TIMER_RELOAD_MODE;
	config_aon_sleep_timer.counter = 320000;
	aon_sleep_timer_init(&config_aon_sleep_timer);

}

static void configure_aon_sleep_timer_callback(void)
{
	// Register Timer Callback
	aon_sleep_timer_register_callback(aon_sleep_timer_callback);

	//! [enable_IRQ]
	NVIC_EnableIRQ(AON_SLEEP_TIMER_IRQn);
}

int main(void)
{
    /* Initialize Serial Console and Sleep Timer */
	serial_console_init();
	configure_aon_sleep_timer();
	configure_aon_sleep_timer_callback();

	serial_write_data("Setting up Sleep Timer\n\r");
	while(!AON_SLEEP_TIMER0->CONTROL.bit.SLEEP_TIMER_ACTIVE);
	serial_write_data("DONE\n\r");

    while (1)
    {   // Wait for interrupt / Sleep
		asm volatile ("wfi");
		asm volatile ("nop");
		serial_write_data("BLA\n\r");
    }
}

Return to “Evaluation and Development Boards”

Who is online

Users browsing this forum: No registered users and 1 guest