UART0 is definitely not the same as console. I have both Xuart0 and console
running independently right now. I have console hooked up to a hyperterminal
session, and Xuart0 to a GPS antenna.
I've abandoned the development kit and built my own Interface board with
external RS232 level shifters. I'll be adding the Maxim232 chip shortly so the
level shifting will be done on the interface board shortly.
It should be noted that its ok to just rerun the xuartctl command to
re-establish the uart0 whenever you want. this is an effective way to throw out
the stored data if you want to "reset" the RS232 device. The only issue is the
old xuartctl is still around. I use the "pgrep" command to capture the PID of
the old xuartctl's kill them, and start a new one each time the program starts.
this way old data is thrown out. Here's a sample session:
ts7500:/home/jon/programs/sjinn#
ts7500:/home/jon/programs/sjinn#
ts7500:/home/jon/programs/sjinn#
ts7500:/home/jon/programs/sjinn#
ts7500:/home/jon/programs/sjinn# pgrep -f xuart -l
111 xuartctl --server
2471 xuartctl --port 0 --server --speed 4800
2512 xuartctl --port 0 --server --speed 4800
ts7500:/home/jon/programs/sjinn## here I've restarted xuartctl --port 0. You
can see the old (2471) and the new (2512) still exist.
ts7500:/home/jon/programs/sjinn# ./uart_setup.sh
/dev/pts/0
2523
ts7500:/home/jon/programs/sjinn##my script uart_setup.sh will first kill all
uart0 xuartctl PID's and then restart a new one (in this case 2523)
ts7500:/home/jon/programs/sjinn#
ts7500:/home/jon/programs/sjinn# pgrep -f xuart -l
111 xuartctl --server
2523 xuartctl --port 0 --server --speed 4800
ts7500:/home/jon/programs/sjinn#
ts7500:/home/jon/programs/sjinn#
ts7500:/home/jon/programs/sjinn# cat uart_setup.sh
#!/bin/sh
XUARTID=`pgrep -f "xuartctl --port 0"`
kill $XUARTID
PAR1=`xuartctl --port 0 --server --speed 4800 2>&1 |cut -d= -f2`
echo $PAR1
ln -sf $PAR1 /dev/testuart
XUARTID=`pgrep -f "xuartctl --port 0"`
echo $XUARTID
ts7500:/home/jon/programs/sjinn#
ts7500:/home/jon/programs/sjinn#
ts7500:/home/jon/programs/sjinn# ./rs232 -d /dev/testuart -b4800 --verbose -m
-w2 -r300
/dev/testuart 4800 8n1 read 300 characters before
read 300/300 characters after
7,09,27,,,,,,,,,,16.8,16.8,1.0*38.
$GPRMC,144029.000,A,4059.0376,N,07401.4984,W,9.99,184.03,050110,,*10.
$GPGGA,144030.000,4059.0362,N,07401.4986,W,1,03,16.8,24.0,M,-34.2,M,,0000*60.
$GPGSA,A,2,17,09,27,,,,,,,,,,16.8,16.8,1.0*38.
$GPRMC,144030.000,A,4059.0362,N,07401.4986,W,9.43,183.74,050110,,*1F.
ts7500:/home/jon/programs/sjinn#
as I really only want the current GPS data and not the historical, this ability
to dump the buffer and start fresh is critical to my application.
--- In "david.breton" <> wrote:
>
>
>
>
>
>
>
>
>
>
> We do this within our /etc/init.d script to start xuaxrtctl on a known port
> as specified by $ttyname
>
>
> if [ ! "`ps -ef | grep xuartctl | grep server | grep port | grep -v grep`" ]$
> # xuartctl for port 0 not running. need to start it.
> #
> # Ensure serial device file name is consistent
> #
> eval `/usr/local/bin/xuartctl --port 0 --server --speed 38400 2>&1`
> sleep 1
> ln -sf $ttyname /dev/xuart0
> fi
>
>
> Dave B
>
>
> --- In "naturalwatt" <martin@> wrote:
> >
> > I am just getting started with the TS7500 (but will be using the T7550 for
> > production).
> >
> > --- In "jongsoo_k" <jongsoo.kim@> wrote:
> > >
> > > I am reading the example of xuartctl in software guide for TS 7550.
> > >
> > > It uses two RS232 port, console and xurt0.
> > >
> > > From console, the following command is issued so than console program is
> > > connected to xurt 0.
> > > # xuartctl --port 0 --server
> > > # xuartctl --port 0 --server --speed 115200
> > > ttyname=/dev/pts/0
> > >
> >
> > I don't think this is right. The console and xuart0 are not the same. The
> > first command and second commands are the same apart from the specification
> > of the speed. Because --port and --server are both used, a pseudotty is
> > allocated. If you do this early in the boot or application startup, it
> > will consistently get /dev/pts/0.
> >
> > > I have a few questions.
> > > 1) I understand since the command " xuartctl --port 0 --server" is issued
> > > from the console, xuart 0 is connected with console. If a program ( not
> > > console) issues this command, then xuart 0 port will be connected with
> > > the program ( whatever it is). Am i correct?
> >
> > Again, not right. It will connect /dev/pts/0 to xuart0.
> > >
> > > 2)In software guide, i read below
> > > [The xuartctl utility will always choose the first free device node. So,
> > > there may be instances where specifying "--port 0" will result in
> > > /dev/pts/1. This makes it difficult when programming for /dev/pts/0
> > > specifically. One suggestion to overcome this is to create symlinks:
> > > ln -s /dev/pts/1 /dev/pts/0 ]
> > >
> > > This makes me concerned because i need to statically assign about 5-6
> > > xuart device nodes statically to physical device ports not like choosing
> > > the first free node. I am not sure if the "ln" command can do the job. I
> > > appreciate any advice.
> >
> > If you want to use several XUART, it might be easier to run xuartctl
> > --server at boot time. This will then create TCP ports at 7350 up to 7357.
> > You could simply open() and read() write() these ports instead of using
> > pseudo ttys. There is some subtlety in setting the buad rate, as the ioctl
> > to set them doesn't work on sockets. You can either run system("xuartctl
> > --speed=SOMETHING") or there is another way.
> >
> > If you use popen, you can create a pipe you can read and write.
> > popen("xuartctl --port=0", "r+") for example.
> >
> > Sorry I can't give exact details at the moment. I have found Technologic
> > Support helpful on matters regarding the xaurts, probably because the
> > supplied documentation is a little hard to understand.
> >
> > Martin
> > >
> > > Thanks
> > >
> > > Jongsoo
> > >
> >
>
------------------------------------
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/
|