Skip to contentSkip to conversation

freescale(imx53) with xenomai patch

Xenomai 嵌入式工程师 2 participants 16 messages May 30, 2013 – Jun 5, 2013

lore
Share & tools
lore
#0 lore raw

I set freescale board (imx53) gpio2-14 as interrupttriggerpin and the kernal with xenomai patch. When i use Interrupt handling in kernel space like Below code:

#define MYIRQ (1*32+14)

int irq=gpio_to_irq(MYIRQ);

staticintisr_code(xnintr_t *intr)

{

rt_intr_disable(&myinterrupt);

...

...
rt_intr_enable(&myinterrupt);

return RT_INTR_HANDLED;

}

.....

sampling_task1...........

sampling_task2...............

static int __init gpio_irq_init(void)
{

rt_intr_create(&myinterrupt, "myinterrupt", irq, isr_code, NULL, 0);

rt_task_create.....sampling_task1

..................sampling_task2

rt_intr_enable(&myinterrupt);

    return 0;
}

I find if the tasks i have created more and more the ISR (Interruptresponse function)will lose a lot ofresponse .

So I do notknow ifI set theinterrupt priority levelis too low,or what?

If I hadto settheinterrupt priorityreal-time kernel, thenhow can Iset up?

or gpio Interrupt number is right ?

Strong real-timesystem requirements,but I do not know why if it has lots of task it will lose real-time .

Thanks!

#1 lore raw
Quoted 1 line · 嵌入式工程师

I set freescale board (imx53) gpio2-14 as interrupttriggerpin and the kernal with xenomai patch. When i use Interrupt handling in kernel space like Below code:

What version of the I-pipe patch? What version of Xenomai?

Also, could you try sending mails following a bit the netiquette? At least with words correctly detached?

Signature · 1 line
                                                                Gilles.
#2 lore raw

The I-pipe path version is adeos-ipipe-2.6.35.9-arm-1.18-01.patch , the kernal version is 2.6.35.9 ,i am so sorry for he details do not speak clearly

Quoted 12 lines · 在 2013-05-31 02:21:12,"Gilles Chanteperdrix"…
Quoted 1 line · 嵌入式工程师

I set freescale board (imx53) gpio2-14 as interrupttriggerpin and the kernal with xenomai patch. When i use Interrupt handling in kernel space like Below code:

What version of the I-pipe patch? What version of Xenomai?

Also, could you try sending mails following a bit the netiquette? At least with words correctly detached?

Signature · 1 line
                                                               Gilles.
#3 lore raw

The I-pipe path version is adeos-ipipe-2.6.35.9-arm-1.18-01.patch , the kernal version is 2.6.35.9 ,i am so sorry for he details do not speak clearly

Quoted 15 lines · At 2013-05-31 09:34:39,"嵌入式工程师" <[email protected]> wrote:

The I-pipe path version is adeos-ipipe-2.6.35.9-arm-1.18-01.patch , the kernal version is 2.6.35.9 ,i am so sorry for he details do not speak clearly

Quoted 12 lines · 在 2013-05-31 02:21:12,"Gilles Chanteperdrix"…
Quoted 1 line · 嵌入式工程师

I set freescale board (imx53) gpio2-14 as interrupttriggerpin and the kernal with xenomai patch. When i use Interrupt handling in kernel space like Below code:

What version of the I-pipe patch? What version of Xenomai?

Also, could you try sending mails following a bit the netiquette? At least with words correctly detached?

Signature · 1 line
                                                               Gilles.
#4 lore raw
Quoted 2 lines · 嵌入式工程师

The I-pipe path version is adeos-ipipe-2.6.35.9-arm-1.18-01.patch , the kernal version is 2.6.35.9 ,i am so sorry for he details do not speak clearly

Hi,

there is no need to send your answer three times either. GPIO irqs are broken with this version of the I-pipe kernel. Please try updating to the I-pipe core patch for Linux 3.4 or 3.5.

Regards.

Signature · 1 line
                                                                Gilles.
#5 lore raw

ok ,thanks,i have a try

Quoted 16 lines · 在 2013-05-31 13:32:14,"Gilles Chanteperdrix"…
Quoted 2 lines · 嵌入式工程师

The I-pipe path version is adeos-ipipe-2.6.35.9-arm-1.18-01.patch , the kernal version is 2.6.35.9 ,i am so sorry for he details do not speak clearly

Hi,

there is no need to send your answer three times either. GPIO irqs are broken with this version of the I-pipe kernel. Please try updating to the I-pipe core patch for Linux 3.4 or 3.5.

Regards.

Signature · 1 line
                                                               Gilles.
#6 lore raw

