Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training




Loading

ARM7 uIP Demo interrupts

Posted by Bobi on November 9, 2011
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!

RE: ARM7 uIP Demo interrupts

Posted by Bobi on November 9, 2011
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:


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 );
}
}


And in the prvSetupHardware function I have added the following:

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);


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 :)

RE: ARM7 uIP Demo interrupts

Posted by MEdwards on November 9, 2011
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.

RE: ARM7 uIP Demo interrupts

Posted by Bobi on November 9, 2011
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.


RE: ARM7 uIP Demo interrupts

Posted by Bobi on November 15, 2011
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:

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


If I chnage this to

AT91F_AIC_ConfigureIt(AT91C_BASE_AIC, AT91C_ID_PIOA, driverINTERRUPT_LEVEL, AT91C_AIC_SRCTYPE_EXT_LOW_LEVEL, Handler);


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!

RE: ARM7 uIP Demo interrupts

Posted by Richard on November 15, 2011
Happy to hear you have it working.

“Could someone explain what thoes the AT91C_AIC_SRCTYPE_EXT_LOW_LEVEL value mean?”


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.

RE: ARM7 uIP Demo interrupts

Posted by Bobi on November 15, 2011
OK, sorry about that... :) it looked so confising the first time, but now I fonund some documentation from Atmel that will help.

Best Regards


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.


Free TCP/IP and file system demos for the RTOS


Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists