From: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
To: Andrey Nechypurenko <andreynech@domain.hid>
Cc: Xenomai help <xenomai@xenomai.org>
Subject: Re: [Xenomai-help] Jitter while generating PWMs with GPIO from RTDM driver
Date: Mon, 23 Apr 2012 14:44:37 +0200 [thread overview]
Message-ID: <4F954EB5.70600@domain.hid> (raw)
In-Reply-To: <4F954ABE.20508@domain.hid>
On 04/23/2012 02:27 PM, Gilles Chanteperdrix wrote:
> On 04/23/2012 01:56 PM, Andrey Nechypurenko wrote:
>> Hi Folks,
>>
>> Following my tests with PWM generation using GPIO in user space [1],
>> I've made the RTDM module [2] to further reduce the jitter. As a
>> result, jitter was improved, but still under heavy system load the
>> servo motor I am trying to control starts shaking. Now, I fill stuck
>> and hope to get some help here.
>>
>> At one hand, I can not imaging that 800MHz ARM (BeagleBoard xM) could
>> not manage to generate 20mS PWMs from RTDM driver precise enough to
>> avoid sporadic servo movements. So probably I am doing something
>> wrong. On the other hand, I do not see where the possible mistake can
>> happen and hope that someone experienced in with Xenomai could help.
>>
>> There is an article about observed behavior [3] with more details, but
>> the core problem, I guess, boils down to the following code fragment:
>>
>> void pwm_task_proc(void *arg) {
>> const int which = (int)arg;
>>
>> // Toggling GPIO pin
>> for(;;) {
>> //set_data_out has offset 0x94 . Set gpio pin to 1 (up)
>> iowrite32(0x40000000, gpio + 0x6094);
>>
>> // wait requested pulse width time (duty)
>> if(0 != rtdm_task_sleep(up_period[which]))
>> rtdm_printk("PWM: rtdm_task_sleep() returns error\n");
>>
>> //clear_data_out has offset 0x90 . Set gpio pin to 0 (down)
>> iowrite32(0x40000000, gpio + 0x6090);
>>
>> // wait until the next pulse should start (20mS interval)
>> if(0 != rtdm_task_wait_period())
>> rtdm_printk("PWM: rtdm_task_wait_period() returns error\n");
>> }
>>
>> This is the function running as a periodic task started with the following call:
>>
>> retval = rtdm_task_init(&pwm_task[i], // there is currently only one
>> element in this array
>> "pwm-task",
>> pwm_task_proc,
>> 0,
>> RTDM_TASK_HIGHEST_PRIORITY,
>> 20000000); // 20ms period
>
> Do not use a thread, use a timer.
>
So, rtdm_timer_init
If this still has too much overhead, you can use the OMAP3 API do
dedicate a GPTIMER to this task, and simply register an irq for the
GPTIMER which does the job (as opposed to a timer created with
rtdm_timer_init).
--
Gilles.
next prev parent reply other threads:[~2012-04-23 12:44 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-23 11:56 [Xenomai-help] Jitter while generating PWMs with GPIO from RTDM driver Andrey Nechypurenko
2012-04-23 12:27 ` Gilles Chanteperdrix
2012-04-23 12:35 ` Andrey Nechypurenko
2012-04-23 12:51 ` Gilles Chanteperdrix
2012-04-23 12:57 ` Andrey Nechypurenko
2012-04-23 13:15 ` Philippe Gerum
2013-07-22 16:52 ` [Xenomai] " Christoph
2013-07-22 20:51 ` Andrey Nechypurenko
2012-04-23 12:59 ` [Xenomai-help] " Gilles Chanteperdrix
2012-04-23 13:05 ` Andrey Nechypurenko
2012-04-23 12:44 ` Gilles Chanteperdrix [this message]
2012-04-23 13:14 ` Wolfgang Grandegger
2012-04-23 13:25 ` Andrey Nechypurenko
2012-04-23 13:37 ` Wolfgang Grandegger
[not found] <CAOiXNkD+-yANz15W_cnD9QLjyGH7LUT-Pf8LEJHqx4Kh24pL+g@mail.gmail.com>
[not found] ` <4F954ABE.20508@xenomai.org>
[not found] ` <CAOiXNkDKRpQKjtvC-H1YsJtHkNWYcWTUEKPqfYv0HQ_=SRHGCw@mail.gmail.com>
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4F954EB5.70600@domain.hid \
--to=gilles.chanteperdrix@xenomai.org \
--cc=andreynech@domain.hid \
--cc=xenomai@xenomai.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.