All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai] Xenomai on Raspberry pi 2, 3 - Userspace task is interrupted?
@ 2018-08-08 10:44 Ho Tam
  2018-08-08 11:12 ` Greg Gallagher
  0 siblings, 1 reply; 7+ messages in thread
From: Ho Tam @ 2018-08-08 10:44 UTC (permalink / raw)
  To: xenomai

Hello all,
I make a simple code to measure process time on Raspberry pi 0,1,2,3 like:

* previous = rt_timer_read();*
* for (i=0; i<500; ++i)*
* {*
* bcm2835_gpio_write(TEST_PIN, HIGH);*
* bcm2835_gpio_write(TEST_PIN, LOW);*
* }*
* now = rt_timer_read();*
* process_time = (long) (now - previous);*
* if (process_time>worst_time)*
* worst_time=process_time;*

And I result after several hours running:
rpi           process_time (us)             worst_time (us)
0,1           ~100                                     115
2,3           ~90                                        373

It is clear that process time on rpi2,3 is shorter than that on rpi0,1 due
to higher speed CPU. However, I don't understand why worst case on rpi2,3
is much larger than that on rpi0,1. I have repeated this test on both
xenomai 2 and 3, kernel  4.1 and 4.9 (only xenomai 3 in this case) and with
different task priority, the result is quite consistent.
Does anyone have explanation and solution?
Thanks and regards,

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Xenomai] Xenomai on Raspberry pi 2, 3 - Userspace task is interrupted?
  2018-08-08 10:44 [Xenomai] Xenomai on Raspberry pi 2, 3 - Userspace task is interrupted? Ho Tam
@ 2018-08-08 11:12 ` Greg Gallagher
  2018-08-08 15:41   ` Ho Tam
  0 siblings, 1 reply; 7+ messages in thread
From: Greg Gallagher @ 2018-08-08 11:12 UTC (permalink / raw)
  To: Ho Tam, xenomai


How are you setting up the gpio read and write? Is it possible to post a code snippet for the read and write?

Greg

  Original Message  
From: mophong@gmail.com
Sent: August 8, 2018 6:45 AM
To: xenomai@xenomai.org
Reply-to: mophong@gmail.com
Subject: [Xenomai] Xenomai on Raspberry pi 2, 3 - Userspace task is interrupted?

Hello all,
I make a simple code to measure process time on Raspberry pi 0,1,2,3 like:

* previous = rt_timer_read();*
* for (i=0; i<500; ++i)*
* {*
* bcm2835_gpio_write(TEST_PIN, HIGH);*
* bcm2835_gpio_write(TEST_PIN, LOW);*
* }*
* now = rt_timer_read();*
* process_time = (long) (now - previous);*
* if (process_time>worst_time)*
* worst_time=process_time;*

And I result after several hours running:
rpi           process_time (us)             worst_time (us)
0,1           ~100                                     115
2,3           ~90                                        373

It is clear that process time on rpi2,3 is shorter than that on rpi0,1 due
to higher speed CPU. However, I don't understand why worst case on rpi2,3
is much larger than that on rpi0,1. I have repeated this test on both
xenomai 2 and 3, kernel  4.1 and 4.9 (only xenomai 3 in this case) and with
different task priority, the result is quite consistent.
Does anyone have explanation and solution?
Thanks and regards,
_______________________________________________
Xenomai mailing list
Xenomai@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Xenomai] Xenomai on Raspberry pi 2, 3 - Userspace task is interrupted?
  2018-08-08 11:12 ` Greg Gallagher
@ 2018-08-08 15:41   ` Ho Tam
  2018-08-08 15:52     ` greg gallagher
  0 siblings, 1 reply; 7+ messages in thread
From: Ho Tam @ 2018-08-08 15:41 UTC (permalink / raw)
  To: greg; +Cc: xenomai

I used bcm2835 library for test, that library is implemented using memory
map (mmap). You may check its copied code here:
https://github.com/smart-facility/bcm2835/tree/master/src
The function I used  bcm2835_gpio_write:
void bcm2835_gpio_write(uint8_t pin, uint8_t on)
{
    if (on)
bcm2835_gpio_set(pin);
    else
bcm2835_gpio_clr(pin);
}

I have also tested by direct using of bcm2835_gpio_set and bcm2835_gpio_clr
fucntions, but result was same as previous test:
for (i=0; i<500; ++i)
{
bcm2835_gpio_set(TEST_PIN);
bcm2835_gpio_clr(TEST_PIN);
}

