public inbox for linux-rt-users@vger.kernel.org
 help / color / mirror / Atom feed
* how fast can you run a hrtimer?
@ 2017-08-18 12:35 Cliff Brake
  2017-08-18 14:34 ` Cliff Brake
  0 siblings, 1 reply; 5+ messages in thread
From: Cliff Brake @ 2017-08-18 12:35 UTC (permalink / raw)
  To: rt-users; +Cc: Cliff Brake

Hi,

I have an application where we need to tweak a PWM setting every 10uS.
My impression is this is beyond the capabilities of linux+rt, but want
to verify I'm not missing anything before we add an external
microcontroller to handle this.

I've run some experiments on a i.MX6UL with v4.1+rt, and observe
delays of ~50us when toggling a GPIO in a Linux driver using a
hrtimer.

Thanks,
Cliff

-- 
=================
http://bec-systems.com

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

* Re: how fast can you run a hrtimer?
  2017-08-18 12:35 how fast can you run a hrtimer? Cliff Brake
@ 2017-08-18 14:34 ` Cliff Brake
  2017-08-18 14:52   ` Julia Cartwright
  2017-08-22 12:45   ` afzal mohammed
  0 siblings, 2 replies; 5+ messages in thread
From: Cliff Brake @ 2017-08-18 14:34 UTC (permalink / raw)
  To: rt-users; +Cc: Cliff Brake

After a suggestion of using a NMI and a bit of research, it seems
something like the following article is the probably a reasonable
approach:

http://free-electrons.com/blog/fiq-handlers-in-the-arm-linux-kernel/

Cliff

On Fri, Aug 18, 2017 at 8:35 AM, Cliff Brake <cliff.brake@gmail.com> wrote:
> Hi,
>
> I have an application where we need to tweak a PWM setting every 10uS.
> My impression is this is beyond the capabilities of linux+rt, but want
> to verify I'm not missing anything before we add an external
> microcontroller to handle this.
>
> I've run some experiments on a i.MX6UL with v4.1+rt, and observe
> delays of ~50us when toggling a GPIO in a Linux driver using a
> hrtimer.
>
> Thanks,
> Cliff
>
> --
> =================
> http://bec-systems.com



-- 
=================
http://bec-systems.com

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

* Re: how fast can you run a hrtimer?
  2017-08-18 14:34 ` Cliff Brake
@ 2017-08-18 14:52   ` Julia Cartwright
  2017-08-22 12:45   ` afzal mohammed
  1 sibling, 0 replies; 5+ messages in thread
From: Julia Cartwright @ 2017-08-18 14:52 UTC (permalink / raw)
  To: Cliff Brake; +Cc: rt-users, Cliff Brake

[-- Attachment #1: Type: text/plain, Size: 721 bytes --]

On Fri, Aug 18, 2017 at 10:34:19AM -0400, Cliff Brake wrote:
> After a suggestion of using a NMI and a bit of research, it seems
> something like the following article is the probably a reasonable
> approach:
> 
> http://free-electrons.com/blog/fiq-handlers-in-the-arm-linux-kernel/

The use of a FIQ probably gives you the best chance to achieve the
latencies you want; but keep in mind that the use of FIQ means you'll
need to get your hands pretty dirty.

The set of operations legal to perform from NMI context is very, very
small.  The usage of gpiolib (and therefore any existing i.MX gpio
driver) is probably not going to work from NMI context, so you'll have
to roll your own solution.

   Julia

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: how fast can you run a hrtimer?
  2017-08-18 14:34 ` Cliff Brake
  2017-08-18 14:52   ` Julia Cartwright
@ 2017-08-22 12:45   ` afzal mohammed
  2017-08-22 13:13     ` Cliff Brake
  1 sibling, 1 reply; 5+ messages in thread
From: afzal mohammed @ 2017-08-22 12:45 UTC (permalink / raw)
  To: Cliff Brake; +Cc: rt-users, Cliff Brake

Hi

> On Fri, Aug 18, 2017 at 8:35 AM, Cliff Brake <cliff.brake@gmail.com> wrote:

> > I have an application where we need to tweak a PWM setting every 10uS.
> > My impression is this is beyond the capabilities of linux+rt, but want
> > to verify I'm not missing anything before we add an external
> > microcontroller to handle this.
> >
> > I've run some experiments on a i.MX6UL with v4.1+rt, and observe
> > delays of ~50us when toggling a GPIO in a Linux driver using a
> > hrtimer.

On Fri, Aug 18, 2017 at 10:34:19AM -0400, Cliff Brake wrote:
> After a suggestion of using a NMI and a bit of research, it seems
> something like the following article is the probably a reasonable
> approach:
> 
> http://free-electrons.com/blog/fiq-handlers-in-the-arm-linux-kernel/

If a PWM IP is present on the chip, won't updating the PWM compare
registers within 10us (PWM @100KHz) achieve the required ?, toggling
delay & jitter shouldn't be a worry here, right ? (assuming PWM
compare registers can be updated every 10us using hrtimers)

afzal

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

* Re: how fast can you run a hrtimer?
  2017-08-22 12:45   ` afzal mohammed
@ 2017-08-22 13:13     ` Cliff Brake
  0 siblings, 0 replies; 5+ messages in thread
From: Cliff Brake @ 2017-08-22 13:13 UTC (permalink / raw)
  To: afzal mohammed; +Cc: rt-users

On Tue, Aug 22, 2017 at 8:45 AM, afzal mohammed <afzal.mohd.ma@gmail.com> wrote:

> If a PWM IP is present on the chip, won't updating the PWM compare
> registers within 10us (PWM @100KHz) achieve the required ?, toggling
> delay & jitter shouldn't be a worry here, right ? (assuming PWM
> compare registers can be updated every 10us using hrtimers)
>

There is timers on the cpu that can generate a PWM in hardware, but
what we need to do is update the PWM duty cycle every 10us (so the PWM
freq will be say 1MHz).  The idea is to ramp up/down the PWM value
over time (waveform generation).  I suppose if we could somehow feed
the capture/compare registers with DMA, that might work.  Gives me an
idea -- we should look into audio hardware and see if any of that can
generate a 100KHz waveform.

Cliff

-- 
=================
http://bec-systems.com

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

end of thread, other threads:[~2017-08-22 13:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-18 12:35 how fast can you run a hrtimer? Cliff Brake
2017-08-18 14:34 ` Cliff Brake
2017-08-18 14:52   ` Julia Cartwright
2017-08-22 12:45   ` afzal mohammed
2017-08-22 13:13     ` Cliff Brake

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox