Some comments:
Firstly, you say you can send stuff to the port and view it on the PC, but not
the other way around That indicates you have got almost everything working.
Since the Xuarts don't have hardware flow control, I suspect you need to
disable flow control on Hyperterminal or use PuTTY instead.
You mention that doing another xuartctl on the same port creates another
/dev/pts. This is probably because the original xuartctl on the same port is
still there. At best, this will give problems as there are two processes
trying to read from the same device.
Secondly, both Xuartctl and Telnet will create /dev/pts/ devices. If the first
thing you do is telnet in to the board, that will get /dev/pts/0. if instead
you create one or more xuartctl --server entries in the boot sequence, they
should get created before you connect with telnet and you can treat them as
consistently named.
Thirdly, you can't use tcsettattr on /dev/pts/ devices as they do not support
the required IOCTL call - Linux doesn't know they are mapped to 'real' serial
ports'.
Fourthly, you could modify your code so instead of doing fd =
open("/dev/something", OPTIONS) you open a socket - 7350 for xuart1 and so on.
If you stick to the supplied xuartctl --server command the 8 Xuarts are in
defined places, and you won't have the problem of not knowing where each Xuart
is.
All this stuff is in the TS7500 documentation, but it is quite difficult to
read. The information is dotted around and you have to read between the lines
in some places.
Finally, from conversation with TS support and reading the source to xaurtctl,
if you want to set the speed of an Xuart, you can either
* use system("xuartctl --port=0 --speed=9600")
* Using socket programming, send "9600" as Out-of-band data and close the
socket, then reopen it.
Martin
--- In John Spooner <> wrote:
>
> Can you show me some simple example c code to read from a uart port. I have
> setup talking between hyperterminal and a uart port , write from TS7500 is
> easy and working read is not working. and worse still it seems like after
> an attempted read if i do another xuartctl to make sure the port is ok, it
> chooses /pts/1.
>
> should i be using tcsetattr or just merely try to read from the port?
>
>
> On Mon, Nov 16, 2009 at 1:06 AM, skuruz <>wrote:
>
> >
> >
> > Hi,
> > I m using TS-7500 and TS-752 A for develop, and I want to use specific
> > serial port for communication on it. For example I set the XUART#5 (port 5)
> > as a start-up script in rc2 like
> > xuartctl --port 5 --server â?"-speed 115200
> > and it returns to me ttyname=/dev/pts/0
> > there is not problem in this step I can use /dev/pts/0 in my C code easily.
> >
> > But when i disconnect TS-7500 from TS-752 and use my own card then --port 5
> > sometimes can be allocated and connected as /dev/pts/0 or /dev/pts/1. And
> > sometimes I read from /dev/pts/0 console output data but at the manual it
> > said that console pins are only #7 and #8 and it is connected to /dev/ttyS0.
> > Because of that problem I cant say to my code open port always as
> > /dev/pts/0.
> > Can I allocate and connect any port to any specific directory like always
> > /dev/pts/1 with xuartctl command.
> >
> >
> >
>
------------------------------------
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/
|