Loading ...
Sorry, an error occurred while loading the content.
 

AVR and BitBang TWI

Expand Messages
  • The Earl
    I have a friend that is trying to talk to his Wiimote. The Wiimote uses I2C at 400Khz. He wants to be able to talk to 2 at the same time. The hardware TWI will
    Message 1 of 6 , Jul 2, 2007
      I have a friend that is trying to talk to his Wiimote. The Wiimote uses I2C
      at 400Khz. He wants to be able to talk to 2 at the same time. The hardware
      TWI will work for one, but he will need to bit-bang the other.

      Questions:
      Is this possible on a Mega16/32?
      How fast would the CPU clock need to be to keep up w/ 2 x 400Khz?
      Do you know of any existing code for the Mega16/32?
      Is it possible to run the SW a bit slower than the standart 400Khz, but not
      at 'low speed', something like 200Khz? Would that confuse an I2C slave?

      I have poked around at avrfreaks, but nothing jumped out at me.


      Something like:
      http://www.windmeadow.com/node/42

      Thanks
      Barrie


      [Non-text portions of this message have been removed]
    • dlc@frii.com
      Since both of these will have the same I2C address they can t live together, but is there a pin that can be used to disable one of them at a time so that
      Message 2 of 6 , Jul 2, 2007
        Since both of these will have the same I2C address they can't live
        together, but is there a pin that can be used to "disable" one of them at
        a time so that they can live on the same bus at the same time?

        DLC

        > I have a friend that is trying to talk to his Wiimote. The Wiimote uses
        > I2C
        > at 400Khz. He wants to be able to talk to 2 at the same time. The hardware
        > TWI will work for one, but he will need to bit-bang the other.
        >
        > Questions:
        > Is this possible on a Mega16/32?
        > How fast would the CPU clock need to be to keep up w/ 2 x 400Khz?
        > Do you know of any existing code for the Mega16/32?
        > Is it possible to run the SW a bit slower than the standart 400Khz, but
        > not
        > at 'low speed', something like 200Khz? Would that confuse an I2C slave?
        >
        > I have poked around at avrfreaks, but nothing jumped out at me.
        >
        >
        > Something like:
        > http://www.windmeadow.com/node/42
        >
        > Thanks
        > Barrie
        >
        >
        > [Non-text portions of this message have been removed]
        >
        >
        >
        > Visit the SRS Website at http://www.seattlerobotics.org
        > Yahoo! Groups Links
        >
        >
        >
        >
      • The Earl
        Exactly.. He needs to put his AVR as the master to one device and the slave of the other, between the devices. Since his chip only has one HW TWI, he will need
        Message 3 of 6 , Jul 2, 2007
          Exactly..

          He needs to put his AVR as the master to one device and the slave of the
          other, between the devices. Since his chip only has one HW TWI, he will need
          to create a SW TWI. The question I have is how feasible that is at 2 x
          400Khz.

          On 7/2/07, dlc-at-frii.com |6812-the| <...> wrote:
          >
          > Since both of these will have the same I2C address they can't live
          > together, but is there a pin that can be used to "disable" one of them at
          > a time so that they can live on the same bus at the same time?
          >
          > DLC
          >
          > > I have a friend that is trying to talk to his Wiimote. The Wiimote uses
          > > I2C
          > > at 400Khz. He wants to be able to talk to 2 at the same time. The
          > hardware
          > > TWI will work for one, but he will need to bit-bang the other.
          > >
          > > Questions:
          > > Is this possible on a Mega16/32?
          > > How fast would the CPU clock need to be to keep up w/ 2 x 400Khz?
          > > Do you know of any existing code for the Mega16/32?
          > > Is it possible to run the SW a bit slower than the standart 400Khz, but
          > > not
          > > at 'low speed', something like 200Khz? Would that confuse an I2C slave?
          > >
          > > I have poked around at avrfreaks, but nothing jumped out at me.
          > >
          > >
          > > Something like:
          > > http://www.windmeadow.com/node/42
          > >
          > > Thanks
          > > Barrie
          > >
          > >
          > > [Non-text portions of this message have been removed]
          > >
          > >
          > >
          > > Visit the SRS Website at http://www.seattlerobotics.org
          > > Yahoo! Groups Links
          > >
          > >
          > >
          > >
          >
          >
          >


          [Non-text portions of this message have been removed]
        • Richard Greenway
          Depending on the slave i2c devices, most have a rated speed of DC-400kHz or so. you can run the clock at virtually anything. We often do this with products
          Message 4 of 6 , Jul 2, 2007
            Depending on the slave i2c devices, most have a rated speed of DC-400kHz
            or so. you can run the clock at virtually anything. We often do this
            with products when communicating with an i2c device at a different
            potential through very slow optocouplers.

            Richard
            www.fenchurch.org



            On Tue, 2007-07-03 at 09:55 -1000, benedict-list@... wrote:
            > Procyon AVRlib has a bit-banged I2C interface. Might give that a try. I
            > realize this would complicate the design, but another work-around would be
            > to dedicate an ATtiny to each I2C device and have the two of them talk to
            > a master AVR via the SPI bus. Just a thought.
            > >>> not
            > >>> at 'low speed', something like 200Khz? Would that confuse an I2C slave?
            > >>>
            > >>> I have poked around at avrfreaks, but nothing jumped out at me.
          • Dave Hylands
            ... If you really need 400 kHz, you can get an i2c switch, like the PCA9546A. Or something like the MAX325 as described in this appnote:
            Message 5 of 6 , Jul 2, 2007
              On 7/2/07, Richard Greenway <bj153@...> wrote:
              > Depending on the slave i2c devices, most have a rated speed of DC-400kHz
              > or so. you can run the clock at virtually anything. We often do this
              > with products when communicating with an i2c device at a different
              > potential through very slow optocouplers.

              If you really need 400 kHz, you can get an i2c switch, like the PCA9546A.

              Or something like the MAX325 as described in this appnote:
              <http://www.maxim-ic.com/appnotes.cfm/appnote_number/1073>

              --
              Dave Hylands
              Vancouver, BC, Canada
              http://www.DaveHylands.com/
            • benedict-list@hawaii.rr.com
              Procyon AVRlib has a bit-banged I2C interface. Might give that a try. I realize this would complicate the design, but another work-around would be to
              Message 6 of 6 , Jul 3, 2007
                Procyon AVRlib has a bit-banged I2C interface. Might give that a try. I
                realize this would complicate the design, but another work-around would be
                to dedicate an ATtiny to each I2C device and have the two of them talk to
                a master AVR via the SPI bus. Just a thought.

                Tom

                On Mon, 2 Jul 2007, The Earl wrote:

                > Exactly..
                >
                > He needs to put his AVR as the master to one device and the slave of the
                > other, between the devices. Since his chip only has one HW TWI, he will need
                > to create a SW TWI. The question I have is how feasible that is at 2 x
                > 400Khz.
                >
                > On 7/2/07, dlc-at-frii.com |6812-the| <...> wrote:
                >>
                >> Since both of these will have the same I2C address they can't live
                >> together, but is there a pin that can be used to "disable" one of them at
                >> a time so that they can live on the same bus at the same time?
                >>
                >> DLC
                >>
                >>> I have a friend that is trying to talk to his Wiimote. The Wiimote uses
                >>> I2C
                >>> at 400Khz. He wants to be able to talk to 2 at the same time. The
                >> hardware
                >>> TWI will work for one, but he will need to bit-bang the other.
                >>>
                >>> Questions:
                >>> Is this possible on a Mega16/32?
                >>> How fast would the CPU clock need to be to keep up w/ 2 x 400Khz?
                >>> Do you know of any existing code for the Mega16/32?
                >>> Is it possible to run the SW a bit slower than the standart 400Khz, but
                >>> not
                >>> at 'low speed', something like 200Khz? Would that confuse an I2C slave?
                >>>
                >>> I have poked around at avrfreaks, but nothing jumped out at me.
                >>>
                >>>
                >>> Something like:
                >>> http://www.windmeadow.com/node/42
                >>>
                >>> Thanks
                >>> Barrie
                >>>
                >>>
                >>> [Non-text portions of this message have been removed]
                >>>
                >>>
                >>>
                >>> Visit the SRS Website at http://www.seattlerobotics.org
                >>> Yahoo! Groups Links
                >>>
                >>>
                >>>
                >>>
                >>
                >>
                >>
                >
                >
                > [Non-text portions of this message have been removed]
                >
                >
                >
                > Visit the SRS Website at http://www.seattlerobotics.org
                > Yahoo! Groups Links
                >
                >
                >
                >
              Your message has been successfully submitted and would be delivered to recipients shortly.