On Tuesday 14 February 2006 02:12 pm, Marc Lavallée wrote:
> Le 13 Février 2006 15:03, Jan Kandziora a écrit :
> > Am Montag, 13. Februar 2006 19:46 schrieb Marc Lavallée:
> > > I'm new to the 1-wire technology.
> > >
> > > I'd like to interface over 30 DS2408 on a 1-wire bus, using ordinary
> > > ethernet cables, arranged in a topology of 2 or 3 branches with 10 or
> > > 15 daisy-chained devices.
> >
> > Branches are a big problem for the onewire hardware. According to
> > Dallas'/Maxim's own investigations, it's best to avoid star-bus
> > topologies at all cost. You have three options:
> >
> > 1. Change the star-bus into a looped-bus topology: Use four wires per
> > cable, two for the forward-direction to the branch end, two for the
> > reverse direction back to the root and connect it there with the forward
> > direction of the next brach.
>
> Maybe I would understand better with a schematic.
>
> > 2. Use the DS2409 chip and switch branches.
This would be a rather slow solution for polling. The Link-Hub has electrical 
partitioning but a unified bus topology that would be a little faster.
>
> Something like:
> http://www.hobby-boards.com/catalog/product_info.php?products_id=1511
> ?
>
> > 3. Use several host adapters.
>
> Is OWFS able to manage several adapters?
Absolutely! You can have OWFS connect to the several adapters, and it will 
give a unified view, as well as (optionally) a separated view.
I.e. you can call
owfs /dev/ttyS0 /dev/ttyS1 /dev/ttyS2 /1wire
Then
'ls 1wire/29.*' to get all the DS2408 adapters (0x29 is the family code)
or
'ls 1wire/bus.0/29.*' to get the DS2408s on the first adapter.

You can also run several instances of OWFS:
owfs /dev/ttyS0 /1wire/Line0
owfs /dev/ttyS1 /1wire/Line1
owfs /dev/ttyS2 /1wire/Line2

and 'ls /1wire.Line?/29.*' to get a unified view or address each directory 
(and thus owfs instance and adapter) independently.

Note, in all these cases, the adapter can be serial, USB, or remote (via 
owserver).

This last method might be a little faster, but only works for the filesystem 
interface. We don't currently allow more than one OWFS instance for the 
language bindings.

>
> > It's really hard to monitor keypresses that way with a non-realtime OS.
> > Networked peripherals makes things even worse.
> >
> > You have to do it by hardware. The simplest idea is to use the edge
> > detector circuits built into the DS2408. That will give you a "button was
> > pressed since last check" signal for each button.
>
> That might be enough. If it's not, then I can add a hardware latch in the
> circuit (a flip-flop?), because what I need to know is which key was
> pressed first.
>
> Paul Alfille wrote:
> > I was incorrect in my earlier note about the polling frequency. The
> > DS2408 has a latch, accessible through OWFS, that will save the button
> > press. This will greatly diminish the chance of missing a button press
> > and reduce the polling frequency.
>
I looked at the documentation, and it's even better than I remembered. There 
is  an alarm state triggered by a change in any of the pins.

# loop through all switches
for x in /1wire/29.* ; do
  # trigger if any latch (better check this)
  echo "133333333" > $x/set_alarm 

  # set non-conducting to allow sensing
  echo "0" > $x/PIO.BYTE 
done

#Loop forever
while : ; do
  # Loop through alarms
  for x in /1wire/alarm/29.* ; do
    # Run a program with the switch name and the Latch state (button presses)
    ProcessSwitch `basename $x` `cat $x/latch.BYTE`

    # Reset the latches and clear the alarm
    echo "1" > $x/latch.BYTE
  done

  #optional pause
done

The advantage of this is that you will only see the triggered switches (only 
they appear in the alarm directory) and the latches make catching button 
presses easier. The only limits are now the latency between finding a button 
press and giving feedback.

Note that this scheme lends itself very well to partitioning. Several 
instances of script/owfs/adapter can each run simultaneously. Only the 
"ProcessSwitch" function has to worrt about locking shared resources.

The /1wire directory can be accessed by other processes at the same time to 
give feedback, monitor temperatures or whatever. 


> That seems to be the most elegant solution but I still don't understand how
> it works.  At this point I should order a 1-Wire interface and a few 2408
> in order to experiment.
>
Yup, that's the best idea. The DS9090K kit comes with a USB adapter, a little 
wiring area, and a selection of chips. $65
> --

Paul Alfille


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid3432&bid#0486&dat1642
_______________________________________________
Owfs-developers mailing list
Owfs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/owfs-developers

Reply via email to