I have try the kernal-3.4.6 with ipipe-core-3.4.6-arm-4.patch
when I set three same Priority tasks I found untill the tasks stop ,the interrut founction will not run. It same like before version kernal-2.6.35.9 with ipipe-core-2.6.35.9-arm-4.patch

static int test_thread(void *data)

{
	//phase=ctrl_mnm1221_m();
	while(1)
	{
	if(flag)
	{
		printk("runting %lld\n",tt3);
		flag=0;
		}
	SLEEP_MILLI_SEC(50);

	}
	return 0;
}

int irq_handle_function(int irq, void *device_id)

{
	//if(phase==PH_RUNNING)
	//ctrl_mnm1221_m();
	rt_intr_disable(&amp;intr_desc);
	tt1=rt_timer_read();
	tt3=tt1-tt2;
	if(tt3&gt;300000)
	flag=1;
	tt2=tt1;
	rt_intr_enable(&amp;intr_desc);
	return RT_INTR_HANDLED;;
}

void taskOne(void*arg)

{
	int i;
	for (i=0; i &lt; 0xffff; i++)
	{	
		printk("Iam taskOneand global = %d................\n", tt3);
	}
}
void taskTwo(void*arg)
{
	int i;
	for (i=0; i &lt; 0xffff; i++)
	{	
		printk("Iam taskTwo global = %d................\n", tt3);
	}
}
void taskThree(void*arg)
{
	int i;
	for (i=0; i &lt; 0xffff; i++)
	{	
		printk("Iam taskThree global = %d................\n", tt3);
	}
}
static int __init rtex_init(void){
	irq= gpio_to_irq(MY_GPIO2_14);
	
	/*err=request_irq(irq, irq_handle_function, 0, "rtex", (void *)&amp;irq);
	if(err)
	{
		printk("regist irq failure...\n");
		return -EIO;
	}*/
	err = rt_intr_create(&amp;intr_desc,"MyIrq",irq,irq_handle_function,NULL,I_SHARED|I_EDGE);
	/* ... */
	
	rt_intr_enable(&amp;intr_desc);



	rt_task_create(&amp;t1, "task1", 0, 1, 0);
	rt_task_create(&amp;t2, "task2", 0, 1, 0);/* start the two tasks */
	rt_task_create(&amp;t3, "task2", 0, 1, 0);/* start the two tasks */
	rt_task_start(&amp;t1, &amp;taskOne, 0);
	rt_task_start(&amp;t2, &amp;taskTwo, 0);
	rt_task_start(&amp;t2, &amp;taskThree, 0);
}

Every 500m gpio send an interrupt.
The result like blow:
tt1=rt_timer_read();

global = tt3=tt1-tt2;

Iam taskTwo global = 1610612755................ Iam taskTwo global = 1610612755................ Iam taskTwo global = 1610612755................ Iam taskTwo global = 1610612755................ Iam taskTwo global = 1610612755................ Iam taskTwo global = 1610612755................ Iam taskTwo global = 1610612755................ Iam taskTwo global = 1610612755................ Iam taskTwo global = 1610612755................ Iam taskTwo global = 1610612755................ Iam taskTwo global = 1610612755................ Iam taskTwo global = 1610612755................ Iam taskTwo global = 1610612755................ Iam taskTwo global = 1610612755................ Iam taskTwo global = 1610612755................ Iam taskTwo global = 1610612755................ Iam taskTwo global = 1610612755................ Iam taskTwo global = 1610612755................ Iam taskTwo global = 1610612755................ Iam taskTwo global = 1610612755................ Iam taskTwo global = 1610612755................ Iam taskTwo global = 1610612755................ Iam taskTwo global = 1610612755................ Iam taskTwo global = 1610612755................ Iam taskTwo global = 1610612755.
Iam taskTwo global = 1610612755................ Iam taskTwo global = 1610612755................ Iam taskTwo global = 1610612755................ Iam taskTwo global = 1610612755................ Iam taskTwo global = 1610612755................ Iam taskTwo global = 1610612755................ Iam taskTwo global = 1610612755................ Iam taskTwo global = 1610612755................ Irunting 502230
root@freescale /opt$ runting 499995 runting 500025
runting 500115
runting 500055
runting 500025
runting 500025
runting 500010
runting 500085
runting 500010
runting 500025
runting 500055
runting 500010
runting 500055
runting 499905
runting 500460
runting 500085
runting 500070
runting 500070
runting 500010
runting 500010
runting 500085
runting 500025
runting 499980
runting 500070
runting 500040
runting 500025
runting 498735
runting 500040
runting 500025
runting 500025
runting 500220
runting 499995
runting 500010
runting 500055
runting 500010
runting 500055
runting 500025
runting 500085
runting 500025
runting 500055
runting 500025
runting 500010
runting 500100
runting 500085
runting 500010

