Shop OBEX P1 Docs P2 Docs Learn Events
Help interfacing Prop to another device — Parallax Forums

Help interfacing Prop to another device

Little-endianLittle-endian Posts: 91
edited 2011-08-28 14:41 in Propeller 1
I'm interested in interfacing a Prop to another device and could use help understanding the best way to do this.

Here's what I received from the manufacturer about the device I'm trying to interface to:

It's a master/slave setup using single wire full-duplex w/10K pullup's tied to 3.6v. Serial data is 19.2k, 8bit, no parity, 1 start/stop, non-inverted (3.6v equals logical 1).

Any devices connecting to the interface should be open collector to prevent holding the line high while listening. If open collector is not possible a diode should be used on the TX line of every device connected on the network.

A pause of > 3 bytes must proceed any communication.

I know this device has a three wire connector on it and one wire is ground.

What I'd like to understand is how how full-duplex is accomplished with the remaining two wires? Is this an SPI interface? How can you accomplish full-duplex with one wire? I assume this is SPI and not I2C? If anyone has any links to training materials on how this communications works I'd appreciate it. Are there any objects in the OBX that would help here?

My next question is how can I interface this device to the Prop? I assume I'll need to use two pins on the prop. This device is 3.6v and the prop is 3.3v so I'm not sure what I need to do here, diode, resistor, etc. Since this device contains much higher voltages I'd ideally like to optically isolate it from the prop, but I've never done that before.

Any help is appreciated.

