navitron
 
Renewable Energy and Sustainability Forum
UK's most popular Renewable Energy Forum May 23, 2012, 10:07:25 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Anyone wishing to register as a new member on the forum is strongly recommended to use a "proper" email address - following recent spam/hack attempts on the forum, all security is set to "high", and "disposable" email addresses like Gmail, Yahoo and Hotmail tend to be viewed with suspicion, and the application rejected if there is any doubt whatsoever
 
Recent Articles: UPDATE ON DECC APPLICATION FOR LEAVE TO APPEAL TO THE SUPREME COURT | Yingli Green Energy's PV Module Ranks No.2 in TUV Rheinland Energy Yield Test | Navitron Solar Showers at Glastonbury for Year 5!
   Home   Help Search Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: 1-wire to serial adapter  (Read 1126 times)
KLD
Hero Member
*****
Offline Offline

Posts: 1340


« on: October 16, 2010, 07:07:01 PM »

For a year I've been using a 1-wire to USB adapter (DS9490R), accessed with owserver under Debian. For a new project at work I got a 1-wire to serial adapter, DS9097U. I really need to get it working under WinXP, but thought I'd first try it in my standard environment as above. Alas, I can't see the 9097U whatever I've tried.

In Debian, starting the owserver with
Code:
sudo owserver -u
makes the DS9490R available, owdir and owread can be used to display info about the connected sensors.

Code:
sudo owserver -d /dev/ttyS0
should do similar for the DS9097U connected to COM1. (the output of dmesg confirms thatCOM1 is mapped to ttyS0)
To no avail, owdir doesn't show anything.

I also went into WinXP, installed OneWireViewer, and again everything works fine with the DS9490R, but shows nothing with the serial adapter.

It all looks like as if I'm missing something crucial here. Anybody any pointers?

Thanks in advance
Klaus
Logged
ericw
Hero Member
*****
Offline Offline

Posts: 735


« Reply #1 on: October 16, 2010, 09:38:38 PM »

Klaus,
It looks as though not all the drivers have been installed.
This may be of help http://www.maxim-ic.com/app-notes/index.mvp/id/1740

There is a list of the files that should be there.
Eric
Logged
EccentricAnomaly
Guest
« Reply #2 on: October 16, 2010, 09:55:52 PM »

Eric, that reference is for Windows so not a lot of help on Debian.

Sorry if this is egg sucking territory, but the first thing I'd try would be:

Code:
sudo owserver -d /dev/ttyS0 --foreground

to be able to see any error messages displayed.  Next would be to look at the --error_level command line switch.

It'd also be worth checking the port mapping - strange things can happen with different system's interpretations of obscure little tables in the BIOS.  If you don't have any other serial devices you can try conveniently then you could put the port in raw mode, I have a script called raw-serial to do this:

Code:
#!/bin/bash
PORT=${1:-/dev/ttyS0}
SPEED=${2:-9600}
stty -F $PORT $SPEED raw pass8 -cstopb -crtscts clocal -echo

then send a big file to it:

Code:
cat somebigfile > /dev/ttyS0

If you have a serial break-out box then look for data with that.  If not a meter (20 V DC range) on the transmit data line (pin 3 on a 9-pin connector, 2 on a 25-pin) vs ground (pin 5 on a 9-pin, pin 7 on a 25-pin) should show different readings while the cat is in progress.

An alternative would be to wrap pins 2 and 3 together (either size connector - just touching the two pins with a key or something should do) then in two separate terminal windows do:

Code:
cat /dev/ttyS0

and

the same somebigfile cat as above.

I don't have a proper serial port to hand but have just checked the above on a USB-to-serial adapter (/dev/ttyUSB4 in my case, 0 through 3 being my mobile broadband dongle).
« Last Edit: October 16, 2010, 10:29:55 PM by EccentricAnomaly » Logged
KLD
Hero Member
*****
Offline Offline

Posts: 1340


« Reply #3 on: October 17, 2010, 01:31:12 PM »

Eric and EA

Thank you both for the input. Eric, on the Windows side of things, I had installed the drivers from the Maxim site, using their OneWireViewer package. I've re-check all the files and registry settings mentioned in the White Paper. It's all correct.

EA. The serial connector on my motherboard (Intel G41MJ) is a 5x2 pin header. In order to connect the DS9097U I've put an adapter cable on it.
Firstly, I measured the voltages of all pins against GND (pin 5). Pins 3 (TxD), 4 (DTR), and 7(RS) are high (10V), all the others low (0.06V) . I then check the serial port permissions:
Code:
crw-rw---- 1 root dialout 4, 64 Oct 17 11:43 /dev/ttyS0
and that I'm included in that group:
Code:
klaus@desktop:~$ groups
klaus dialout cdrom floppy audio video plugdev netdev bluetooth scanner powerdev
Your script help me to set the port to raw mode, and following your recipe, I was able to send and receive a big file sent to the port. So, that all seems to work Smiley

What's next?  surrender

Klaus
Logged
KLD
Hero Member
*****
Offline Offline

Posts: 1340


« Reply #4 on: October 17, 2010, 01:42:59 PM »

I think I've found the corpus delicti. The experiment EA suggested with connecting TX and RX (pins 2 and 3) where done directly on the motherboard. I repeated it using the 5x2pin IDC to 9pin D-sub adapter. It failed. Back to the mo-bo, it worked again. Opening the case of the 9pin socket on the adapter lead shows, that they simply soldered the ribbon cable wires one by one to the connector pins, instead of following the RS232 standard pinout.  fight So, instead of having pins 1-2-3-4-5 in the top row, and 6-7-8-9 in the bottom row of the 9-pin D-sub, I've got 1-3-5-7-9 and 2-4-6-8.  Out comes the soldering iron ...

Klaus

Logged
EccentricAnomaly
Guest
« Reply #5 on: October 17, 2010, 02:40:47 PM »

Ahah, I've been caught by that one before.

Nowadays the serial ports tend to be on the motherboards but in the "olden days" they were typically on separate ISA cards (along with the parallel port, games port and floppy driver).  I had (still have, I think) a couple of those cards but found that the adapter cables (from 0.1" to 9/25 pin submin D) were not interchangeable.  Some cards have the 0.1" connectors with the pin numbers following the AT standard (the 9-pin standard introduced on the IBM PC-AT, aka RS-574, not strictly RS-232) but given that they're 5x2 arrays numbered:

1 3 5 7 9
2 4 6 8 10


whereas the 9-pin D is numbered:

1 2 3 4 5
 6 7 8 9


this means the wires need to muddled around to connect corresponding pin numbers.

Especially if the 9-pin D is an insulation displacement connector this must be a right pain to manufacture so other cards just wire straight through and adopt the pin numbering on the 5x2 0.1" connector as geometry dictates.  Consequently, the adapters aren't interchangeable.

By the way, a similar problem arises with UK versions of audio type modems (i.e., not ADSL modems).  Usual American telephony uses the middle two pins (2 & 3) on 4P4C FCC connectors (sometimes known as RJ-11 or RJ-12) for the standard telephone lines.  The flat BT connectors (forgotten what they're called) use the pair immediately surrounding the middle pair (2 & 5).  The adaptor leads supplied with UK versions of modems typically have a BT plug on one end and a 4P4C on the other but they vary as to whether they use the middle two (2 & 3) or outer two (1 & 4) on the 4P4C.  This can lead to much wailing and gnashing of teeth if leads are swapped between modems.
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!