Hi Tim,
I recently went through a serial port programming experience fairly
similar to yours. The roles of the "good" system and the "bad" system
were reversed for me in that my code worked perfectly on a TS-7300 but
when ported to a PC it wouldn't work reliably. Unfortunately, I lost
many hours trying to fix the code on the PC thinking I had an obvious
coding issue. There's a coding issue... it's just not obvious. It may
require some revising the code for portability.
I am giving a long response in the hope that we can nail down the
cause of this kind of problem.
I had problems with the C read call hanging and/or other times
returning nothing when there was activity on the serial port, just as
you described. In addition, as an aside, I was getting extra garbage
from the C read() when running it on the PC. The garbage looked like a
sign extension in that it would only show up when the high bit of a
received byte was set. This did not occur on the TS-7300 and as far as
I could tell I was compiling with the exact same command line.
For my eventual "fix" I did not resort to direct manipulation of the
serial port hardware but did look at serial port code for Minicom
since Minicom has worked reliably for me on different architectures. I
treated Minicom source as an example of nearly anything one would want
to do with a serial port. I didn't spend long with that code since I
just wanted to make sure I was using the same calls that Minicom uses.
I realize that this doesn't directly help you with a C++ implementation.
My conclusion of that phase of the effort was that the performance on
a PC does not appear to be a good indication of the performance on a
different architecture. There's so many variables... hardware
differences (hence driver differences), versions, and patch levels
throughout all the pieces (kernels, device drivers, compilers,
libraries, etc.). Potentially each one of these contributors has
different bugs and performance characteristics. Also, the extensive
use of the preprocessor in Minicom is a indication to me that
multi-platform serial applications might be particular about their
programming.
For anybody who might want to start some banter about the Linux kernel
being multi-platform and how well it works across architectures with
those same variables I'd say a kernel isn't a device driver but that
may be a matter of perspective. How much serial port testing is being
done by kernel and device driver developers these days?
Differences in my environment and your environment:
1) TS-7300 instead of TS-7250
2) TS-7300 running Debian not TS-Linux. You may want to consider
seeing what happens if you run the code on Debian using a USB flash
drive. That's what I'd be using if I were to try my TS-7300 code on
the TS-7250.
3) The TS-7300 has serial ports on different UARTs (and device
drivers) (In the midst of the read() problems I did consider putting
my code onto a TS-7250, that I have access to, to see if different
UART hardware would give me yet another data point - I chose not to
because the TS-7300 has both FPGA implemented serial ports as well as
two ports provided by the EP9302 processor which should be nearly the
same as the TS-7250's ports. When I ran my code on the second serial
port, COM2, of the TS-7300 it worked just as well as the code running
off the FPGA serial port COM6).
4) My programs for serial ports are written in C.
----
Andy
--- In "Tim Trudeau" <> wrote:
>
> I have a serial port class written in C++ that make use of Linux POSIX.
> This should make the code portable between a PC target and a TS7250
> target. The code works perfectly running on the PC but some times hangs
> in the POSIX read function. Other time the read function returns
> nothing even though there is activity on the serial port.
>
> My question is, should I attempt direct manipulation of the TS7250
> serial port hardware, (is this even possible under TS-Linux?) or is
> there another solution to accessing the serial port on the TS7250?
>
> Is TS-Linux itself the problem??
>
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/
|