Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    I2C Issues: writing to the slave without sending a stop condition?

    Scheduled Pinned Locked Moved LoPy
    lopyi2cmpu
    6 Posts 3 Posters 2.1k Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • C Offline
      cylex
      last edited by

      Hey there!

      I'm currently trying to write a driver for the MPU 9250 9 axis accelerometer sensor. For this I need the I2C communication to work like this:

      To read the internal MPU-9250 registers, the master (LoPy) sends a start condition, followed by the I2C address and
      a write bit, and then the register address that is going to be read. Upon receiving the ACK signal from the MPU-
      9250, the master transmits a start signal followed by the slave address and read bit. As a result, the MPU-
      9250 sends an ACK signal and the data.

      In order to write the registers-address to the Sensor I wanted to make use of the function I2C.writeto(addr, buf, , stop=True). It is important that the LoPy doesn't send a stop bit, so I wanted to set the stop=False. Unfortunately this causes an error: function takes 3 positional arguments but 4 were given. The documentation says this function does only work for WiPy... Any Suggestions? Thanks!

      L robert-hhR 2 Replies Last reply Reply Quote 0
      • L Offline
        livius @cylex
        last edited by

        @cylex
        for Lopy valid documentation is:
        https://docs.pycom.io/pycom_esp32/library/machine.I2C.html#machine.I2C

        are you sure that you must disable stop?
        If i remember that there was especially requiment for minimal stop that can not be shorter then some value - i do not remember if this was 1us or something like that.
        But maybe i am wrong..

        think about people first, then computers

        1 Reply Last reply Reply Quote 1
        • robert-hhR Offline
          robert-hh @cylex
          last edited by

          @cylex said in I2C Issues: writing to the slave without sending a stop condition?:
          did you try it like that (as you posted)
          I2C.writeto(addr, buf, , stop=True)
          or that:
          I2C.writeto(addr, buf, stop=True)

          C 1 Reply Last reply Reply Quote 0
          • C Offline
            cylex @robert-hh
            last edited by

            @robert-hh the second way ...

            L 1 Reply Last reply Reply Quote 0
            • L Offline
              livius @cylex
              last edited by livius

              @cylex
              did you tried without?
              I2C.writeto(addr, buf)

              i2c in Lopy (pycom) have not stop paramter
              But in this particular device it should work without problem without that parameter...

              think about people first, then computers

              C 1 Reply Last reply Reply Quote 0
              • C Offline
                cylex @livius
                last edited by cylex

                @livius the reason why I wanted to use the Other function is having Control of the stop Bit.
                I know "your" function Works, but does it Send a stop Bit When it's done?
                Thank you for your help!

                1 Reply Last reply Reply Quote 0

                Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                With your input, this post could be even better 💗

                Register Login
                • 1 / 1
                • First post
                  Last post

                Pycom on Twitter

                Pycom