need some basic help about interrupts

hello everyone I’ve read the online documentation and also browsed this forum for info about freeRTOS + interrupts but I still miss some things. I’m working with the LPC2368 at the moment. So here are my questions: - to "install" an interrupt, you register it in the VIC. Do I also have to do something for the RTOS to "know" this interrupt? - what do I have to look at when giving the ISR priorities? whats the impact for ISR’s that have higher/lower priority than the OS tick? - when I use a semaphore for synchronizing a task with an ISR (and do the actual data processing within the task. as it was suggested in the API doc), should I always call portTaskYield() or how can I ensure that the task which is related to the interrupt is being scheduled as soon as possible? or does the scheduler do that by default? would be nice if someone could help me! thanks

need some basic help about interrupts

> – to "install" an interrupt, you register it in the VIC. Do I > also have to do > something for the RTOS to "know" this interrupt? No – registering it with the VIC will cause the interrupt to fire (presuming it is configured correctly :o) – if this interrupt is not going to cause a context switch then you can just write the interrupt as per any other (refer to the compiler documentation).  If this interrupt is potentially going to cause a context switch then you have to construct the interrupt as per the documentation page for the port you are using.  Different compilers require slightly different syntax.  You will also be able to refer to the demo application for your port for an example of how to switch context from within an interrupt. > – what do I have to look at when giving the ISR priorities? > whats the impact > for ISR’s that have higher/lower priority than the OS tick? Unless you implement a nesting scheme then there the only effect the priorities have is when the kernel chooses which of a number of pending interrupts should be serviced first.  If you are implementing a nesting scheme then interrupts that use the API must run at the same priority as the kernel tick. > – when I use a semaphore for synchronizing a task with an ISR > (and do the actual > data processing within the task. as it was suggested in the > API doc), should > I always call portTaskYield() or how can I ensure that the > task which is related > to the interrupt is being scheduled as soon as possible? or > does the scheduler > do that by default? As per question one above – you can cause a context switch within an interrupt by following the example given in the demo application.  When you do this the interrupt will automatically return to the highest priority task in the system that is able to run.  The interrupt can interrupt a low priority task, then return directly to a higher priority task if one is readied from within the interrupt.  This occurs automatically when following the examples – so you don’t have to worry about anything other than the priorities you assign to your tasks. Regards.

need some basic help about interrupts

thanks already for the info! do you have any specific file/function(isr) in mind which is a good example (in the demo)? I’ll check the emac ISR and the OS timer tick ISR (if I find it…) but maybe there are some better ones?

need some basic help about interrupts

You can check the LPC2148 demo for eg. Rowley (i’m using this one) and there is a mainISR that set a semaphore when a button is presses (this button is on external interrupt). Hope this helps. Best regards, Borut

need some basic help about interrupts

I checked the various ISR examples and if I get it right I need to call "portENTER_SWITCHING_ISR()" at start and "portEXIT_SWITCHING_ISR( true/false)" at the end? for ARM7 LPC2368 with GCC that is. I made a timer1 ISR (or rather: copied it from a working non-freeRTOS project) but the system crashes. the only difference I notice is that my ISR is defined as " __attribute__ ((interrupt("IRQ"))) whereas the ISR in the freeRTOS demos are all defined as __attribute__ ((naked)). I googled those 2 attributes and if I get it right the "IRQ" tells the compiler to produce enter/exit code (i.e. save the current register content onto stack, save PC etc) whereas "naked" tells the compiler that this function doesnt have/need ANY entry stuff – since its provided from the programmer. so am I right to guess that those 2 atrributes are exactly the opposite and thas portENTER/EXIT_SWITCHING_ISR() provides the enter exit code? (sound logic :-)). so maybe with portENTER_SWITCHING_ISR() AND __attribute__"IRQ" I get a conflict and thus the system crashes?

need some basic help about interrupts

You are correct.  This is explained in the "Interrupt Service Routine" section of the page: http://www.freertos.org/portlpc2106.html Regards.

need some basic help about interrupts

I’ve never checked that site so far because I thought "it’s a wrong LPC, so it’s not usefull for me" – seems I was wrong :-)