Then I do not know what should i do next?

Quoted 24 lines · 在 2013-05-31 13:54:49,"嵌入式工程师" <[email protected]> 写道:

ok ,thanks,i have a try

Quoted 6 lines · 在 2013-05-31 13:32:14,"Gilles Chanteperdrix"…
Quoted 2 lines · 嵌入式工程师

The I-pipe path version is adeos-ipipe-2.6.35.9-arm-1.18-01.patch , the kernal version is 2.6.35.9 ,i am so sorry for he details do not speak clearly

Quoted 10 lines

Hi,

there is no need to send your answer three times either. GPIO irqs are broken with this version of the I-pipe kernel. Please try updating to the I-pipe core patch for Linux 3.4 or 3.5.

Regards.

Signature · 1 line
                                                               Gilles.

_______________________________________________
Xenomai mailing list
[email protected]
http://www.xenomai.org/mailman/listinfo/xenomai

#7 lore raw
Quoted 22 lines · 嵌入式工程师

I have try the kernal-3.4.6 with ipipe-core-3.4.6-arm-4.patch
when I set three same Priority tasks I found untill the tasks stop ,the interrut founction will not run. It same like before version kernal-2.6.35.9 with ipipe-core-2.6.35.9-arm-4.patch

static int test_thread(void *data)

{
	//phase=ctrl_mnm1221_m();
	while(1)
	{
	if(flag)
	{
		printk("runting %lld\n",tt3);
		flag=0;
		}
	SLEEP_MILLI_SEC(50);

	}
	return 0;
}

int irq_handle_function(int irq, void *device_id)

Quoted 12 lines
{
	//if(phase==PH_RUNNING)
	//ctrl_mnm1221_m();
	rt_intr_disable(&amp;intr_desc);
	tt1=rt_timer_read();
	tt3=tt1-tt2;
	if(tt3&gt;300000)
	flag=1;
	tt2=tt1;
	rt_intr_enable(&amp;intr_desc);
	return RT_INTR_HANDLED;;
}

Why do you disable/enable the irq during the irq handler?

Signature · 1 line
                                                                Gilles.
#8 lore raw

To prevent re-entry

Quoted 43 lines · 在 2013-06-01 18:16:15,"Gilles Chanteperdrix"…
Quoted 22 lines · 嵌入式工程师

I have try the kernal-3.4.6 with ipipe-core-3.4.6-arm-4.patch
when I set three same Priority tasks I found untill the tasks stop ,the interrut founction will not run. It same like before version kernal-2.6.35.9 with ipipe-core-2.6.35.9-arm-4.patch

static int test_thread(void *data)

{
	//phase=ctrl_mnm1221_m();
	while(1)
	{
	if(flag)
	{
		printk("runting %lld\n",tt3);
		flag=0;
		}
	SLEEP_MILLI_SEC(50);

	}
	return 0;
}

int irq_handle_function(int irq, void *device_id)

Quoted 12 lines
{
	//if(phase==PH_RUNNING)
	//ctrl_mnm1221_m();
	rt_intr_disable(&amp;intr_desc);
	tt1=rt_timer_read();
	tt3=tt1-tt2;
	if(tt3&gt;300000)
	flag=1;
	tt2=tt1;
	rt_intr_enable(&amp;intr_desc);
	return RT_INTR_HANDLED;;
}

Why do you disable/enable the irq during the irq handler?

Signature · 1 line
                                                               Gilles.
#9 lore raw

sorry ,before I did not say clearly。It is Every 500Millisecond gpio send an interrupt

Quoted 45 lines · 在 2013-06-03 09:36:27,"嵌入式工程师" <[email protected]> 写道:

To prevent re-entry

Quoted 43 lines · 在 2013-06-01 18:16:15,"Gilles Chanteperdrix"…
Quoted 22 lines · 嵌入式工程师

I have try the kernal-3.4.6 with ipipe-core-3.4.6-arm-4.patch
when I set three same Priority tasks I found untill the tasks stop ,the interrut founction will not run. It same like before version kernal-2.6.35.9 with ipipe-core-2.6.35.9-arm-4.patch

static int test_thread(void *data)

{
	//phase=ctrl_mnm1221_m();
	while(1)
	{
	if(flag)
	{
		printk("runting %lld\n",tt3);
		flag=0;
		}
	SLEEP_MILLI_SEC(50);

	}
	return 0;
}

int irq_handle_function(int irq, void *device_id)

