🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Error writing to I2C bus

    Scheduled Pinned Locked Moved General
    19 Posts 5 Posters 14.8k Views 1 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.
    • S Offline
      Surya @ajb2k3
      last edited by

      @ajb2k3

      I appreciate your input! Could you please share the link or specify the topic name related to the example you mentioned in the Project zone? I'm interested in diving deeper.

      ajb2k3A 1 Reply Last reply Reply Quote 0
      • ajb2k3A Offline
        ajb2k3 @Surya
        last edited by ajb2k3

        @surya https://uiflow2.m5stack.com/?pkey=c1c7d2ca888b497aab31505e1091adc6

        Another member on the forum was having difficulties so I shared the code I use for sending data over MQTT to my private server hosted on a CM4Stack.

        UIFlow, so easy an adult can learn it!
        If I don't know it, be patient!
        I've ether not learned it or am too drunk to remember it!
        Author of the WIP UIFlow Handbook!
        M5Black, Go, Stick, Core2, and so much more it cant be fit in here!

        S 1 Reply Last reply Reply Quote 0
        • S Offline
          Surya @ajb2k3
          last edited by

          @ajb2k3

          Thank you so much for sharing your work!

          Earlier, I successfully sent data over MQTT to AWS IoT Core in UIFlow2. However, in UIFlow2, I couldn't find a way to establish a (DHCP) Ethernet connection to AtomS3 using AtomPoE Base. That's why I decide to develop the code using PlatformIO. Do you have any reference Micropython script for an Ethernet connection?

          1 Reply Last reply Reply Quote 0
          • ajb2k3A Offline
            ajb2k3
            last edited by

            Alas no as I don’t have one of those

            UIFlow, so easy an adult can learn it!
            If I don't know it, be patient!
            I've ether not learned it or am too drunk to remember it!
            Author of the WIP UIFlow Handbook!
            M5Black, Go, Stick, Core2, and so much more it cant be fit in here!

            1 Reply Last reply Reply Quote 0
            • felmueF Offline
              felmue
              last edited by

              Hello @Surya

              looking at your Arduino code I think a possible issue is the long delay of 10 seconds in loop() blocking client.loop(). You need to get rid of the long delay. How to periodically execute code without blocking is shown here.

              Thanks
              Felix

              GPIO translation table M5Stack / M5Core2
              Information about various M5Stack products.
              Code examples

              S 1 Reply Last reply Reply Quote 0
              • S Offline
                Surya @felmue
                last edited by

                Hello @felmue

                I have already attempted a short delay, but unfortunately, that doesn't work for me. As for periodic code execution, I will give it a try.

                Thanks
                Surya

                1 Reply Last reply Reply Quote 0
                • S Offline
                  Surya
                  last edited by

                  Oops, I forgot to share the error message. Here it is
                  0_1708690342175_ed5ae410-5ec1-4881-a73d-af18d629b2f6-image.png

                  1 Reply Last reply Reply Quote 0
                  • felmueF Offline
                    felmue
                    last edited by felmue

                    Hello @Surya

                    after long hours of searching and debugging I found the reason why I2C would fail. It starts to fail as soon as SSL is invoked. The SSL library uses an analog GPIO as input for its random seed. And in your code you used GPIO2 which is one of M5AtomS3 Groove GPIOs.

                    So to get rid of the I2C error try changing the GPIO used for random seed to GPIO10.

                    //SSLClient ethClientSSL(ethClient, TAs, (size_t)TAs_NUM, 2);
                    SSLClient ethClientSSL(ethClient, TAs, (size_t)TAs_NUM, GPIO_NUM_10);
                    

                    Thanks
                    Felix

                    GPIO translation table M5Stack / M5Core2
                    Information about various M5Stack products.
                    Code examples

                    teastainT S 2 Replies Last reply Reply Quote 3
                    • teastainT Offline
                      teastain @felmue
                      last edited by

                      @felmue Laughed out loud, in brotherhood.
                      Great job!

                      Cheers, Terry!

                      100% M5Stack addict with several drawers full of product!

                      1 Reply Last reply Reply Quote 2
                      • S Offline
                        Surya @felmue
                        last edited by

                        Hello @felmue

                        I implemented the change using GPIO10 for the random seed, and the I2C issue seems to be resolved. Your help is greatly appreciated!

                        Thank you for your fix!
                        Surya

                        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
                        • First post
                          Last post