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

    WiPy LoPy I2C with ATMEGA

    Scheduled Pinned Locked Moved MicroPython
    wipy 2.0lopyi2c
    5 Posts 3 Posters 1.7k 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
      constantinos
      last edited by constantinos

      I tried to to connect my LoPy with an Arduino Pro Mini @ 8MHz 3.3V via I2C. The results were not the expected.

      The reason I want to do this, is that I must count pulses from various devices. ESP8266 and ESP32 are not stable with ISR so I decided to keep the ATMEGA with the bug free hardware interrupts at PINS 2,3. Currently I use Software Serial with UART and it works just fine. But I would like to go further using I2C.

      I tested the solution but it didn't work. I was getting wrong bytes from time to time and that's why the setup is considered as not reliable.

      Does anybody managed to achieve this?

      Thanks
      Constantinos

      L J 2 Replies Last reply Reply Quote 0
      • L Offline
        livius @constantinos
        last edited by

        @constantinos
        Maybe because I2C is still software implementation...

        think about people first, then computers

        1 Reply Last reply Reply Quote 0
        • J Offline
          jmarcelino @constantinos
          last edited by

          @constantinos
          Have you tried lowering your I2C speed (baurate= init parameter)?

          Also how long is your cable? You can try adding external pull-up (to 3.3V) resistors too (maybe 4.7K)

          C 1 Reply Last reply Reply Quote 0
          • J Offline
            jmarcelino
            last edited by jmarcelino

            Are you using the Arduino libraries with your ATMEGA? If so those enable AVR's internal pull-ups too, so you have two devices enabling weak, not really up to the job, pull-ups at both ends. I guess it's very possible the bus isn't really running on spec doing that.

            I don't know if you can disable the pull-ups on the Arduino or Pycom side, but maybe worth investigating.

            Edit : On the Arduino side you should be able to

              digitalWrite(SDA, 0);
              digitalWrite(SCL, 0);
            

            After calling Wire.begin to disable the pull-ups? Maybe that could help.

            1 Reply Last reply Reply Quote 1
            • C Offline
              constantinos @jmarcelino
              last edited by

              @jmarcelino Cables are really very short. Can't be shorter... Baud rate is 100000. I tried different baud rates but this value seems to be the correct.

              I will try the pullup resistors today

              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