Since functions in bcm2835 library usually call many other functions, I
have also implemented my own gpio library which directly read/write value
to GPSET and GPCLR:
for (i=0; i<3000; ++i)
{
*(rpi_gpio_mem_base+7) =(1<<TEST_PIN);    //rpi_gpio_mem_base+7 ~ GPSET0
*(rpi_gpio_mem_base+10) =(1<<TEST_PIN);  //rpi_gpio_mem_base+10 ~ GPCLR0
}
Here rpi_gpio_mem_base has been initialized with mmap before. In this case,
both process time and worst time reduce (for sure). But again, worst time
on rpi2,3 is larger than 350% process time, while for rpi0,1 worst time ~
120% process time.
Regards,


On Wed, Aug 8, 2018 at 8:12 PM Greg Gallagher <greg@embeddedgreg.com> wrote:

>
> How are you setting up the gpio read and write? Is it possible to post a
> code snippet for the read and write?
>
> Greg
>
>   Original Message
> From: mophong@gmail.com
> Sent: August 8, 2018 6:45 AM
> To: xenomai@xenomai.org
> Reply-to: mophong@gmail.com
> Subject: [Xenomai] Xenomai on Raspberry pi 2, 3 - Userspace task is
> interrupted?
>
> Hello all,
> I make a simple code to measure process time on Raspberry pi 0,1,2,3 like:
>
> * previous = rt_timer_read();*
> * for (i=0; i<500; ++i)*
> * {*
> * bcm2835_gpio_write(TEST_PIN, HIGH);*
> * bcm2835_gpio_write(TEST_PIN, LOW);*
> * }*
> * now = rt_timer_read();*
> * process_time = (long) (now - previous);*
> * if (process_time>worst_time)*
> * worst_time=process_time;*
>
> And I result after several hours running:
> rpi           process_time (us)             worst_time (us)
> 0,1           ~100                                     115
> 2,3           ~90                                        373
>
> It is clear that process time on rpi2,3 is shorter than that on rpi0,1 due
> to higher speed CPU. However, I don't understand why worst case on rpi2,3
> is much larger than that on rpi0,1. I have repeated this test on both
> xenomai 2 and 3, kernel  4.1 and 4.9 (only xenomai 3 in this case) and with
> different task priority, the result is quite consistent.
> Does anyone have explanation and solution?
> Thanks and regards,
> _______________________________________________
> Xenomai mailing list
> Xenomai@xenomai.org
> https://xenomai.org/mailman/listinfo/xenomai
>