Quoted 12 lines
{
	//if(phase==PH_RUNNING)
	//ctrl_mnm1221_m();
	rt_intr_disable(&amp;intr_desc);
	tt1=rt_timer_read();
	tt3=tt1-tt2;
	if(tt3&gt;300000)
	flag=1;
	tt2=tt1;
	rt_intr_enable(&amp;intr_desc);
	return RT_INTR_HANDLED;;
}

Why do you disable/enable the irq during the irq handler?

Signature · 1 line
                                                               Gilles.
#10 lore raw
In reply to 嵌入式工程师
Quoted 1 line · 嵌入式工程师

To prevent re-entry

You do not need to do that:
- hardware interrupts are off, so, there is no possible reentry
- if the interrupt if of the "level" type, the flow handler already does it, and with some edge type interrupt handler, you risk to miss interrupts.

Signature · 1 line
                                                                Gilles.
#11 lore raw

I have removed the disable and enble codes .,but It still be interrupted by the rt_task。
If it does not let the task runing the Interruption time will be very accurate. why?

Quoted 12 lines · 在 2013-06-03 14:03:14,"Gilles Chanteperdrix"…
Quoted 1 line · 嵌入式工程师

To prevent re-entry

You do not need to do that:
- hardware interrupts are off, so, there is no possible reentry
- if the interrupt if of the "level" type, the flow handler already does it, and with some edge type interrupt handler, you risk to miss interrupts.

Signature · 1 line
                                                               Gilles.
#12 lore raw
In reply to Gilles Chanteperdrix

I have set the trigger type with Low trigger and without disable and enable codes. if the interrupt is triggered the hardware will set the gpio with High 。 It has the same problem.
I do not why ?
Thanks!

Quoted 12 lines · 在 2013-06-03 14:03:14,"Gilles Chanteperdrix"…
Quoted 1 line · 嵌入式工程师

To prevent re-entry

You do not need to do that:
- hardware interrupts are off, so, there is no possible reentry
- if the interrupt if of the "level" type, the flow handler already does it, and with some edge type interrupt handler, you risk to miss interrupts.

Signature · 1 line
                                                               Gilles.
#13 lore raw
Quoted 4 lines · 嵌入式工程师

I have set the trigger type with Low trigger and without disable and enable codes. if the interrupt is triggered the hardware will set the gpio with High 。 It has the same problem.
I do not why ?

Ok, could you tell me:
- what type you set for your interrupt (with irq_set_irq_type)?
- what is the shape of the signal?

Sorry for stating the obvious, but if the gpio is toggled every 500milliseconds and you set the irq type to level (low or high), the interrupts is considered to be asserted by the interrupt controller during 500 milliseconds, and so your interrupt handler is called continuously during 500 milliseconds. In that case, what you would be interested in would be to call:
irq_set_irq_type(irq, IRQ_TYPE_EDGE_BOTH)
for instance.

Regards.

Signature · 1 line
                                                                Gilles.
#14 lore raw

Now ,I suddenly noticed,P and V operation must not be interrupted operation. Before I did not know my colleague spent rt_sem_p () and rt_sem_v (). Today, I suddenly saw it.
I also would like to ask, rt_alarm_inquire is available in rt_sem_v () operation, timing counts?
Because they are in the case with a timer but also a very accurate timekeeping pv operation.

Quoted 25 lines · 在 2013-06-03 19:46:17,"Gilles Chanteperdrix"…
Quoted 4 lines · 嵌入式工程师

I have set the trigger type with Low trigger and without disable and enable codes. if the interrupt is triggered the hardware will set the gpio with High 。 It has the same problem.
I do not why ?

Ok, could you tell me:
- what type you set for your interrupt (with irq_set_irq_type)?
- what is the shape of the signal?

Sorry for stating the obvious, but if the gpio is toggled every 500milliseconds and you set the irq type to level (low or high), the interrupts is considered to be asserted by the interrupt controller during 500 milliseconds, and so your interrupt handler is called continuously during 500 milliseconds. In that case, what you would be interested in would be to call:
irq_set_irq_type(irq, IRQ_TYPE_EDGE_BOTH)
for instance.

Regards.

Signature · 1 line
                                                               Gilles.
#15 lore raw
Quoted 1 line · 嵌入式工程师

Now ,I suddenly noticed,P and V operation must not be interrupted operation.

They can not be, they grab the nucleus spinlock.

Quoted 4 lines

Before I did not know my colleague spent rt_sem_p () and rt_sem_v ().
Today, I suddenly saw it.
I also would like to ask, rt_alarm_inquire is available in rt_sem_v () operation, timing counts? Because they are in the case with a timer but also a very accurate timekeeping pv operation.

I am sorry, but I do not understand what you ask. The unit of the timings used and returned by the native skin services is documented in the API documentation.

Besides, using the native API to handle interrupts is deprecated.

Signature · 1 line
                                                                Gilles.