|
|
|
|
|
|
| Author |
Message |
Guest
|
Posted: Mon Jun 20, 2005 12:42 pm Post subject:
Primitive File Transfer with Serial Port
|
|
|
A Question about
Primitive File Transfer with Serial Port.
I want to transfer a binary file "filename"
through the serial port, from a FreeBSD
machine to an old Laptop with a half
installed NetBSD, without slip or
any sophisticated program, something like
this:
(1) Connect machines with 0-modem cable
(2) cat /dev/tty00 > filename (NetBSD)
(3) cat filename > /dev/cuaa0 (FreeBSD)
I tried, but the file came corrupted.
FIRST QUESTION: How to do it correctly.
For changing the parameters in the serial
device cuaa0 of the FreeBSD machine one
uses the initialization device cuaia0:
stty raw crtscts < /dev/cuaia0
This doesnt work with NetBSD.
SECOND QUESTION: How to use stty in NetBSD
to set the default parameters (before
opening the device)?
I did the following (not pretty thing):
cat /dev/tty00 > filename
^Z
bg
stty -f /dev/tty00 raw crtscts
Inded it changed the parameters of the
opened device, but I got a corrupted
file and many times the error "silo
overflow".
THIRD QUESTION: what to do against "silo
overflow"?
I thank you for any hint!
Rodrigo. |
|
| Back to top |
|
 |
