Shop OBEX P1 Docs P2 Docs Learn Events
Sharing 1-wire device DS2401 with serial line — Parallax Forums

Sharing 1-wire device DS2401 with serial line

Peter VerkaikPeter Verkaik Posts: 3,956
edited 2009-06-05 14:29 in General Discussion
I have been asked to add a Silicon Serial Number (DS2401) to an existing pcb
that has no I/O lines free.
But there is a bidirectional serial line between a SX28 and a javelin.
I had this idea:

······························ +5V
······························ ·|
········ +---+············· · [noparse][[/noparse]4k7]
········ |·3 o··············· ··|
········ |·2 o
+ DQ
·········|·1 o
+······ · |
·········+---+······· |····· ·[noparse][[/noparse]1k0]
······· DS2401(TO92)· V·········|
·····················GND······· |
JavPin o
[noparse][[/noparse]270R]--+
o SxPin

Upon power up, the JavPin remains an input for at least 4 seconds, which should
be long enough for the SX to read the DS2401. After reading, the SxPin becomes
a serial input.
After 4 seconds the JavPin becomes a high output (serial idle state).
The javelin then sends a command to the SX. Speed is 1200 baud so bittime is 833 uSec.
A low bit (startbit) will thus·act as a reset signal to the DS2401, but because of the resistor divider
1k0/270R, when·the JavPin turns high, so will the level at SxPin, regardless wether the
DS2401 has pulled down DQ (Presence Pulse).
After·sending a command, the JavPin is made a serial input waiting for a response from the SX.
If I add enough stopbits to·the javelin serial·bytes, the DS2401 Presence Pulse should be overlapped
by the JavPin being high output and turned into input. The 4k7 would keep the·level high.

Question is: would this strategy work? Or·will the DS2401 interfere with the serial· data streams?
I have no DS2401·so I haven't been able to test it yet.

regards peter

·

Comments

  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2009-06-02 18:09
    Another idea:

    ······························ +5V
    ······························ ·|
    ········ +---+············· · [noparse][[/noparse]4k7]
    ········ |·3 o··············· ··|
    ········ |·2 o
    + DQ
    ·········|·1 o
    +······ · |
    ·········+---+······· |····· ·[noparse][[/noparse]1k0]
    ······· DS2401(TO92)· |·········|
    ····················· | ······· |
    JavPin o
    +--[noparse][[/noparse]4k7]--+
    o SxPin

    Upon power up, the JavPin is made low to power the DS2401
    while the SX waits for a low level at SxPin.
    Making JavPin low should give (4k7/10k4)*5V < 2.5V, eg. low level at SxPin
    while level at DQ > 2.5V
    The SX then reads the DS2401 (reset pulse will make level at DQ < 2.5V).
    After reading the SxPin becomes a serial input.
    After 4 seconds the JavPin is made a high output (serial idle state).
    Now the javelin can send a command. The stopbit will power·off
    the DS2401 so it can not interfere.

    Is that a better approach?

    Edit: with the 4k7 at JavPin, reading the DS2401·won't work because as soon as DQ is
    released the level at SxPin drops below 2.5V
    What if I made the SxPin TTL threshold (1.4V)? That might work
    if the level stays above 1.4V until DQ is pulled low.
    Making the resistor 10k would prevent the JavPin to detect low
    when receiving serial data so the resistor must be 4k7.

    regards peter


    Post Edited (Peter Verkaik) : 6/2/2009 7:06:09 PM GMT
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-06-02 18:53
    Peter, I'd be more inclined to use a DS2411 powered by the output from a Microchip MCP101 supervisor. This will give to 150ms from powerup to read the silicon serial number before the supervisor shuts it down. That way, assuming it can't power up through its I/O pin, it'll be out of the picture.

    -Phil
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2009-06-02 19:01
    Phil,

    Unfortunately the DS2411 does not come in TO92 package
    and I really don't want any smd package.

    regards peter
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2009-06-02 19:17
    Change to the 2nd idea:

    ······························ +5V
    ······························ ·|
    ········ +---+············· · [noparse][[/noparse]4k7]
    ········ |·3 o··············· ··|
    ········ |·2 o
    + DQ
    ·········|·1 o
    +······ · |
    ·········+---+······· |····· ·[noparse][[/noparse]1k0]
    ······· DS2401(TO92)· |·········|
    ····················· | ······· |
    JavPin o
    +--[noparse][[/noparse]3k9]--+
    o SxPin

    Upon power up, the JavPin is made low to power the DS2401
    while the SX waits for a low level at SxPin.
    Making JavPin low should give (3k9/9k6)*5V = 2V, eg. low level at SxPin CMOS
    while level at DQ =·2.6V
    The SX then switches to TTL mode and reads the DS2401 (reset pulse will make level at DQ =·0.88V).
    Releasing the SxPin makes the level 2V again, but due to TTL mode this is read as high.
    After reading the SxPin becomes a serial input using CMOS mode.
    After 4 seconds the JavPin is made a high output (serial idle state).
    Now the javelin can send a command. The stopbit will power·off
    the DS2401 so it can not interfere.

    regards peter
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-06-02 20:29
    Peter,

    I'd still be inclined to incorporate a supervisor, just for simplicity and reliability. Here's a circuit that employs a Microchip MCP120. It's open-drain and holds the /RST pin low for 350ms after power-up:

    attachment.php?attachmentid=61294

    -Phil
    307 x 247 - 2K
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2009-06-05 14:29
    Today I received a DS2401 (TO92) and have setup a test with positive results.

    The test schematic looks like this:

    ' Test shared 1-wire connection
    '
    ' RA.1·
    RX USB2SER
    '
    '················· +5V
    '·················· |····· 3/nc
    '················ [noparse][[/noparse]4k7]···· |
    '·················· |···· +-+-+
    '·················· | 2/DQ|·· |
    ' RA.0· ---+-[noparse][[/noparse]270R]-+
    |·· | DS2401
    '········· |············· |·· |
    '········· |············· +-+-+
    '······· [noparse][[/noparse]1k0]············· | 1/GND
    '········· |··············· V
    '········· |
    ' RA.3· ---+· simulates 1200 baud serial out (startbit is low for 833 uSec)
    '············ The DS2401 should not detect this as OWRESET signal.
    '
    '
    ' This program scans the 1-Wire bus and when a device is detected it will
    ' read and display its serial number. Then RA.3 is pulsed low for 833 uSec
    ' and then the 1-Wire bus is scanned again but no device should be found.

    The attached program is a modified example I found in the help for OWRESET command.
    The picture shows no device is found after pulsing RA.3 low

    Pulling RA.3 low gives (1k/(1k+270R+4k7))*5V = 0.84V @RA.0
    and ((1k+270R)/(1k+270R+4k7))*5V = 1.06V @DQ
    According to the DS2401 datasheet the maximum low level at which the DS2401
    detects a resetpulse is 0.3V
    Pulling RA.0 low gives (270R/(270R+4k7))*5V = 0.27V
    and thus the DS2401 detects the owreset signal.
    After reading the serial number RA.0 can turn to serial output driving
    high and low (which overrides·DQ).

    regards peter

    Post Edited (Peter Verkaik) : 6/5/2009 2:43:39 PM GMT
Sign In or Register to comment.