how to write preemptive interrupt

Discussion around product based on ARM Cortex M3 core.

Moderators: nferre, ncollot

ahgu
Posts: 72
Joined: Tue Jun 14, 2005 7:49 am

how to write preemptive interrupt

Tue Aug 12, 2014 5:48 am

I need to implement a  high priority interrupt that can preempt low priority interrupt. 
calling IRQ_ConfigureIT with different different does not do the job. Is there an example of nested preemptive interrupt code? I guess it needs some sort of grouping to get this to work? Or is it supported in SAM3U?

thank you for your help. 
nutsnbolts
Posts: 31
Joined: Mon Aug 25, 2014 11:20 pm

Re: how to write preemptive interrupt

Tue Aug 26, 2014 2:15 am

Code: Select all

NVIC_SetPriority(PIOB_IRQn,3);
.. the lower the number, the higher the priority.  See "10.12 Nested Vectored Interrupt Controller" in "SAM3U Complete", "Interrupt Generation Using the AT91 Timer/Counter", and (not quite this straightforward, (which Atmel document is?) but some good pointers) http://asf.atmel.com/docs/latest/sam.ut ... ase_2.html
 Don't forget to:

Code: Select all

NVIC_ClearPendingIRQ(PIOB_IRQn);
	pio_enable_interrupt(PIOB,PIO_PB14);	//enable interrupt- you HAVE configured it? (levels, etc)
	NVIC_EnableIRQ(PIOB_IRQn);
Oh, and don't forget to code the ISR.. kinda fundamental... but in my excitement, I did!
Regards, Mike.

Return to “SAM3 Cortex-M3 MCU”

Who is online

Users browsing this forum: No registered users and 2 guests