-- 
http://www.mophong.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Xenomai] Xenomai on Raspberry pi 2, 3 - Userspace task is interrupted?
  2018-08-08 15:41   ` Ho Tam
@ 2018-08-08 15:52     ` greg gallagher
  2018-08-09  5:48       ` Ho Tam
  0 siblings, 1 reply; 7+ messages in thread
From: greg gallagher @ 2018-08-08 15:52 UTC (permalink / raw)
  To: mophong; +Cc: xenomai

If you use these functions your test will run in secondary mode. You 
need to install the rtdm bcm2835_gpio driver for your test to stay in 
the primary domain.  Your tests at the moment are running as normal 
linux applications even though you have built them with the Xenomai 
libraries.  You'll need enable the gpio module in the kernel build.  You 
should see the gpio pins under /dev/rtdm once the module is loaded.  It 
might be worth while posting your steps for building the application so 
you can ensure you are indeed building the application to correctly 
interface with Xenomai.


-Greg


On 2018-08-08 11:41 AM, Ho Tam wrote:
> I used bcm2835 library for test, that library is implemented using 
> memory map (mmap). You may check its copied code here: 
> https://github.com/smart-facility/bcm2835/tree/master/src
> The function I used bcm2835_gpio_write:
> void bcm2835_gpio_write(uint8_t pin, uint8_t on)
> {
>     if (on)
> bcm2835_gpio_set(pin);
>     else
> bcm2835_gpio_clr(pin);
> }
>
> I have also tested by direct using of bcm2835_gpio_set 
> and bcm2835_gpio_clr fucntions, but result was same as previous test:
> for (i=0; i<500; ++i)
> {
> bcm2835_gpio_set(TEST_PIN);
> bcm2835_gpio_clr(TEST_PIN);
> }
>
> Since functions in bcm2835 library usually call many other functions, 
> I have also implemented my own gpio library which directly read/write 
> value to GPSET and GPCLR:
> for (i=0; i<3000; ++i)
> {
> *(rpi_gpio_mem_base+7) =(1<<TEST_PIN);    //rpi_gpio_mem_base+7 ~ GPSET0
> *(rpi_gpio_mem_base+10) =(1<<TEST_PIN);  //rpi_gpio_mem_base+10 ~ GPCLR0
> }
> Here rpi_gpio_mem_base has been initialized with mmap before. In this 
> case, both process time and worst time reduce (for sure). But again, 
> worst time on rpi2,3 is larger than 350% process time, while for 
> rpi0,1 worst time ~ 120% process time.
> Regards,
>
>
> On Wed, Aug 8, 2018 at 8:12 PM Greg Gallagher <greg@embeddedgreg.com 
> <mailto:greg@embeddedgreg.com>> wrote:
>
>
>     How are you setting up the gpio read and write? Is it possible to
>     post a code snippet for the read and write?
>
>     Greg
>
>       Original Message
>     From: mophong@gmail.com <mailto:mophong@gmail.com>
>     Sent: August 8, 2018 6:45 AM
>     To: xenomai@xenomai.org <mailto:xenomai@xenomai.org>
>     Reply-to: mophong@gmail.com <mailto:mophong@gmail.com>
>     Subject: [Xenomai] Xenomai on Raspberry pi 2, 3 - Userspace task
>     is interrupted?
>
>     Hello all,
>     I make a simple code to measure process time on Raspberry pi
>     0,1,2,3 like:
>
>     * previous = rt_timer_read();*
>     * for (i=0; i<500; ++i)*
>     * {*
>     * bcm2835_gpio_write(TEST_PIN, HIGH);*
>     * bcm2835_gpio_write(TEST_PIN, LOW);*
>     * }*
>     * now = rt_timer_read();*
>     * process_time = (long) (now - previous);*
>     * if (process_time>worst_time)*
>     * worst_time=process_time;*
>
>     And I result after several hours running:
>     rpi           process_time (us)             worst_time (us)
>     0,1           ~100                                     115
>     2,3           ~90                                        373
>
>     It is clear that process time on rpi2,3 is shorter than that on
>     rpi0,1 due
>     to higher speed CPU. However, I don't understand why worst case on
>     rpi2,3
>     is much larger than that on rpi0,1. I have repeated this test on both
>     xenomai 2 and 3, kernel  4.1 and 4.9 (only xenomai 3 in this case)
>     and with
>     different task priority, the result is quite consistent.
>     Does anyone have explanation and solution?
>     Thanks and regards,
>     _______________________________________________
>     Xenomai mailing list
>     Xenomai@xenomai.org <mailto:Xenomai@xenomai.org>
>     https://xenomai.org/mailman/listinfo/xenomai
>
>
>
> -- 
> http://www.mophong.com



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Xenomai] Xenomai on Raspberry pi 2, 3 - Userspace task is interrupted?
  2018-08-08 15:52     ` greg gallagher
