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

    Reading BNO055

    Scheduled Pinned Locked Moved WiPy 2&3
    bno055i2ci2c bus error
    13 Posts 5 Posters 3.0k Views 6 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.
    • F Offline
      fehlfarbe
      last edited by

      Hi,

      I have a WiPy2 with firmware 1.10.0.b4 and want to read data from BNO055 (Adafruit breakout board) via I2C but I always get I2C errors or the device isn't detected. The library is from: https://bitbucket.org/thesheep/micropython-bno055/src

      The device is connected as follows:

      WiPy2 ------ BNO055
      3V3 ---------- Vin
      P9 ------------- SDA
      P10 ----------- SCL
      GND --------- GND

      This is my code:

      from machine import Pin, I2C
      import time
      
      i2c = I2C(0, I2C.MASTER, baudrate=1000)
      print(", ".join([hex(addr) for addr in i2c.scan()]))
      s = BNO055(i2c)
      while True:
          print("t", s.temperature())
          print("euler", s.euler())
          print("mag ", s.magnetometer())
          time.sleep_ms(1000)
      

      I tried different baudrates as well but the device is not detected or the library raises an I2C bus error at i2c.readfrom_mem(self.address, register, size):

      Traceback (most recent call last):
        File "<stdin>", line 126, in <module>
        File "<stdin>", line 47, in __init__
        File "<stdin>", line 92, in init
        File "<stdin>", line 109, in reset
        File "<stdin>", line 108, in reset
        File "<stdin>", line 105, in reset
        File "functools.py", line 5, in _partial
        File "<stdin>", line 64, in _register
        File "<stdin>", line 52, in _registers
      OSError: I2C bus error
      

      I tried I2C with an PCA9685 based PWM board and it's working well.
      Any ideas?

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

        @fehlfarbe
        Did you tried with standard baudrate 100000?

        think about people first, then computers

        F 1 Reply Last reply Reply Quote 0
        • F Offline
          fehlfarbe @livius
          last edited by

          @livius yes, I tried 1000, 100000 and 400000 but it's always the same problem. Once, the device returned at least zero values for temperature and so on and then it raised an I2C bus error.

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

            @fehlfarbe
            if you really do not need to have recent firmware on Wipy2
            then the most stable for me is 1.7.2.b1 - try downgrade or upgrade

            think about people first, then computers

            F 1 Reply Last reply Reply Quote 0
            • robert-hhR Offline
              robert-hh @fehlfarbe
              last edited by

              @fehlfarbe What does i2c.scan() return, after you have initialized the interface?

              F 1 Reply Last reply Reply Quote 0
              • F Offline
                fehlfarbe @livius
                last edited by

                @livius I downgraded to WiPy-1.7.9.b3 - no change.

                L 1 Reply Last reply Reply Quote 0
                • F Offline
                  fehlfarbe @robert-hh
                  last edited by

                  @robert-hh sometimes it returns the adress of the device 0x28, sometimes it returns nothing.

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

                    @fehlfarbe

                    I downgraded to WiPy-1.7.9.b3 - no change.

                    1.7.2.b1 ;-)

                    but how looks like your wiring?
                    Do you have some pullups? Maybe internal puulups on the board BNO055?

                    think about people first, then computers

                    F 1 Reply Last reply Reply Quote 0
                    • F Offline
                      fehlfarbe @livius
                      last edited by

                      @livius oldest firmware available at https://forum.pycom.io/topic/517/downgrading-firmware-advanced-users/20 is 1.7.9.b3

                      Wiring:
                      0_1517769876999__MG_5237.JPG

                      The breakout board has 10k pullups on SDA/SCL. I tried a second board but same problem :)

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

                        @fehlfarbe said in Reading BNO055:

                        oldest firmware available

                        just change numbers in the link
                        https://software.pycom.io/downloads/WiPy-1.7.2.b1.tar.gz

                        I see on the BN0055 there are 10k pullup resistors - should be ok because there are shifter on BS138.

                        think about people first, then computers

                        1 Reply Last reply Reply Quote 0
                        • I Offline
                          incognico
                          last edited by

                          Maybe try adding some lower value pullup resistors.

                          From the FAQ page of your device BNO055 FAQ #4

                          "Depending on your system setup, you might need to adjust the pullups on the SCL and SDA lines to be a bit stronger. The BNO055 has very tight timing requirements on the I2C bus, requiring short setup and rise times on the signals. By default the breakout board has 10K pullups, which might be too weak on some setups."

                          F B 2 Replies Last reply Reply Quote 0
                          • F Offline
                            fehlfarbe @incognico
                            last edited by

                            @incognico I tried different pullups from 1.2k to 10k but there is no change. The device works flawless on my OrangePi Zero (ARM device) with 3.3V logic level.

                            1 Reply Last reply Reply Quote 0
                            • B Offline
                              brotherdust @incognico
                              last edited by

                              @incognico said in Reading BNO055:

                              Maybe try adding some lower value pullup resistors.

                              From the FAQ page of your device BNO055 FAQ #4

                              "Depending on your system setup, you might need to adjust the pullups on the SCL and SDA lines to be a bit stronger. The BNO055 has very tight timing requirements on the I2C bus, requiring short setup and rise times on the signals. By default the breakout board has 10K pullups, which might be too weak on some setups."

                              I had a similar problem. I'm not sure if it's been fixed or not, because I haven't tested it lately. Anyway, it had to do with I2C Clock Stretching. For me the solution was to set the I2C baud rate as low as it would go and work my way up until i found the fastest value that worked. Maybe give that a try, if you haven't already. =)

                              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