Shop OBEX P1 Docs P2 Docs Learn Events
SX/B I2C slave mode — Parallax Forums

SX/B I2C slave mode

RsadeikaRsadeika Posts: 3,839
edited 2008-08-19 14:27 in General Discussion
Has anybody come up with any ideas as to how to use I2C slave mode, using SX/B? I thought I remember some discussion about this, but do not recall if anybody made any progress. I checked the SX/B commands, but that only deals with master mode, would be nice if it had a slave mode.

Thanks

Ray

Comments

  • ChetChet Posts: 150
    edited 2008-08-18 22:39
    Have you tried "Use I2C slave Virtual Peripheral" on the Paralllax page http://www.parallax.com/tabid/460/Default.aspx



    I have the code at home and will post it later.· I have not tried it however.



    Regards



    Chet

    Post Edited (Chet) : 8/18/2008 10:45:40 PM GMT
  • RsadeikaRsadeika Posts: 3,839
    edited 2008-08-18 22:49
    What you are refering to is the asm code, correct? I do not have the knowledge to incorporate that code into an SX/B format program, that would be something that JonnyMac, the expert, may want to take on. I was thinking that since I am talking about slave mode, a VP may not be necessary, just a sub may suffice.
  • ChetChet Posts: 150
    edited 2008-08-18 23:01
    These are the files I have,· They came with the UART/I2C board.· I have tried it on the board as it came, but I have not experimented with it.· If the slave processor can look for it's information on the bus via some handshaking, then the I2C commands should be doable in SX/B.· There are some examples scattered around with handshaking like !ABC ....· where the !ABC is the slave device address.

    Good luck.

    Chet
  • JonnyMacJonnyMac Posts: 9,215
    edited 2008-08-19 05:27
    I looked into creating straight-up I2C slave subroutines/functions -- not a good idea; if the I2C master blows up in the middle of a command you'll get hung up. The ISR version is really the only safe way to go. At the moment, I have no pressing need to use the SX as an I2C slave, but if I find a need I'll take Guenther's code and package it in an SX/B demo.
  • Sens-a-DatSens-a-Dat Posts: 44
    edited 2008-08-19 14:02
    In my opinion, it really is not that hard for the I2C Slave to deal with the I2C Master blowing up in the middle of the communication. One just simply needs to put a time limit for the Slave to see a change in the SCLK signal. If the time limit is exceeded the Slave shall deem the transmission to be faulty and thus go about its prior business.
  • JonnyMacJonnyMac Posts: 9,215
    edited 2008-08-19 14:27
    Good point; and probably easier to manage in an interrupt.
Sign In or Register to comment.