@ 2018-08-09  5:48       ` Ho Tam
  2018-08-09 11:02         ` Ho Tam
  2018-08-09 11:16         ` Greg Gallagher
  0 siblings, 2 replies; 7+ messages in thread
From: Ho Tam @ 2018-08-09  5:48 UTC (permalink / raw)
  To: greg; +Cc: xenomai

Hello Greg,
Thanks for your answer. There is still something unclear. So far I have
worked with mmap + xenomai task on several platforms like Beaglebone
(single core), IMX6Q (quad-core), and as you can see, RPI0,1 (BCM2835), it
works just fine.
Still, I don't understand why this situation ONLY happens on RPI2,3
(BCM2857).
Regards,

On Thu, Aug 9, 2018 at 12:52 AM greg gallagher <greg@embeddedgreg.com>
wrote:

> If you use these functions your test will run in secondary mode. You
> need to install the rtdm bcm2835_gpio driver for your test to stay in
> the primary domain.  Your tests at the moment are running as normal
> linux applications even though you have built them with the Xenomai
> libraries.  You'll need enable the gpio module in the kernel build.  You
> should see the gpio pins under /dev/rtdm once the module is loaded.  It
> might be worth while posting your steps for building the application so
> you can ensure you are indeed building the application to correctly
> interface with Xenomai.
>
>
> -Greg
>
>
> On 2018-08-08 11:41 AM, Ho Tam wrote:
> > I used bcm2835 library for test, that library is implemented using
> > memory map (mmap). You may check its copied code here:
> > https://github.com/smart-facility/bcm2835/tree/master/src
> > The function I used bcm2835_gpio_write:
> > void bcm2835_gpio_write(uint8_t pin, uint8_t on)
> > {
> >     if (on)
> > bcm2835_gpio_set(pin);
> >     else
> > bcm2835_gpio_clr(pin);
> > }
> >
> > I have also tested by direct using of bcm2835_gpio_set
> > and bcm2835_gpio_clr fucntions, but result was same as previous test:
> > for (i=0; i<500; ++i)
> > {
> > bcm2835_gpio_set(TEST_PIN);
> > bcm2835_gpio_clr(TEST_PIN);
> > }
> >
> > Since functions in bcm2835 library usually call many other functions,
> > I have also implemented my own gpio library which directly read/write
> > value to GPSET and GPCLR:
> > for (i=0; i<3000; ++i)
> > {
> > *(rpi_gpio_mem_base+7) =(1<<TEST_PIN);    //rpi_gpio_mem_base+7 ~ GPSET0
> > *(rpi_gpio_mem_base+10) =(1<<TEST_PIN);  //rpi_gpio_mem_base+10 ~ GPCLR0
> > }
> > Here rpi_gpio_mem_base has been initialized with mmap before. In this
> > case, both process time and worst time reduce (for sure). But again,
> > worst time on rpi2,3 is larger than 350% process time, while for
> > rpi0,1 worst time ~ 120% process time.
> > Regards,
> >
> >
> > On Wed, Aug 8, 2018 at 8:12 PM Greg Gallagher <greg@embeddedgreg.com
> > <mailto:greg@embeddedgreg.com>> wrote:
> >
> >
> >     How are you setting up the gpio read and write? Is it possible to
> >     post a code snippet for the read and write?
> >
> >     Greg
> >
> >       Original Message
> >     From: mophong@gmail.com <mailto:mophong@gmail.com>
> >     Sent: August 8, 2018 6:45 AM
> >     To: xenomai@xenomai.org <mailto:xenomai@xenomai.org>
> >     Reply-to: mophong@gmail.com <mailto:mophong@gmail.com>
> >     Subject: [Xenomai] Xenomai on Raspberry pi 2, 3 - Userspace task
> >     is interrupted?
> >
> >     Hello all,
> >     I make a simple code to measure process time on Raspberry pi
> >     0,1,2,3 like:
> >
> >     * previous = rt_timer_read();*
> >     * for (i=0; i<500; ++i)*
> >     * {*
> >     * bcm2835_gpio_write(TEST_PIN, HIGH);*
> >     * bcm2835_gpio_write(TEST_PIN, LOW);*
> >     * }*
> >     * now = rt_timer_read();*
> >     * process_time = (long) (now - previous);*
> >     * if (process_time>worst_time)*
> >     * worst_time=process_time;*
> >
> >     And I result after several hours running:
> >     rpi           process_time (us)             worst_time (us)
> >     0,1           ~100                                     115
> >     2,3           ~90                                        373
> >
> >     It is clear that process time on rpi2,3 is shorter than that on
> >     rpi0,1 due
> >     to higher speed CPU. However, I don't understand why worst case on
> >     rpi2,3
> >     is much larger than that on rpi0,1. I have repeated this test on both
> >     xenomai 2 and 3, kernel  4.1 and 4.9 (only xenomai 3 in this case)
> >     and with
> >     different task priority, the result is quite consistent.
> >     Does anyone have explanation and solution?
> >     Thanks and regards,
> >     _______________________________________________
> >     Xenomai mailing list
> >     Xenomai@xenomai.org <mailto:Xenomai@xenomai.org>
> >     https://xenomai.org/mailman/listinfo/xenomai
> >
> >
> >
> > --
> > http://www.mophong.com
>
>

-- 
http://www.mophong.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Xenomai] Xenomai on Raspberry pi 2, 3 - Userspace task is interrupted?
  2018-08-09  5:48       ` Ho Tam
@ 2018-08-09 11:02         ` Ho Tam
  2018-08-09 11:16         ` Greg Gallagher
  1 sibling, 0 replies; 7+ messages in thread
From: Ho Tam @ 2018-08-09 11:02 UTC (permalink / raw)
  To: greg; +Cc: xenomai

