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

    M5Stack Paper I2C Doesn't work

    Cores
    5
    15
    14.3k
    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.
    • felmueF
      felmue
      last edited by

      Hello @ispybadguys

      calling M5.begin() already takes care of Serial and Wire. I suggest you only call M5.begin() (which also initialises other M5Paper hardware) in setup().

      As for the I2C scanning on the three ports. The latest ESP32 Arduino framework doesn't allow to just call Wire1.begin() repeatedly with different GPIOs for SDA and SCL. If you look at the debug output you'll see this warning [ 41263][W][Wire.cpp:204] begin(): Bus already started in Master Mode. every time you try that in the loop().

      So when the scanning is done for one port you need to call Wire1.end() before calling Wire1.begin() again.

      Thanks
      Felix

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

      1 Reply Last reply Reply Quote 0
      • I
        ispybadguys
        last edited by

        Thanks. I'll try that. When I call M5.begin(); I get the following behavior.

        M5EPD initializing...OK
        M5EPD initializing...OK
        M5EPD initializing...OK
        M5EPD initializing...OK
        M5EPD initializing...OK
        M5EPD initializing...OK
        M5EPD initializing...OK
        M5EPD initializing...OK
        M5EPD initializing...OK
        M5EPD initializing...OK
        M5EPD initializing...OK
        M5EPD initializing...OK
        M5EPD initializing...OK
        M5EPD initializing...OK
        M5EPD initializing...OK
        M5EPD initializing...OK
        M5EPD initializing...OK

        continues forever.

        1 Reply Last reply Reply Quote 0
        • I
          ispybadguys
          last edited by

          If I comment out the internal I2C section so I only have the PORT-A scan I get the following:

          Scanning external I2C (PortA)
          ..............................................................................................................................Done Scanning PortA I2C

          It takes about one second for each address scanned. This is probably the default timeout.

          Kurt

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

            @ispybadguys What external devices have you tried connecting?

            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
              felmue
              last edited by

              Hello @ispybadguys

              are you saying that simply calling M5.begin() in setup(), e.g.

              #include <M5EPD.h>
              void setup() {
                M5.begin();
              }
              
              void loop() {
              }
              

              produces M5EPD initializing...OK over and over again?

              Thanks
              Felix

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

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

                Hello @ispybadguys

                please find the I2C internal and all port scanner (which works for me) here.

                Thanks
                Felix

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

                1 Reply Last reply Reply Quote 0
                • I
                  ispybadguys
                  last edited by

                  Yes. I tested the very code you have here with just to include and M5.begin() and I get M5EPD initializing... followed by a 4 second pause and then the OK

                  1 Reply Last reply Reply Quote 0
                  • I
                    ispybadguys
                    last edited by

                    Felix

                    Thanks for the code . For scanning the I2C. The code produces the following output:

                    M5EPD initializing...OK
                    I2C Scan - internal
                    .M5EPD initializing...OK
                    I2C Scan - internal
                    .M5EPD initializing...OK
                    I2C Scan - internal
                    .M5EPD initializing...OK

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

                      Hello @ispybadguys

                      that is very weird - I am stumped.

                      Have you tried to only scan the ports by commenting these two lines:

                      //  Serial.println("I2C Scan - internal");
                      //  scanI2C(i2cBus_Internal.wire, i2cBus_Internal.sda, i2cBus_Internal.scl);
                      

                      BTW: I also get a 4 seconds delay before OK is printed out - so that should be fine.

                      Thanks
                      Felix

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

                      1 Reply Last reply Reply Quote 0
                      • I
                        ispybadguys
                        last edited by

                        Felix

                        Yes. I just tried that. I get the same behavior. I moved the script to a new Windows computer and installed the IDE there. I get
                        13:10:21.290 -> I2C Scan - Port A
                        13:10:21.290 -> .M5EPD initializing...OK
                        13:10:25.790 -> I2C Scan - Port A

                        I can actually scan the internal ports correctly if I don't call M5.begin(); and I just do a Serial.begin() and the wire commands.

                        BTW the boards.txt has an error in it for the M5-Paper and you cannot upload code from the Arduino IDE. I fixed that and I can upload ok now.

                        Kurt

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

                          Hello @ispybadguys

                          the debug output suggests that as soon as the I2C port scan starts (first dot) your M5Paper seems to reboot.

                          • Have you tried a different / shorter USB cable? Maybe the issue is power related?
                          • Does the touch example (requires internal I2C) work?

                          Thanks
                          Felix

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

                          1 Reply Last reply Reply Quote 0
                          • I
                            ispybadguys
                            last edited by ispybadguys

                            Yes. That looks to be the case that it crashed after one or two Wire1 commands. Usually one period is printed but sometimes two. Also the internal I2C does not work is I call M5.begin but it does if I just call Wire.begin.

                            1 Reply Last reply Reply Quote 0
                            • K
                              Koiru
                              last edited by

                              I'm having exactly the same issue. Have you figured out what causes it?

                              1 Reply Last reply Reply Quote 0
                              • M
                                Morne
                                last edited by

                                @Koiru I have not found a solution but I have found a workaround.

                                The culprit creating the constant reboots are the touchscreen, if I call the begin function without enabling the touchscreen I can get the unit to work instead of doing constant reboots.

                                To initialize the unit without touchscreen, use the following arguments:

                                M5.begin(false, true, true, true, true);
                                
                                1 Reply Last reply Reply Quote 0
                                • First post
                                  Last post