Guest
|
Posted: Mon Jun 20, 2005 2:38 pm Post subject:
Re: Primitive File Transfer with Serial Port
|
|
|
Ed Ravin schrieb:
I used "google groups" :)
| Quote: | Of course it did. Use zmodem or Kermit to get the file over.
|
I cannot transfer them, only the serial port seems to "work".
And I want to see if this "primitive way" works, just for
trying it. So, again my questions:
(1) How to do it.
(2) How to set the defaults with stty in NetBSD (it differs
from normal Unix, from FreeBSD and from Linux.
(3) How to avoid the "silo overflow".
If this is impossible, perhaps someone could say why this is
impossible. Sorry: no floppy, no slip, no ppp, no kermint,
no zmodem, no uucp!
Rodrigo. |
|
| Back to top |
|
 |
Guest
|
Posted: Mon Jun 20, 2005 2:38 pm Post subject:
Re: Primitive File Transfer with Serial Port
|
|
|
Ed Ravin schrieb:
I used "google groups" :)
| Quote: | Of course it did. Use zmodem or Kermit to get the file over.
|
I cannot transfer them, only the serial port seems to "work".
And I want to see if this "primitive way" works, just for
trying it. So, again my questions:
(1) How to do it.
(2) How to set the defaults with stty in NetBSD (it differs
from normal Unix, from FreeBSD and from Linux.
(3) How to avoid the "silo overflow".
If this is impossible, perhaps someone could say why this is
impossible. Sorry: no floppy, no slip, no ppp, no kermint,
no zmodem, no uucp!
Rodrigo. |
|
| Back to top |
|
 |
Guest
|
Posted: Mon Jun 20, 2005 2:41 pm Post subject:
Re: Primitive File Transfer with Serial Port
|
|
|
| Quote: | If your null modem cable forces CTS and RTS high
(most do), then hardware flow control is not going to work either.
|
What does this mean? How to verify if my cable is so? |
|
| Back to top |
|
 |
Ed Ravin *nix forums beginner
Joined: 20 Jun 2005
Posts: 2
|
Posted: Mon Jun 20, 2005 3:33 pm Post subject:
Re: Primitive File Transfer with Serial Port
|
|
|
From somewhere in cyberspace, scire@web.de said:
| Quote: |
A Question about
Primitive File Transfer with Serial Port.
I want to transfer a binary file "filename"
through the serial port
[...]
(1) Connect machines with 0-modem cable
(2) cat /dev/tty00 > filename (NetBSD)
(3) cat filename > /dev/cuaa0 (FreeBSD)
I tried, but the file came corrupted.
|
Of course it did. Use zmodem or Kermit to get the file over. Or UUCP
if that's all you've got. If "primitive" file transfers over serial
ports actually worked, none of us communications programmers would have
jobs. If you're trying to transfer a binary file, xon/xoff flow control
is not going to work. If your null modem cable forces CTS and RTS high
(most do), then hardware flow control is not going to work either.
Save yourself a lot of grief and use some software on both sides of
the connection.
--
Ed Ravin | "The law, in its majestic equality, forbids the rich as
| well as the poor to sleep under bridges, to beg in the
eravin@ | streets, and to steal bread."
panix.com | --Anatole France, Le Lys Rouge [1894] |
|
| Back to top |
|
 |
Ted Spradley *nix forums beginner
Joined: 03 Jun 2005
Posts: 4
|
Posted: Mon Jun 20, 2005 9:13 pm Post subject:
Re: Primitive File Transfer with Serial Port
|
|
|
On 20 Jun 2005 09:41:19 -0700
scire@web.de wrote:
| Quote: | If your null modem cable forces CTS and RTS high
(most do), then hardware flow control is not going to work either.
What does this mean? How to verify if my cable is so?
|
Look what Google found:
http://www.nullmodem.com/NullModem.htm
It's been many years since I've had to deal with the horror that is
RS-232, and I'd like to keep it that way. More than twice over the
years I've watched three or more highly educated, skilled, and
experienced electrical engineers waste three or more hours trying to get
RS-232 to work *at all*, let alone for reliable binary file transfer
(OK, I'll admit, I've even participated).
I believe what you want to do can be done, if you have a proper null
modem (verify it w/ an ohmmeter), but it won't be easy. It was designed
by communications engineers. Study the man pages, use Google, good
luck. And verify MD5 checksums when (if) you think you've done it.
BTW, how did you get NetBSD partially installed in the first place?
--
Ted Spradley
Proud member of the reality-based community. |
|
| Back to top |
|
 |
Ed Ravin *nix forums beginner
Joined: 20 Jun 2005
Posts: 2
|
Posted: Mon Jun 20, 2005 10:38 pm Post subject:
Re: Primitive File Transfer with Serial Port
|
|
|
From somewhere in cyberspace, scire@web.de said:
| Quote: | If your null modem cable forces CTS and RTS high
(most do), then hardware flow control is not going to work either.
What does this mean?
|
Most null modem cables / adapters connect the CTS and RTS pins to each
other on the same end of the cable, so that both sides always see "go
ahead and transmit" status on the CTS pin. They also wire DCD to DTR
on the same end of the cable, so both sides always think the DCD pin
is high.
You should probably read over this:
http://www.netbsd.org/Documentation/Hardware/Misc/serial.html
And any other tutorials on how to use serial ports.
| Quote: | How to verify if my cable is so?
|
You can usually figure it out with a volt-ohm meter. Or you can make
a new cable to the specifications needed. You can also buy a breakout box
and use it to build an adapter that does what you want.
--
Ed Ravin | "The law, in its majestic equality, forbids the rich as
| well as the poor to sleep under bridges, to beg in the
eravin@ | streets, and to steal bread."
panix.com | --Anatole France, Le Lys Rouge [1894] |
|
| Back to top |
|
 |
David Lord *nix forums Guru Wannabe
Joined: 03 Mar 2005
Posts: 113
|
Posted: Tue Jun 21, 2005 1:14 pm Post subject:
Re: Primitive File Transfer with Serial Port
|
|
|
On 20 Jun, in article
<1119285495.351235.61030@g14g2000cwa.googlegroups.com>
scire@web.de wrote:
| Quote: | Ed Ravin schrieb:
From somewhere in cyberspace, scire@web.de said:
I used "google groups" :)
Of course it did. Use zmodem or Kermit to get the file over.
I cannot transfer them, only the serial port seems to "work".
And I want to see if this "primitive way" works, just for
trying it. So, again my questions:
(1) How to do it.
(2) How to set the defaults with stty in NetBSD (it differs
from normal Unix, from FreeBSD and from Linux.
(3) How to avoid the "silo overflow".
If this is impossible, perhaps someone could say why this is
impossible. Sorry: no floppy, no slip, no ppp, no kermint,
no zmodem, no uucp!
|
I've done this sort of thing between a Victor Vicky and Amstrad CPC.
Amstrad manual had a very simple terminal/ascii transfer program in
BASIC that I used to copy cp/m Kermit to the Vicky. I converted
binary to checksummed hex codes, used plain ascii transfer and had
already found a program installed on the Vicky that could translate
the hex to binary so after that I used Kermit. If transferring
plain ascii you can use xon/xoff protocol to send a character at a
time which is slow but reliable.
On NetBSD here the base system has 'cu' which is able to connect to
another system and provides simple file transfer. If that isn't
available on your system I'd not like to guess what is.
I can't help with stty settings as here 'man stty' brings up
identical options on FreeBSD and NetBSD.
For binary tranfers you need working hardware handshake on the
serial link and/or some program that can arrange to escape some
codes.
David
--
The Reply-To: is valid for at least 30 days after posting date
David Lord - david@lordynet.demon.co.uk |
|
| Back to top |
|
 |
jpd *nix forums Guru
Joined: 22 Feb 2005
Posts: 877
|
Posted: Tue Jun 21, 2005 8:29 pm Post subject:
Re: Primitive File Transfer with Serial Port
|
|
|
Begin <20050620181350.37603f32.tsprad+usenet@spradley.org.invalid>
On 2005-06-20, Ted Spradley <tsprad+usenet@spradley.org.invalid> wrote:
| Quote: | It's been many years since I've had to deal with the horror that is
RS-232, and I'd like to keep it that way. More than twice over the
years I've watched three or more highly educated, skilled, and
experienced electrical engineers waste three or more hours trying to get
RS-232 to work *at all*, let alone for reliable binary file transfer
(OK, I'll admit, I've even participated).
|
Feh. I've spent hours and hours because a stoopid little isa card had
all its jumpers numbered left-to-right EXCEPT the irq bank, which was
numbered in reverse. And neither clearly labeled nor documented as such.
What fun.
BTW, did you get out the 'scope? Did it help? ;-)
| Quote: | I believe what you want to do can be done, if you have a proper null
modem (verify it w/ an ohmmeter), but it won't be easy. It was designed
by communications engineers.
|
The minimal working serial connection I've seen is exactly three leads:
2, 3, and 7 (tx, rx, ground). That means no fancy things like hardware
handshaking so you're stuck with xon/xoff, but it'll do for a console or
a terminal. (Barely, but hey.)
Then again, it's true that, as OP found out the hard way, you can't just
throw bits on a line and make 'em come out right on the other side all
the time. Without magic, that works exactly nowhere; not on ethernet,
not on fibre, not even on your own hard drive. You _need_ line coding
and framing and all that.
| Quote: | Study the man pages, use Google, good
luck. And verify MD5 checksums when (if) you think you've done it.
|
That as well, indeed.
--
j p d (at) d s b (dot) t u d e l f t (dot) n l .
Happily surprised at finding an original yellow laplink cable for 0.5 EUR. |
|
| Back to top |
|
 |
Andrew Smallshaw *nix forums beginner
Joined: 23 Feb 2005
Posts: 26
|
Posted: Wed Jun 22, 2005 6:28 pm Post subject:
Re: Primitive File Transfer with Serial Port
|
|
|
On 2005-06-21, jpd <read_the_sig@do.not.spam.it.invalid> wrote:
| Quote: |
The minimal working serial connection I've seen is exactly three leads:
2, 3, and 7 (tx, rx, ground). That means no fancy things like hardware
handshaking so you're stuck with xon/xoff, but it'll do for a console or
a terminal. (Barely, but hey.)
|
There's no barely about it - this is the standard way you wire a terminal
(indeed some low-end serial cards I've seen have no connections for
hardware flow control for this very reason - though thankfully no recent
ones). The only time I've done any different is using a forth wire - not
for flow control but cross-wiring DTR from the terminal to CD on the host.
This is great if the user has an app that keeps hanging - instead of having
having to ring the sysadmin to kill that login they just switch off the
terminal for the same effect. [1]
There's no need for handware handshaking for low speed devices like
terminals.
--
Andrew Smallshaw
andrews@sdf.lonestar.org
[1] This is system dependent - under UNIX you will usually have to select
the "modem control" variant of the port for this to work - unlike the
software control (XON/XOFF) version which is the default for a terminal. |
|
| Back to top |
|
 |
Guest
|
Posted: Thu Jun 23, 2005 3:11 pm Post subject:
Re: Primitive File Transfer with Serial Port
|
|
|
First of all: thanks to anybody for the answers, I learned a lot and
spent some hours experimenting with the serial port and nullmodem
cables.
For the curious: how I half installed netbsd: thefloppy driver works
from time to time, I booted the tiny rescue floppy, did fdisk,
disklabel, mounted a swap partition (the laptop has less than 4 MB
RAM), put a tiny kernel and some files (bin, sbin, etc, ...).
I experimented with two cables, the first one so connected:
1 4
2 3
3 2
4 1
5 5
7 8
8 7
The second one so:
1 1
2 3
3 2
4 6
5 5
6 4
7 8
8 7
9 9
FOURTH QUESTION: wich of both cables is correct?
For a transfer (also with silo overflow) I need with the second cable
"stty clocal".
I also discovered that the controler of the serial port of the old
laptop does not have a fifo.
FIFTH QUESTION: is it possible to have a software FIFO?
Thanks again,
Rodrigo Readi
scire_AT_web.de |
|
| Back to top |
|
 |
FanJet *nix forums beginner
Joined: 23 Feb 2005
Posts: 8
|
Posted: Fri Jun 24, 2005 1:52 am Post subject:
Re: Primitive File Transfer with Serial Port
|
|
|
scire@web.de wrote:
| Quote: | If your null modem cable forces CTS and RTS high
(most do), then hardware flow control is not going to work either.
What does this mean? How to verify if my cable is so?
|
Since you got throughput with the setup in your original post, that's the
wiring you should use. Since you have no flow control, the key to a
successful transfer will be s-l-o-w speed - like 300 baud. Make sure the
word size is 8 bits with no parity. |
|
| Back to top |
|
 |
jpd *nix forums Guru
Joined: 22 Feb 2005
Posts: 877
|
Posted: Fri Jun 24, 2005 6:28 am Post subject:
Re: Primitive File Transfer with Serial Port
|
|
|
Begin <1119546707.294712.300540@z14g2000cwz.googlegroups.com>
On 2005-06-23, scire@web.de <scire@web.de> wrote:
| Quote: | FIFTH QUESTION: is it possible to have a software FIFO?
|
Any terminal driver will incorporate various fifo buffers, but the famed
``uart with fifo'' has a fifo to reduce the amount of hardware interrupt
events from once every byte received to once every 14 or 16 or so. That
is, the uart receives a couple of bytes and stores them a while without
signalling the OS until a certain amount is received, _then_ signals the
receival of the entire bunch. This is important as interrupts are costly
in terms of overhead. Sadly, a software buffer cannot help with that.
So, no.
--
j p d (at) d s b (dot) t u d e l f t (dot) n l . |
|
| Back to top |
|
 |
Guest
|
Posted: Tue Jun 28, 2005 1:50 pm Post subject:
Re: Primitive File Transfer with Serial Port
|
|
|
scire@web.de writes:
| Quote: | First of all: thanks to anybody for the answers, I learned a lot and
spent some hours experimenting with the serial port and nullmodem
cables.
For the curious: how I half installed netbsd: thefloppy driver works
from time to time, I booted the tiny rescue floppy, did fdisk,
disklabel, mounted a swap partition (the laptop has less than 4 MB
RAM), put a tiny kernel and some files (bin, sbin, etc, ...).
I experimented with two cables, the first one so connected:
1 4
|
??? Bad. DTR is now in the twilight of undefined (between +3V and -3V).
OK and necessary (TxD and RxD crossed).
??? See above
OK and necessary (GND == Signal ground).
OK and necessary for fullduplex (RTR[1] and CTS crossed).
| Quote: | The second one so:
1 1
|
OK, and IMO better.
DTR and DSR crossed. Hmmm... may do, but merely linking 4 and 6 on
each side and not connecting both sides may be better, and you
probably won't need clocal.
DON'T. There is no ringing involved, so leave them alone.
| Quote: | FOURTH QUESTION: wich of both cables is correct?
|
None, see above.
| Quote: | I also discovered that the controler of the serial port of the old
laptop does not have a fifo.
FIFTH QUESTION: is it possible to have a software FIFO?
|
Apart from what jpd wrote: *Theoretically* it's possible, but you'd
need a fast local CPU which is idle all of the time. I.e. no disc I/O,
....
Final advice: If it doesn't work, slower the speed down.
[1] RTS is for halfduplex connections. For fullduplex the semantics
of that pin is no longer "I am Requesting To Send!" but "I am Ready To
Receive!".
--
The first entry of Sin into the mind occurs when, out of cowardice or
conformity or vanity, the Real is replaced by a comforting lie.
-- Integritas, Consonantia, Claritas |
|
| Back to top |
|
 |
Google
|
|
| Back to top |
|
 |
|
|
The time now is Fri Jan 09, 2009 6:17 am | All times are GMT
|
|
Proxy | Free website & online homepage | Debt Consolidation | Budapest hotels | eHarmony
|
|
Copyright © 2004-2005 DeniX Solutions SRL
|
|
|
|
Other DeniX Solutions sites:
Unix/Linux blog |
electronics forum |
medicine forum |
science forum |
|
|
Privacy Policy
|
Powered by phpBB © 2001, 2005 phpBB Group
|
|