Shop OBEX P1 Docs P2 Docs Learn Events
does I2C speed matching matters? — Parallax Forums

does I2C speed matching matters?

KelvinLKelvinL Posts: 15
edited 2009-04-29 16:01 in BASIC Stamp
Hi
I am trying to ease my working on interfacing a Multi-touch Panel by the·leverage of PBASIC's I2C command using BS2pe. But·I can't get controller's respond after many tried.

The target controller is in slave mode and with 400 Kbit/s transfer rate. I noticed that BS2pe has transfer rate at 45kBit/s as discribed in PBASIC Syntax guide. Can't find any information talking about the speed match.

Please anyone give me a hint about whether the speed matching is important and should·I keep trying using BS2pe?

I even tried to use·bit bashing, but failed still.

Thank you for·giving me any help.·

Comments

  • Carl HayesCarl Hayes Posts: 841
    edited 2009-04-15 00:55
    Basically, it is possible to go too fast, but it is not possible to go too slow.

    All of the timing on an I2C, or I2C, bus is based upon the edges· -- that is, the rises and falls, of the signal on the·SCL line.· The requirement is (1) that these rises and falls not occur too close to each other, and (2) that the SDA line be steady (not changing) when the SCL line changes, and the SDA must stay steady for at least some minimum time after a change in SCL.

    Changes on the SCL are signals from the master to the slave to do something (read a bit from SDA, or place a bit on SDA for the master to read).· As long as there is time to react, the communication will work OK; then nothing else will happen until SCL changes state again, even if it takes a week for the master to get around to changing it.

    So you can go too fast, but you can't go too slow.· All of the timing is controlled by the master, so there is nothing to match.· That is, there is only one timing signal, not two, so "speed matching" has no meaning.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    · -- Carl, nn5i@arrl.net
  • KelvinLKelvinL Posts: 15
    edited 2009-04-28 18:48
    Thank you Carl, it's really help to understand the relation between Master and Slave.
    As you explaination, the BS2 I2COut command should be working, since it's an high level function call, then·I don't have to write the protocal myself.
    I was wondering·why·I can't get the slave·respond. Perheps the wrong addressing?

    As in the·document for touch panel controller, it describes that the slave has a 7 bits address code of 0x41...
    and with additional Read/Write bit behind to form·the first byte when sending to slave.



    what i am confusing is·... whether the 7 bits address 0x41 means ...

    1)· 0100 001, so need only append the latest·R/W bit to become 0100 0010=0x42(for read)

    2)· 100 0001, so need to shift 1 bit left and then append R/W bit to become 1000 0010=0x82(for read)

    the Attached bitmap is it's command depiction for retriving X-Y coordinates.

    attachment.php?attachmentid=60473

    Hope to have your hint again. Thank you.













    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Kelvin Liao

    Post Edited (KelvinL) : 4/28/2009 6:54:13 PM GMT
    721 x 212 - 22K
  • Carl HayesCarl Hayes Posts: 841
    edited 2009-04-28 18:54
    Your option (1) appears correct to me.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    · -- Carl, nn5i@arrl.net
  • Carl HayesCarl Hayes Posts: 841
    edited 2009-04-29 00:16
    If the slave doesn't respond at all, one must look at more than just the programming. For example, do you have pullup resistors (1K or 10K or so) from the SCL and SDA to the +5v?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    · -- Carl, nn5i@arrl.net
  • KelvinLKelvinL Posts: 15
    edited 2009-04-29 07:44
    Carl Hayes said...
    If the slave doesn't respond at all, one must look at more than just the programming. For example, do you have pullup resistors (1K or 10K or so) from the SCL and SDA to the +5v?

    Hi Carl·

    · Yes certainly, I do applied resistors for pulling up.
    · Do you suggest me to "scan" all the possibile addresses to check its response?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Kelvin Liao
  • ZootZoot Posts: 2,227
    edited 2009-04-29 14:51
    Something doesn't sound quite right here.
    said...

    1) 0100 001, so need only append the latest R/W bit to become 0100 0010=0x42(for read)

    2) 100 0001, so need to shift 1 bit left and then append R/W bit to become 1000 0010=0x82(for read)

    I would think the second format would be correct (certainly not the first). Generally I2C addresses must be "even" -- so that bit 0 is "free" to be the read/write bit. If the "7-bit" address is $41, then I would presume the "real" address of the device is $82, and $83 would be used for reads.

    Can you attach a datasheet for the device?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST

    1uffakind.com/robots/povBitMapBuilder.php
    1uffakind.com/robots/resistorLadder.php
  • vaclav_salvaclav_sal Posts: 451
    edited 2009-04-29 16:01
    Addressing using option 2 is correct, that the shift left will fill the bit 0 with 0 and you have a read command.
    ( Sorry for wrong terminology here - I met the·combination of address and read / write as you know - edited )
    I had trouble with the start condition. Make sure to set the·initial state first and than do the pulse change.
    I assume you not getting the ACK· ( A ) after you send the command, correct?
    PS I could send or post my code for I2C interface to TAOS chip.
    Cheers Vaclav


    Post Edited (vaclav_sal) : 4/29/2009 4:06:45 PM GMT
Sign In or Register to comment.