Hello,
In order to close this topic, I have found a workaround, I isolated all 4
cores of RPI2,3 (isolcpus=0,1,2,3) and now performance is similar to that
on RPI0,1. This may not be accepted by someone but for my application, it
is acceptable.
Thanks and Regards,


On Thu, Aug 9, 2018 at 2:48 PM Ho Tam <mophong@gmail.com> wrote:

> Hello Greg,
> Thanks for your answer. There is still something unclear. So far I have
> worked with mmap + xenomai task on several platforms like Beaglebone
> (single core), IMX6Q (quad-core), and as you can see, RPI0,1 (BCM2835), it
> works just fine.
> Still, I don't understand why this situation ONLY happens on RPI2,3
> (BCM2857).
> Regards,
>
> On Thu, Aug 9, 2018 at 12:52 AM greg gallagher <greg@embeddedgreg.com>
> wrote:
>
>> If you use these functions your test will run in secondary mode. You
>> need to install the rtdm bcm2835_gpio driver for your test to stay in
>> the primary domain.  Your tests at the moment are running as normal
>> linux applications even though you have built them with the Xenomai
>> libraries.  You'll need enable the gpio module in the kernel build.  You
>> should see the gpio pins under /dev/rtdm once the module is loaded.  It
>> might be worth while posting your steps for building the application so
>> you can ensure you are indeed building the application to correctly
>> interface with Xenomai.
>>
>>
>> -Greg
>>
>>
>> On 2018-08-08 11:41 AM, Ho Tam wrote:
>> > I used bcm2835 library for test, that library is implemented using
>> > memory map (mmap). You may check its copied code here:
>> > https://github.com/smart-facility/bcm2835/tree/master/src
>> > The function I used bcm2835_gpio_write:
>> > void bcm2835_gpio_write(uint8_t pin, uint8_t on)
>> > {
>> >     if (on)
>> > bcm2835_gpio_set(pin);
>> >     else
>> > bcm2835_gpio_clr(pin);
>> > }
>> >
>> > I have also tested by direct using of bcm2835_gpio_set
>> > and bcm2835_gpio_clr fucntions, but result was same as previous test:
>> > for (i=0; i<500; ++i)
>> > {
>> > bcm2835_gpio_set(TEST_PIN);
>> > bcm2835_gpio_clr(TEST_PIN);
>> > }
>> >
>> > Since functions in bcm2835 library usually call many other functions,
>> > I have also implemented my own gpio library which directly read/write
>> > value to GPSET and GPCLR:
>> > for (i=0; i<3000; ++i)
>> > {
>> > *(rpi_gpio_mem_base+7) =(1<<TEST_PIN);    //rpi_gpio_mem_base+7 ~ GPSET0
>> > *(rpi_gpio_mem_base+10) =(1<<TEST_PIN);  //rpi_gpio_mem_base+10 ~ GPCLR0
>> > }
>> > Here rpi_gpio_mem_base has been initialized with mmap before. In this
>> > case, both process time and worst time reduce (for sure). But again,
>> > worst time on rpi2,3 is larger than 350% process time, while for
>> > rpi0,1 worst time ~ 120% process time.
>> > Regards,
>> >
>> >
>> > On Wed, Aug 8, 2018 at 8:12 PM Greg Gallagher <greg@embeddedgreg.com
>> > <mailto:greg@embeddedgreg.com>> wrote:
>> >
>> >
>> >     How are you setting up the gpio read and write? Is it possible to
>> >     post a code snippet for the read and write?
>> >
>> >     Greg
>> >
>> >       Original Message
>> >     From: mophong@gmail.com <mailto:mophong@gmail.com>
>> >     Sent: August 8, 2018 6:45 AM
>> >     To: xenomai@xenomai.org <mailto:xenomai@xenomai.org>
>> >     Reply-to: mophong@gmail.com <mailto:mophong@gmail.com>
>> >     Subject: [Xenomai] Xenomai on Raspberry pi 2, 3 - Userspace task
>> >     is interrupted?
>> >
>> >     Hello all,
>> >     I make a simple code to measure process time on Raspberry pi
>> >     0,1,2,3 like:
>> >
>> >     * previous = rt_timer_read();*
>> >     * for (i=0; i<500; ++i)*
>> >     * {*
>> >     * bcm2835_gpio_write(TEST_PIN, HIGH);*
>> >     * bcm2835_gpio_write(TEST_PIN, LOW);*
>> >     * }*
>> >     * now = rt_timer_read();*
>> >     * process_time = (long) (now - previous);*
>> >     * if (process_time>worst_time)*
>> >     * worst_time=process_time;*
>> >
>> >     And I result after several hours running:
>> >     rpi           process_time (us)             worst_time (us)
>> >     0,1           ~100                                     115
>> >     2,3           ~90                                        373
>> >
>> >     It is clear that process time on rpi2,3 is shorter than that on
>> >     rpi0,1 due
>> >     to higher speed CPU. However, I don't understand why worst case on
>> >     rpi2,3
>> >     is much larger than that on rpi0,1. I have repeated this test on
>> both
>> >     xenomai 2 and 3, kernel  4.1 and 4.9 (only xenomai 3 in this case)
>> >     and with
>> >     different task priority, the result is quite consistent.
>> >     Does anyone have explanation and solution?
>> >     Thanks and regards,
>> >     _______________________________________________
>> >     Xenomai mailing list
>> >     Xenomai@xenomai.org <mailto:Xenomai@xenomai.org>
>> >     https://xenomai.org/mailman/listinfo/xenomai
>> >
>> >
>> >
>> > --
>> > http://www.mophong.com
>>
>>
>
> --
> http://www.mophong.com
>


-- 
http://www.mophong.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Xenomai] Xenomai on Raspberry pi 2, 3 - Userspace task is interrupted?
  2018-08-09  5:48       ` Ho Tam
  2018-08-09 11:02         ` Ho Tam
@ 2018-08-09 11:16         ` Greg Gallagher
  1 sibling, 0 replies; 7+ messages in thread
From: Greg Gallagher @ 2018-08-09 11:16 UTC (permalink / raw)
  To: Ho Tam; +Cc: xenomai


   It's possible the domains don't have much to do with your issue. Can
   you confirm if you are switching modes in the case of the rpi2\3? There
   isn't anything unique about the rpi2\3 that would impact it only. Are
   you able to get some info on what the system is doing during the worst
   case run? This is the only application running at the time?
   Greg

   From: mophong@gmail.com
   Sent: August 9, 2018 1:48 AM
   To: greg@embeddedgreg.com
   Reply-to: mophong@gmail.com
   Cc: xenomai@xenomai.org
   Subject: Re: [Xenomai] Xenomai on Raspberry pi 2, 3 - Userspace task is
   interrupted?

   Hello Greg,
   Thanks for your answer. There is still something unclear. So far I have
   worked with mmap + xenomai task on several platforms like Beaglebone
   (single core), IMX6Q (quad-core), and as you can see, RPI0,1 (BCM2835),
   it works just fine.
   Still, I don't understand why this situation ONLY happens on RPI2,3
   (BCM2857).
   Regards,
   On Thu, Aug 9, 2018 at 12:52 AM greg gallagher
   <[1]greg@embeddedgreg.com> wrote:

     If you use these functions your test will run in secondary mode. You
     need to install the rtdm bcm2835_gpio driver for your test to stay
     in
     the primary domain.  Your tests at the moment are running as normal
     linux applications even though you have built them with the Xenomai
     libraries.  You'll need enable the gpio module in the kernel build.
     You
     should see the gpio pins under /dev/rtdm once the module is loaded.
     It
     might be worth while posting your steps for building the application
     so
     you can ensure you are indeed building the application to correctly
     interface with Xenomai.
     -Greg
     On 2018-08-08 11:41 AM, Ho Tam wrote:
     > I used bcm2835 library for test, that library is implemented using
     > memory map (mmap). You may check its copied code here:
     > [2]https://github.com/smart-facility/bcm2835/tree/master/src
     > The function I used bcm2835_gpio_write:
     > void bcm2835_gpio_write(uint8_t pin, uint8_t on)
     > {
     >     if (on)
     > bcm2835_gpio_set(pin);
     >     else
     > bcm2835_gpio_clr(pin);
     > }
     >
     > I have also tested by direct using of bcm2835_gpio_set
     > and bcm2835_gpio_clr fucntions, but result was same as previous
     test:
     > for (i=0; i<500; ++i)
     > {
     > bcm2835_gpio_set(TEST_PIN);
     > bcm2835_gpio_clr(TEST_PIN);
     > }
     >
     > Since functions in bcm2835 library usually call many other
     functions,
     > I have also implemented my own gpio library which directly
     read/write
     > value to GPSET and GPCLR:
     > for (i=0; i<3000; ++i)
     > {
     > *(rpi_gpio_mem_base+7) =(1<<TEST_PIN);    //rpi_gpio_mem_base+7 ~
     GPSET0
     > *(rpi_gpio_mem_base+10) =(1<<TEST_PIN);  //rpi_gpio_mem_base+10 ~
     GPCLR0
     > }
     > Here rpi_gpio_mem_base has been initialized with mmap before. In
     this
     > case, both process time and worst time reduce (for sure). But
     again,
     > worst time on rpi2,3 is larger than 350% process time, while for
     > rpi0,1 worst time ~ 120% process time.
     > Regards,
     >
     >
     > On Wed, Aug 8, 2018 at 8:12 PM Greg Gallagher
     <[3]greg@embeddedgreg.com
     > <mailto:[4]greg@embeddedgreg.com>> wrote:
     >
     >
     >     How are you setting up the gpio read and write? Is it possible
     to
     >     post a code snippet for the read and write?
     >
     >     Greg
     >
     >       Original Message
     >     From: [5]mophong@gmail.com <mailto:[6]mophong@gmail.com>
     >     Sent: August 8, 2018 6:45 AM
     >     To: [7]xenomai@xenomai.org <mailto:[8]xenomai@xenomai.org>
     >     Reply-to: [9]mophong@gmail.com <mailto:[10]mophong@gmail.com>
     >     Subject: [Xenomai] Xenomai on Raspberry pi 2, 3 - Userspace
     task
     >     is interrupted?
     >
     >     Hello all,
     >     I make a simple code to measure process time on Raspberry pi
     >     0,1,2,3 like:
     >
     >     * previous = rt_timer_read();*
     >     * for (i=0; i<500; ++i)*
     >     * {*
     >     * bcm2835_gpio_write(TEST_PIN, HIGH);*
     >     * bcm2835_gpio_write(TEST_PIN, LOW);*
     >     * }*
     >     * now = rt_timer_read();*
     >     * process_time = (long) (now - previous);*
     >     * if (process_time>worst_time)*
     >     * worst_time=process_time;*
     >
     >     And I result after several hours running:
     >     rpi           process_time (us)             worst_time (us)
     >     0,1           ~100                                     115
     >     2,3           ~90                                        373
     >
     >     It is clear that process time on rpi2,3 is shorter than that
     on
     >     rpi0,1 due
     >     to higher speed CPU. However, I don't understand why worst
     case on
     >     rpi2,3
     >     is much larger than that on rpi0,1. I have repeated this test
     on both
     >     xenomai 2 and 3, kernel  4.1 and 4.9 (only xenomai 3 in this
     case)
     >     and with
     >     different task priority, the result is quite consistent.
     >     Does anyone have explanation and solution?
     >     Thanks and regards,
     >     _______________________________________________
     >     Xenomai mailing list
     >     [11]Xenomai@xenomai.org <mailto:[12]Xenomai@xenomai.org>
     >     [13]https://xenomai.org/mailman/listinfo/xenomai
     >
     >
     >
     > --
     > [14]http://www.mophong.com

   --
   [15]http://www.mophong.com

References

   1. mailto:greg@embeddedgreg.com
   2. https://github.com/smart-facility/bcm2835/tree/master/src
   3. mailto:greg@embeddedgreg.com
   4. mailto:greg@embeddedgreg.com
   5. mailto:mophong@gmail.com
   6. mailto:mophong@gmail.com
   7. mailto:xenomai@xenomai.org
   8. mailto:xenomai@xenomai.org
   9. mailto:mophong@gmail.com
  10. mailto:mophong@gmail.com
  11. mailto:Xenomai@xenomai.org
  12. mailto:Xenomai@xenomai.org
  13. https://xenomai.org/mailman/listinfo/xenomai
  14. http://www.mophong.com/
  15. http://www.mophong.com/

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-08-09 11:16 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-08 10:44 [Xenomai] Xenomai on Raspberry pi 2, 3 - Userspace task is interrupted? Ho Tam
2018-08-08 11:12 ` Greg Gallagher
2018-08-08 15:41   ` Ho Tam
2018-08-08 15:52     ` greg gallagher
2018-08-09  5:48       ` Ho Tam
2018-08-09 11:02         ` Ho Tam
2018-08-09 11:16         ` Greg Gallagher

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.