Comments

  • Little-endianLittle-endian Posts: 91
    edited 2011-08-27 19:19
    I think I may have found the answer to one of my questions. Based on what I've been reading on SPI and I2C it appears this device uses I2C. Would that be correct?
  • Duane DegnDuane Degn Posts: 10,588
    edited 2011-08-27 19:28
    I'm pretty sure this isn't SPI or I2C. It just good old asynchronous serial.

    FullDuplexSerial should work fine.

    One of the three lines is likely the TX line and the other the RX line. Since it's an open collector you don't need optical isolation, resistors nor diodes. Just two wires to the Props IO pins and a shared ground connection. This is probably the easiest communication protocol to use with the Prop.

    Duane
  • frank freedmanfrank freedman Posts: 1,983
    edited 2011-08-27 19:37
    I think I may have found the answer to one of my questions. Based on what I've been reading on SPI and I2C it appears this device uses I2C. Would that be correct?

    does it have a published data sheet

    Frank
  • Mike GMike G Posts: 2,702
    edited 2011-08-27 19:38
    How about posting a link to the device. Otherwise we're just guessing.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2011-08-27 19:44
    It's a master/slave setup using single wire full-duplex

    I just noticed the single wire spec. I thought full-duplex was two way communication at the same time. I don't know of any uC protocol that can do that. It's likely half-duplex that can switch directions. I still think FullDuplexSerial will work but there might be other objects that will let you use only one wire instead of two.

    Duane
  • Little-endianLittle-endian Posts: 91
    edited 2011-08-27 19:46
    Wow, thanks for the quick responses! Here's the link to the information provided by the manufacturer. I do know that multiple devices can be connected together so I believe it must be some type of bus topology. The device itself has a thee pin connector on it and they sell a USB interface that uses the FTDI chip so you can connect it to your PC for data logging and PC control. I was thinking I'd like to bypass this USB interface even though I have it, and connect the prop directly to the device itself. I was thinking of using optical isolation because the USB interface they sell has optical isolation.

    http://fmadirect.com/support_docs/item_1338.pdf
  • Duane DegnDuane Degn Posts: 10,588
    edited 2011-08-27 19:54
    Duane Degn wrote: »
    Since it's an open collector you don't need optical isolation, resistors nor diodes.

    I wanted to clarify what I wrote. You don't need any extra protection in this case because while 3.6V is higher than the Prop's normal Vdd, the 10K resistor limits the current to a safe level.

    Duane
  • Mike GMike G Posts: 2,702
    edited 2011-08-27 19:58
    The datasheet states single wire full-duplex but I think it is single wire half-duplex serial. Then you could go with FullDuplexSerial.spin and a 74HC126.

    But it could be full-duplex serial with two wires. It's not real clear but you should be able to interface the prop with basic components once you figure out what you're dealing with.
  • Little-endianLittle-endian Posts: 91
    edited 2011-08-27 20:08
    Thanks for the information. One thing I do know is that several of these devices can be connected together by connecting the wires together, I believe the max is 16 devices. Wouldn't that indicate that it would be using some sort of bus topology with an addressing scheme?
  • Little-endianLittle-endian Posts: 91
    edited 2011-08-27 20:13
    Let me add one additional comment here. I haven't up opened up this device to verify this, but I believe it's using a TI mcu. I'm thinking that the three pins on the device may go directly to the TI mcu in the device.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2011-08-27 20:14
    Mike G wrote: »
    The datasheet states single wire full-duplex but I think it is half-duplex serial. You probably go with FullDuplexSerial.spin and a 74HC126.

    Mike,

    I don't see why a 74HC126 is needed. Both the device and the Prop pull the line low to communicate. The 10K resistor on the device limits the current to a very safe level.

    A series resistor could be added to the line to safeguard against a programming error driving the line.

    This thing was made to talk with a Prop.

    Duane
  • Duane DegnDuane Degn Posts: 10,588
    edited 2011-08-27 20:24
    Thanks for the information. One thing I do know is that several of these devices can be connected together by connecting the wires together, I believe the max is 16 devices. Wouldn't that indicate that it would be using some sort of bus topology with an addressing scheme?

    The datasheet list a "Charger ID Num" as part of a message. Your message requesting information needs to include the ID of the device. I think there can be 17 possible devices on the line with ID 0 to 16.

    This has similarities to the way one communicates with Dynamixel servos.

    Duane
  • SapiehaSapieha Posts: 2,964
    edited 2011-08-27 20:31
    Hi Duane.

    If I understand this device correctly ---- TX and RX pins on Propeller need be connected together to form one wire full-duplex for this device to communicate.

    As it send and receive on same line Else Serial driver need be rewritten to support Communication on one PIN in both directions
  • Mike GMike G Posts: 2,702
    edited 2011-08-27 20:34

    I don't see why a 74HC126 is needed. Both the device and the Prop pull the line low to communicate. The 10K resistor on the device limits the current to a very safe level.

    A series resistor could be added to the line to safeguard against a programming error driving the line.

    This thing was made to talk with a Prop.
    A 74HC126 is not needed, just convenient if you're using FullDuplexSerial on a half-duplex single wire serial bus. I'll have to take a closer look at the pdf. I'm not seeing where the PowerLab 8 was designed to talk to the prop. It's been a long day.
  • Mike GMike G Posts: 2,702
    edited 2011-08-27 20:41
    Sapieha wrote:
    TX and RX pins on Propeller need be connected together to form one wire full-duplex for this device to communicate
    That's why I thought a 74HC126 (3-State bus buffer) would work nicely with FullDuplexSerial.
  • Little-endianLittle-endian Posts: 91
    edited 2011-08-27 20:42
    It's not specifically designed to talk to the prop. It a consumer electronics device. It has a three wire connector on the back of it. The manufacturer sells an optional USB interface that plugs into this three pin connector so you can connect this device to you PC so you can control it from your PC. Additionally, multiple devices can be controlled from a single USB interface. The USB interface they sell does use the FTDI chip and is optically isolated. I have their USB interface. What I'd like to do is interface the prop directly to this device w/o using their USB interface.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2011-08-27 21:10
    Duane Degn wrote: »
    This thing was made to talk with a Prop.

    Okay, it wasn't "designed" to talk to the Prop. I didn't have access to a smiley face from the "Quick Reply" box. It's just that 3.6V with a pull-up resistor is pretty darn friendly for the Prop.

    Besides, I think everything is designed to talk with a Prop. If all you have is a hammer. . . (The Prop's my hammer.) :^)

    Duane
  • Little-endianLittle-endian Posts: 91
    edited 2011-08-27 21:36
    Here's an image from the user's manual. Note the image showing how multiple devices can be connected together.

    I want to put the prop where the FUIM USB interface is and eliminate it. I'd like to have the prop control the device instead of the PC. Not going to build all the functionality of the PC into the Prop, but just some useful functionality and perhaps expand it over time.
    532 x 523 - 89K
  • Little-endianLittle-endian Posts: 91
    edited 2011-08-27 21:48
    Okay, here is the after image.
    532 x 523 - 72K
    pl8.png 71.5K
  • kwinnkwinn Posts: 8,697
    edited 2011-08-27 21:48
    I love the data sheet grammar, particularly “The master has to quarry the slave (PowerLab 8)” sentence.

    It definitely looks like 1 wire serial half duplex based on the data sheet info. I would recommend a current limiting series resistor ( about 150 – 220 ohms) between the prop and the device. There is a half duplex serial port driver in the OBEX (http://obex.parallax.com/objects/search/?csrfmiddlewaretoken=cf434c0e67ca26fa307f953e7782e5b4&q=half+duplex) that might work.
  • Little-endianLittle-endian Posts: 91
    edited 2011-08-28 14:41
    Thanks to everyone who responded. I'll wire something up and see see if I can communicate with this device.
Sign In or Register to comment.