Systick Interrupt not fireing.

Discussion around product based on ARM Cortex M4 core.

Moderators: nferre, ncollot

dombrowski@advantor.com
Posts: 4
Joined: Fri Jan 30, 2015 11:58 pm

Systick Interrupt not fireing.

Sat Jan 31, 2015 12:04 am

I can't seam to get a simple systick to fire an interrupt every 1ms. Below is my code. I'm sure I'm missing something simple but I've found the atmel examples to be lacking a lot of information to make them useable. Thanks in advance for any help. if i put a break point in my g_ul_tick_count never increments.

Code: Select all

#include <asf.h>

volatile uint32_t g_ul_tick_count;

static void wait(volatile uint32_t ul_ms)
{
	uint32_t ul_start;
	uint32_t ul_current;

	ul_start = g_ul_tick_count;
	do {
		ul_current = g_ul_tick_count;
	} while (ul_current - ul_start < ul_ms);
}

void SysTick_Handler(void)
{
	g_ul_tick_count++;
}

int main (void)
{
	sysclk_init();
	board_init();
	
	if (SysTick_Config(sysclk_get_cpu_hz() / 1000)) {
		while (1) 
		{
		}
	}
	
	while(1)
	{
		ioport_set_pin_level(STATUS_LED_GPIO, LED_INACTIVE);	//turn off the LED
		wait(500);
		ioport_set_pin_level(STATUS_LED_GPIO, LED_ACTIVE);
	}
}
dombrowski@advantor.com
Posts: 4
Joined: Fri Jan 30, 2015 11:58 pm

Re: Systick Interrupt not fireing.

Mon Feb 02, 2015 9:18 pm

Solved the issue. Turns out there is a problem with my ATMEL-ICE. I ran it it debug mode with a borrowed SAM-ICE/Olimex 10pin JTAG adapter and everything worked great. Now i need to try to get my ATMEL-ICE replaced.

Return to “SAM4 Cortex-M4 MCU”

Who is online

Users browsing this forum: No registered users and 3 guests