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

    Core S3 with ENV3 sensor bug?

    Cores
    5
    10
    5.4k
    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
      stefan-h
      last edited by

      Hi everyone,

      I'm quite new to the m5stack community and I today received my Core S3 and some sensors.
      I've been playing around with a m5atom matrix since a couple of weeks and wanted to step up the game.

      For testing, I just wanted to output data from the ENV3 sensor to the display, but it did not work... it took me quite a while to realize, that the core was power cycling when the app is running and the sensor is connected.
      I stripped down my program just leaving the initializing part of the sensor in it, and had the same issue...
      I also tried port B and C, swapped around the pins on the I2C init, tried it with the ENV1 and ENV2 unit in uiflow... all of this gave me an error message, but no power cycling. When I switched back to the way it's meant to be, it starts power cycling again.

      I've tested the sensor with my m5atom, it worked fine. I've also tested the port A on the Core S3 by setting some Pins high/low, this also works.

      Is anyone experiencing the same problems with this configuration?

      Cheers,
      Stefan

      1 Reply Last reply Reply Quote 0
      • S
        stefan-h
        last edited by

        sorry for pushing, but still no answer?
        no one using the Core S3 with ENV3 sensor in UIflow2?
        I just tested the latest version, Alpha-21... same issue. My code is just initializing the Unit and printing Temp data, thats all i want at this moment...
        CoreS3 keeps power cycling until I disconnect the sensor...

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

          Ports B and C wont work as the ENVIII is an I2C device and Port B is for Analog (1 output and 1 input pin) and Port C is for UART communication.
          Its strange because the ENVIII was working fine with my CoreS3

          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
            stefan-h @ajb2k3
            last edited by

            @ajb2k3 thanks for the replay.

            I'm defintely having problems initializing the env3 unit in uiflow, just trying to debug with some feedbacks:

            0_1690634186333_Bildschirmfoto 2023-07-29 um 14.34.54.png

            after showing "env" (for 3-4 secs) it reboots and starts over. As I said, the env3 module works fine with my m5atom. Is there any way to debug my S3? Or can someone help with a .ino code or something which just initializes the unit and outputs something to debug on the serial? As I said, I'm new to all this, don't think i can manage that myself.
            Maybe I just messed up my librarys somehow?

            Here ist the python code, uiflow generates:

            import os, sys, io
            import M5
            from M5 import *
            import time
            from hardware import *
            from unit import *

            label0 = None
            i2c0 = None
            env3_0 = None

            def setup():
            global label0, i2c0, env3_0, random

            M5.begin()
            Widgets.fillScreen(0x222222)
            label0 = Widgets.Label("Text", 58, 32, 1.0, 0xffffff, 0xff0000, Widgets.FONTS.DejaVu18)

            time.sleep(1)
            label0.setText(str('Hello'))
            time.sleep(1)
            label0.setText(str('i2c'))
            i2c0 = I2C(0, scl=Pin(1), sda=Pin(2), freq=100000)
            time.sleep(1)
            label0.setText(str('env'))
            env3_0 = ENV(i2c=i2c0, type=3)
            label0.setText(str('DONE!'))

            def loop():
            global label0, i2c0, env3_0, random
            M5.update()
            label0.setText(str(env3_0.read_temperature()))
            time.sleep_ms(500)

            if name == 'main':
            try:
            setup()
            while True:
            loop()
            except (Exception, KeyboardInterrupt) as e:
            try:
            from utility import print_error_msg
            print_error_msg(e)
            except ImportError:
            print("please update to latest firmware")

            Thank,
            Stefan

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

              I see you issue, you have everything in setup when it should be in loop.
              You code should be like this:
              0_1690699728031_Screenshot 2023-07-30 at 07.48.13.png

              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
              • C
                cdouglas845
                last edited by

                @ajb2k3: His issue is that it hangs on the init so it never gets to the loop section, I have exactly the same issue.

                @stefan-h: Did you manage to resolve this issue or is it still broken for you? I'm keen to solve my issue too!

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

                  Nope still hanging

                  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
                  • D
                    dwarren
                    last edited by

                    I'm having the same issue. Everything works fine, but once the env iii is initialized it fails and soft resets. I'm new to UIFlow and Micropython, so it's hard for me to debug this.

                    alt text

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

                      Hello @dwarren

                      With UIFlow2.0.0. alpha-28 using an M5AtomS3 I can use the ENV III unit just fine. Code below:

                      import os, sys, io
                      import M5
                      from M5 import *
                      from hardware import *
                      from unit import *
                      
                      label0 = None
                      label1 = None
                      label2 = None
                      i2c0 = None
                      env3_0 = None
                      
                      def setup():
                        global label0, label1, label2, i2c0, env3_0
                      
                        M5.begin()
                        label0 = Widgets.Label("label0", 4, 8, 1.0, 0xffffff, 0x222222, Widgets.FONTS.DejaVu18)
                        label1 = Widgets.Label("label1", 3, 32, 1.0, 0xffffff, 0x222222, Widgets.FONTS.DejaVu18)
                        label2 = Widgets.Label("label2", 3, 54, 1.0, 0xffffff, 0x222222, Widgets.FONTS.DejaVu18)
                      
                        i2c0 = I2C(0, scl=Pin(1), sda=Pin(2), freq=100000)
                        env3_0 = ENVUnit(i2c=i2c0, type=3)
                      
                      def loop():
                        global label0, label1, label2, i2c0, env3_0
                        M5.update()
                        label0.setText(str(env3_0.read_temperature()))
                        label1.setText(str(env3_0.read_pressure()))
                        label2.setText(str(env3_0.read_humidity()))
                      
                      if __name__ == '__main__':
                        try:
                          setup()
                          while True:
                            loop()
                        except (Exception, KeyboardInterrupt) as e:
                          try:
                            from utility import print_error_msg
                            print_error_msg(e)
                          except ImportError:
                            print("please update to latest firmware")
                      

                      Note: I do not have an M5AtomS3 lite, so I don't know if there might still be an issue there.

                      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 @stefan-h

                        I've tried the similar code as above with an M5CoreS3 and ENV III unit as well and it worked fine for me.

                        I suggest you try the latest available UIFlow2 firmware version which is UIFlow2.0.0. alpah-28 at the time of this post.

                        Thanks
                        Felix

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

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post