Shop OBEX P1 Docs P2 Docs Learn Events
Javelin as I2C Slave? — Parallax Forums

Javelin as I2C Slave?

theoatvecnatheoatvecna Posts: 20
edited 2005-04-05 22:12 in General Discussion
I would like my javelin to act as an I2C slave. Is this possible and if so, is there any existing code?

Thanks,
Daniel

Comments

  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2005-03-26 21:13
    Cannot be done.

    The only way to have the javelin be a slave device

    is by using the Uart VP (javelin can receive data in the background).

    regards peter
  • theoatvecnatheoatvecna Posts: 20
    edited 2005-03-27 00:10
    I don't really understand your comment about Uart. Are you saying that there is no way for the javelin to be an I2C slave, but it can be a Uart slave?

    What I want to do is to control multiple javelins (about 6) from a single CPU (using an aardvark usb->I2C/SPI adapter) on a single bus.

    Am I just out of luck or is there a way this can be accomplished on a single bus?

    Any suggestions?

    thanks,
    Daniel
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-03-27 00:37
    I agree with Peter in that the Javelin is probably not fast enough to do the bit-manipulation required to be an I2C slave ... unless your I2C buss is running very very slow. But, you can multidrop a number of controllers on a serial buss, and that's where the UART VP comes in.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas, TX· USA
  • theoatvecnatheoatvecna Posts: 20
    edited 2005-03-27 01:57
    Can you educate me a bit? UART stands for what, and can it talk SPI? I know it can talk RS232 through a level shifter.
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-03-27 03:57
    Universal Asynchronous Receiver Transmitter -- the asynchronous part means only one wire, wherease SPI and I2C are synchronous schemes that have separate clock and data signals. So, no, you cannot use a UART in an SPI system.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas, TX· USA
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2005-03-27 08:21
    What you can do is use an usb->RS485 or usb->RS232 adapter + RS485 dongle

    instead of usb->I2C.

    The RS485 is a multidrop connection, requiring two wires A and B.

    So instead of a bus with SDA and SCL (I2C) you get a bus with A and B (RS485)



    The MAX487 is a halfduplex RS485 chip (dip8) that requires

    two pins from the javelin (data and direction). The Uart VP is

    used to control the max487.

    regards peter
  • theoatvecnatheoatvecna Posts: 20
    edited 2005-03-27 13:32
    Thanks for the specific advice. Is there a rs232->rs485 converter that you would recommend? The host computer is linux, but I assume that no special software is required when converting 232 to 485, is that correct?
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2005-03-27 14:51
    look here

    http://byterunner.com/byterunner/new_frontpage=usbcom

    They offer several converters and I believe these all use FTDI chips

    (which is the chip Parallax advises) and they have direct Linux support.

    regards peter
  • theoatvecnatheoatvecna Posts: 20
    edited 2005-03-27 21:07
    I don't see any rs232 to rs485 converters on that site, but perhaps I am just not looking in the right place..
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2005-03-27 21:25
    There aren't. You mentioned an USB->I2C/SPI adapter.

    That page shows USB->RS485.

    Here are rs232 to rs485 adapters:

    http://scmstore.com/english/adap485/

    regards peter
  • theoatvecnatheoatvecna Posts: 20
    edited 2005-04-05 17:28
    Thanks peter. I got the rs232->rs485 converter you suggested from scm. It has 4 wire connectors on the rs485 side. A,B,-5,+5 . I searched some of the other posts for rs485, but havn't quite figured out the details of how to make this all work. Could you give me a quick rundown, or point me to a howto? I need to communicate with 4 javelins from my rs232 on my laptop.
    Thanks
    Daniel
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2005-04-05 20:29
    Daniel,

    The A and B terminal are the RS485 bus. All Javelins have a RS232 (Javelin side) to RS485 (AB-bus)

    converter. Tie all A's together, and also all B's.

    Then you must give each Javelin a unique ID, for example 'A' to 'D' for 4 javelins.

    Then you must decide on a protocol.

    For example, start each message with a '!' followed by the target id and origin id.

    So·javelin 'A' would send '!','B','A',"message string",<CR>

    to send a message to javelin 'B'.

    You may find this interesting:

    http://members.home.nl/bzijlstra/software/communication/Benbus.htm

    regards peter
  • theoatvecnatheoatvecna Posts: 20
    edited 2005-04-05 21:10
    So do I need to do anything with the -/+5v connections coming out of the rs485 converter? Do I need to tie grounds together or anything like that?
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2005-04-05 22:12
    It is wise to connect all grounds together to reduce noise.
    The manual of the converter should explain the use
    of the +5V and -5V terminals.

    regards peter
    ·
Sign In or Register to comment.