The following 5 line diff to our open TS7500 FPGA Verilog source code from the
FTP site creates a SBUS FPGA register at 0x78 that is a servo PWM output on
DIO#21 that takes number of microseconds for on time. It is coded to 50Hz
frame rate.
This allows you to manipulate servo position with the following shell commands:
# ts7500ctl -a 0x78 -w 1500 #1.5ms on time (neutral)
# ts7500ctl -a 0x78 -w 2000 #2.0ms on time
Or from C using the "sbus.h" API:
#include "sbus.h"
sbuslock();
sbus_poke16(0x78, 1500);
sbusunlock();
Even the best realtime Linux will have jitter in the hundreds of microseconds
from processing other IRQs, network stack, L1 cache being hot/cold, etc. The
FPGA based implementation above should have jitter approximately 1 million
times less (<.1ns)
//Jesse Off
--- syscon.v 24 Jun 2011 00:04:06 -0000 1.6
+++ syscon.v 9 Apr 2012 23:38:52 -0000
@@ -257,6 +257,7 @@
count <= 7'd0;
usec <= usec + 1'b1;
end
+ if (usec == 32'd20000) usec <= 32'd0;
end
end
@@ -288,8 +289,10 @@
assign pllphase_o = pllphase;
reg can_enable;
assign can_enable_o = can_enable;
+reg [11:0] on_usec;
always @(posedge wb_clk_i or posedge wb_rst_i) begin
if (wb_rst_i) begin
+ on_usec <= 12'd0;
dio_oe <= 41'd0;
dio <= 41'd0;
rtc_sda <= 1'b0;
@@ -325,7 +328,9 @@
scratch <= wb_dat_i[3:2];
resetsw_en <= wb_dat_i[4];
end
+ 5'h18: on_usec <= wb_dat_i[11:0];
endcase
+ dio[21] <= (usec > on_usec) ? 1'b0 : 1'b1;
if (can_opt && can_wbaccess_i) can_enable <= 1'b1;
end
end
//Jesse Off
--- In "jesseoff" <> wrote:
>
> All I can say is that before anybody follows any suggestion of Walter on this
> list on "the proper way" to go about an important project using one of our
> boards, please give us a call first. 480-837-5200
>
> Mark does indeed know what he's doing and when he's not sure on something,
> has access to a lot of other experts at TS that prefer to not enter online
> discussions.
>
> I've only briefly read this thread, but I can tell you the path of least
> resistance to reliable servo motor PID control does NOT involve realtime
> patches, kernel device driver writing, IRQ rerouting, high resolution timers,
> and software based realtime bit-banging PWM. Thats just absurd.
>
> //Jesse Off
>
> --- In Walter Marvin <walter.marvin@> wrote:
> >
> > Nonsense
> >
> > Linux handles real time quite well. Mark simply does not know how to do it
> > properly
> >
> > Walter
> >
> >
> >
> > ________________________________
> > From: Mark Featherston <mark@>
> > To:
> > Sent: Monday, April 9, 2012 1:53 PM
> > Subject: Re: [ts-7000] high resolution timers and real time
> >
> >
> > Â
> > Komal,
> >
> > I would not recommend going down the route of using kernel patches for high
> > resolution timers in Linux for controlling a motor. Â Linux is not well
> > suited for hard realtime applications. Â However, the FPGA on our boards is
> > very good at meeting very specific timing like this. Â We have created FPGA
> > cores on the TS-7558-BOX and TS-7520-BOX with a common software interface
> > which includes PWM control. Â I would recommend migrating to one of these
> > boards which can then use a very simple example:
> > http://www.embeddedarm.com//wiki/index.php/Daqctl#Controlling_a_Servo
> >
> > http://www.embeddedarm.com/products/board-detail.php?product=TS-7520-BOX
> > http://www.embeddedarm.com/products/board-detail.php?product=TS-7558-BOX
> >
> >
> > Best Regards,
> > ________________________________________________________________
> > Mark Featherston, Technologic Systems | voice: (480) 837-5200
> > 16525 East Laser Drive               | fax: (480) 837-5300
> > Fountain Hills, AZ 85268Â Â Â Â Â Â Â Â Â Â Â Â Â | web:
> > www.embeddedARM.com
> >
> >
> >
> > On Apr 2, 2012, at 12:39 AM, komal wrote:
> >
> > Â
> > >Dear Sir,
> > >
> > >I have recently acquired a ts-7500 board with the development kit. The SD
> > >card comes with a 2.6.24 Linux Kernel. After a few days of experimenting I
> > >have realized that my application (controlling a servo through PWM) will
> > >require HRT and RT support which the Kernel is unable to provide (maximum
> > >timer resolution I am getting on the current Kernel is 20ms).
> > >
> > >I am new to Linux and embedded systems development and hence I am a little
> > >confused about how to tackle this problem. I do not understand what you
> > >mean by applying the patches and how to apply the patch. Can i simply do
> > >it on-board my board with the SD-Card. I have a windows PC with Eclipse
> > >for Development.
> > >
> > >Any help you can provide me will be highly appreciated. Thank you.
> > >
> > >Regards,
> > >Komal RAUF
> > >
> > >--- In Peter Gammie <peteg42@> wrote:
> > >>
> > >> Charles, any anyone interested in hrtimers:
> > >>
> > >> With Andrew's help I managed to build a 2.6.32.3 kernel that seems to
> > >> work. Attached are a config and a patch, based on this:
> > >>
> > >> http://lkml.org/lkml/2009/7/22/119
> > >>
> > >> that enable hrtimers. I've lightly tested it on a ts7260 with 64Mb of
> > >> memory. I loaded the kernel via TFTP with:
> > >>
> > >> load -r -b 0x00218000 -h 192.168.1.1 z
> > >> exec -c "console=ttyAM0,115200
> > >> ip=192.168.1.50:192.168.1.1:192.168.1.1:255.255.255.0:ts7200a:eth0:off
> > >> root=/dev/mtdblock1"
> > >>
> > >> (i.e. no special memory options or anything.)
> > >>
> > >> So the routine is to apply Matthieu's patches, then this one. I expect
> > >> it will apply to other kernel versions (specifically 2.6.29.6 if you
> > >> want -RT) without too much bother - but be careful that the Kconfig
> > >> patch applies to the right system type!
> > >>
> > >> As for the clock multiplexing, Charles's suggestion of using just a
> > >> PREEMPT (not RT) kernel results in better behaviour under light periodic
> > >> load (it doesn't flicker while running top on the console) but about the
> > >> same under heavier load (scp'ing a few megabytes via ethernet). I have
> > >> the CONFIG_NO_HZ (tickless) option set, which may or may not do anything
> > >> in particular...
> > >>
> > >> So, more investigation is required.
> > >>
> > >> Thanks for all your help.
> > >>
> > >> cheers
> > >> peter
> > >>
> > >>
> > >>
> > >>
> > >> --
> > >> http://peteg.org/
> > >>
> > >
> > >
> >
>
------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/ts-7000/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/ts-7000/join
(Yahoo! ID required)
<*> To change settings via email:
<*> To unsubscribe from this group, send an email to:
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|