[freertos - Open Discussion and Support] ARM7 uIP Demo interrupts

2 views
Skip to first unread message

SourceForge.net

unread,
Nov 9, 2011, 8:15:04 AM11/9/11
to SourceForge.net

Read and respond to this message at:
https://sourceforge.net/projects/freertos/forums/forum/382005/topic/4802039
By: brakova

Hi,
I'm working on the ARM7 uIP demo for IAR (uIP_Demo_IAR_ARM7) that's provided
with the source. I know that this may be an easy question but I have lost too
much time trying to do it on my own. I want to be able to handle PIO button
interrupts.
I have a netduino plus board (with at91sam7x512) which has an onaboard button
(PA29) and I want to initialise and handle the interrupt so that when you press
the button the onboard LED (PB23) will turn ON.
I want to achieve this using the provided FreeRTOS at91sam7x256 port. I already
have it working with the demos which come from the atmel site but they use a
very different port which fails to work together with the FreeRTOS. I want to
use the FreeRTOS port because the main goal of the application will be far different
from turning LEDs on and off.

I have the FreeRTOS practical guide and I know that there is a whole chapter
about interrupts but I didn't find out how can you handle a button press
interrupt.

Thanks!

_____________________________________________________________________________________
You are receiving this email because you elected to monitor this topic or entire forum.
To stop monitoring this topic visit:
https://sourceforge.net/projects/freertos/forums/forum/382005/topic/4802039/unmonitor
To stop monitoring this forum visit:
https://sourceforge.net/projects/freertos/forums/forum/382005/unmonitor

SourceForge.net

unread,
Nov 9, 2011, 8:50:45 AM11/9/11
to SourceForge.net

Here is my code:
First in board.h I have defined that LED1 is (1 << 23) and SW1 is (1 << 29).
I have the following interrupt handler, which will turn the onboard LED ON:

[code]
void Handler(void)
{
if( AT91F_PIO_GetInput( AT91C_BASE_PIOA ) & LED1 )
{
AT91F_PIO_ClearOutput( AT91C_BASE_PIOA, LED1 );
}
else
{
AT91F_PIO_SetOutput( AT91C_BASE_PIOA, LED1 );
}
}
[/code]

And in the prvSetupHardware function I have added the following:
[code]
AT91F_PMC_EnablePeriphClock( AT91C_BASE_PMC, 1 << AT91C_ID_PIOA );
AT91F_PMC_EnablePeriphClock( AT91C_BASE_PMC, 1 << AT91C_ID_PIOB ) ;
AT91F_PMC_EnablePeriphClock( AT91C_BASE_PMC, 1 << AT91C_ID_EMAC ) ;

AT91F_PIO_CfgInput( AT91C_BASE_PIOA, SW1 );
AT91F_PIO_CfgPullup( AT91C_BASE_PIOA, SW1 );
AT91F_PIO_CfgInputFilter( AT91C_BASE_PIOA, SW1 );

AT91F_AIC_ConfigureIt(AT91C_BASE_PIOA, AT91C_ID_PIOA, 0x07, 0x0,
Handler);
AT91F_AIC_EnableIt(AT91C_BASE_PIOA, AT91C_ID_PIOA);
[/code]

And here I am confused about am I initializing the interrupt properly? As long
as the button belongs to PA29 I know that I have to use the AT91C_BASE_PIOA
when I make the call to AT91F_AIC_ConfigureIt. And here I am not sure about
the irq_id parameter. Should it be 29 (as I am using PA29) or should it
be AT91C_ID_PIOA? And if its AT91C_ID_PIOA where should I specify that I want
to handle intterupts coming from PA29?

Thanks :)

SourceForge.net

unread,
Nov 9, 2011, 2:50:45 PM11/9/11
to SourceForge.net
By: edwards3

If you want help configuring the SAM7 hardware, I recommend asking your question
on the SAM7 forum, or asking Atmel support. This is a FreeRTOS forum, and I
cannot see how your question relates to FreeRTOS, so you are unlikely to have
success asking here.

SourceForge.net

unread,
Nov 9, 2011, 3:12:51 PM11/9/11
to SourceForge.net
By: brakova

Well the thing is that I have all this already working using the port which
Atmel have provided in their getting started tutorials. The problems comes when
I want to use FreeRTOS with the port they have provided.

SourceForge.net

unread,
Nov 15, 2011, 2:29:30 AM11/15/11
to SourceForge.net

Hi, sorry about the trouble...
The problem was very strange for me. I would be very happy if someone with more
experience in FreeRTOS could explain it.

So the problem was in the way I am configuring the interrupt - exactly when
I make the call:
[code]

AT91F_AIC_ConfigureIt(AT91C_BASE_PIOA, AT91C_ID_PIOA, 0x07, 0x0, Handler);

[/code]

If I chnage this to
[code]
AT91F_AIC_ConfigureIt(AT91C_BASE_AIC, AT91C_ID_PIOA, driverINTERRUPT_LEVEL,
AT91C_AIC_SRCTYPE_EXT_LOW_LEVEL, Handler);
[/code]

I have no idea why it didn't work when I activated the interrupt on the
AT91C_BASE_PIOA.
Could someone explain what thoes the AT91C_AIC_SRCTYPE_EXT_LOW_LEVEL value
mean?

Thanks a lot!

SourceForge.net

unread,
Nov 15, 2011, 4:06:04 AM11/15/11
to SourceForge.net
By: richardbarry

Happy to hear you have it working.

[quote]Could someone explain what thoes the AT91C_AIC_SRCTYPE_EXT_LOW_LEVEL
value mean?[/quote]

It is a long time since I have used that library, but from my recollection it
is explained in the library comments, and in the documentation, so with respect,
you can read it yourself. It is definitely not a FreeRTOS related question.

Regards.

SourceForge.net

unread,
Nov 15, 2011, 4:35:24 AM11/15/11
to SourceForge.net
By: brakova

OK, sorry about that... :) it looked so confising the first time, but now I
fonund some documentation from Atmel that will help.

Best Regards

Reply all
Reply to author
Forward
0 new messages