lkml.org 
[lkml]   [2008]   [Oct]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectToggling GPIO at 38Khz
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.

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.

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

--
Jon Smirl
jonsmirl@gmail.com


\
 
 \ /
  Last update: 2008-10-08 05:47    [W:0.120 / U:13.464 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site