From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 References: In-Reply-To: Reply-To: mophong@gmail.com From: Ho Tam Date: Thu, 9 Aug 2018 00:41:43 +0900 Message-ID: Content-Type: text/plain; charset="UTF-8" Subject: Re: [Xenomai] Xenomai on Raspberry pi 2, 3 - Userspace task is interrupted? List-Id: Discussions about the Xenomai project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: greg@embeddedgreg.com Cc: xenomai@xenomai.org 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< 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