Main Site Documentation

Interrupt.install


#1

About the FEZ domino

Can I use the interrupt.install of RLPExtension to install an interrupt service routine for timer0?

What should be the peripheral id (according to user manual lpc23xx = 0x10?)
Can I configure the timer with the register available?


#2

You can but not for timer0 as we use this already. There are many other timers you can use

But why do you need this? Have you looked at “tasks” in RLP?


#3

Thanks for the reply. We want to use a timer to switch a GPIO pin in an ISR. We checked tasks, but they are to slow.

We use the code below, We can see timer 1 is running on output port 7, but we do not see any interrupts are handled (no toggling on port 4). Is there something wrong?

btw. LPC23xx.h define all registers

#include “LPC23xx.h”
#include “RLP.h”

int toggle = 0, toggle1 = 0;

void Timer1Callback(void * arg)
{
T0IR = 1;
if(toggle)
FIO0SET = 1;
else
FIO0CLR = 1;

toggle = !toggle;
VICVectAddr = 0;

}

int startTimer(unsigned int *generalArray, void **args, unsigned int argsCount, unsigned int *argSize)
{
// configure fast IO port 1
FIO0DIR = 3; // set as output
FIO0CLR = 2;

// configure VIC
VICIntEnClr = 0x20; 							// clear
VICSoftIntClr = 0x20;						
RLPext->Interrupt.Install(0x20, Timer1Callback, 0);
RLPext->Interrupt.GlobalInterruptEnable();
RLPext->Interrupt.Enable(0x20);
VICIntEnable = 0x20;							// enable

// configure timer1
T1TCR = 0x00;   // stop timer
T1PR  = 0x00;	// set prescaler to zero
T1MR0 = 0xFFFF;	// set match value of timer0
T1IR  = 0x01;	// reset all interrrupts of timer0
T1MCR = 0x03;	// reset timer0 and interrupt on match
T1TCR = 0x02;	// reset timer0
T1TCR = 0x01;	// start timer0

while(1)
{
	if (T1TC % 100 == 0)
	{
		if(!toggle1)
		FIO0SET = 2;
		else
			FIO0CLR = 2;
		toggle1 = !toggle1;
	}
}

return 0;

}


#4

This shuldn’t be in your code

VICVectAddr = 0;

Why are you saying tasks are too slow? How fast are you going to change the pin? A task can run in kernel mode and so is very accurate.


#5

I meassure the jitter of using Task and it was the minimun posible for 72Mhz clock, it was about 20ns so its very accurate.


#6

Thanks Pablo


#7

We removed it, but no effect.

Well, we will consider to use the task. But actually this is only a test, because we want to install a isr for a SPI interface. So, we really want this to work.


#8

We used the sample code for tasks and set the time offset to 1us. However, the maximum toggle time is 50us even in kernel mode.


#9

You will never get 1uS, even if you install an interrupt handler it will be very tricky to get right. There is a hole system running on the processor and plenty of interrupts already firing. This is why I am asking as what you are trying to do maybe beyond the processor’s capability.

But you are saying you need this for SPI! Can you please provide more details on what you are trying to accomplish then I can give you better directions


#10

Where is the documentation regarding “Tasks” I cant seem to locate it!

Cheers Ian


#11

It is part of the RLP extensions


#12

? Not here
http://www.ghielectronics.com/downloads/NETMF/Library%20Documentation/Index.html

Cheers Ian


#13

That really does not make sense. The FEZ is ‘always’ the master so no data will be flowing unless you initiate it. There is really no reason to use an interrupt, especially one with very tight timing requirements.


#14

[quote]? Not here
http://www.ghielectronics.com/downloads/NETMF/Library%20Documentation/Index.html

Cheers Ian
[/quote]

Here it is

[quote]Native RLP Extensions
RLP provides native code ability. The extensions provide addition…[/quote]

Then under you see

[quote]
Task.Initialize

Initializes a task structure. The task will run when Schedule/ScheduleTimeOffset is called. When a task is executing, it blocks all other managed/native threads/tasks. The user must return from the task in order for the managed threads to run again.
task: User’s task.
taskCallback: Callback when the task runs.
arg: This is passed to the callback function.
isKernelMode: True or False value. Always try to use False (non kernel mode). In this mode, the task executes when appropriate among other managed threads without interrupting them. True (kernel mode) executes the task at a specific time. It interrupts everything else and stops the hardware interrupts while executing.[/quote]


#15

Cheers Gus… I thought there would be a dedicated page… I didn’t realise you had to scroll down more than half way…

Ian


#16

Tasks are really great and they deserve a whole tutorial or blog about them which we will do but in docs we try to keep it simple and to the point


#17

We are creating a 3D LEDcube. We want to use the SPI for a 8 channel RGB LEDdriver for clocking in grayscale values. After that a shift register should be shifted once and both The driver and shift register should be latched to put it on the store register.

So, as I understand it correctly, we better not use an interrupt with the SPI . Instead, I guess that we just have to wait for the finish flag of the SPI and then put the latch signal.

We tested this scenario and it just works fine. As suggested we now use a task to update the LEDs at a speed of 60HZ. So far we can see now, th update takes just a little amount of available time

Unfortuately, we did not manage to get the interrupt working, but we wouldn’t use it anyways.

Thank you very much for your responses.

if someone is interested in our c-code, I will provide it.


#18

We always appropriated another RLP driver example :slight_smile: