mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Eric Miao" <eric.y.miao@gmail.com>
To: "Jon Smirl" <jonsmirl@gmail.com>
Cc: "ARM Linux Mailing List"
	<linux-arm-kernel@lists.arm.linux.org.uk>,
	lkml <linux-kernel@vger.kernel.org>
Subject: Re: Toggling GPIO at 38Khz
Date: Wed, 8 Oct 2008 14:40:32 +0800	[thread overview]
Message-ID: <f17812d70810072340n6cb9bd21w1fcf73b56b4f8dff@mail.gmail.com> (raw)
In-Reply-To: <9e4733910810072043m6c69f3bdv104bd32928fe64ae@mail.gmail.com>

On Wed, Oct 8, 2008 at 11:43 AM, Jon Smirl <jonsmirl@gmail.com> wrote:
> I'm working on getring the LIRC IR subsystem integrated into the
> kernel. One common IR hardware implementation is based on standard
> serial ports. It uses the serial port's DCD and DTR as GPIO pins.
> This common IR hardware does not have a transmit modulator and is
> modulating the IR signal in software. Luckily is has hardware
> demodulation.
>
> There are four common IR frequencies - 36Khz, 38Khz, 40Khz, 56Khz. I
> need to create these frequencies in software. Data is then transmitted
> as 400-600us burst of these frequencies. Around 10-30 clock pulses.
>
> So how do I reliably generate 38Khz without destroying latency in the
> system? I also don't want to measure the speed of the code I'm
> executing - same code has to run on 90Mhz ARM and 3Ghz Core2. If a do
> a loop with nanosleep() I need to know how fast my code is to subtract
> it's execution time form the sleep time. The existing LIRC code works
> this way and measures it's timing loop.
>

This isn't easy, 38KHz is quite a high frequency, I'd prefer to
use an interrupt or fiq based on a accurate clock event source,
but that will have impact on the system anyway.

> hrtimers look promising, but hrtimers doesn't have a periodic API. Is
> there a technique for creating periodic timing that doesn't accumulate
> error caused by rescheduling the timers?  If I need to send 30 pulses
> of 38Khz, it is more important that the total time be (1/38000)*30 =
> 0.7894ms than it is for each pulse to be generated at exactly 26.3us
> intervals.
>

Make sure your clock source is accurate enough to generate
this interval.

> Are there other techniques for generating pulse trains in the 36-56Khz
> range on a simple GPIO pin? Anyone have some sample code?
>

With a PWM possibly.

> --
> Jon Smirl
> jonsmirl@gmail.com
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
>



-- 
Cheers
- eric

  reply	other threads:[~2008-10-08  6:40 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-08  3:43 Jon Smirl
2008-10-08  6:40 ` Eric Miao [this message]
2008-10-09  8:38   ` Andy Green
2008-10-08 12:01 ` Bill Gatliff
2008-10-08 13:06   ` Jon Smirl
2008-10-08 17:00     ` Chris Friesen
2008-10-08 21:58     ` Krzysztof Halasa
2008-10-08 18:57 ` Remy Bohmer
2008-10-08 22:24   ` Dave Hylands
2008-10-09  2:26     ` Bill Gatliff
2008-10-09 17:53     ` linux-os (Dick Johnson)
     [not found] <bkydL-21G-5@gated-at.bofh.it>
2008-10-08 12:15 ` Bodo Eggert

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=f17812d70810072340n6cb9bd21w1fcf73b56b4f8dff@mail.gmail.com \
    --to=eric.y.miao@gmail.com \
    --cc=jonsmirl@gmail.com \
    --cc=linux-arm-kernel@lists.arm.linux.org.uk \
    --cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome