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

    ENV III Causes CoreS3 to restart.

    General
    9
    15
    7.7k
    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.
    • ajb2k3A
      ajb2k3 @felmue
      last edited by ajb2k3

      @felmue said in ENV III Causes CoreS3 to restart.:

      Hello @ajb2k3

      have you tied with the Init buit-in hardware at beginning block a the top of setup? (Or without it?)

      Thanks
      Felix

      That's strange, why did the block end up at the bottom.
      That would make sense it being at the top.

      EDIT: nope still crashes when querying the sensor.

      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
      • AmedeeA
        Amedee
        last edited by

        Anybody got this working?

        I am facing the same issue.

        I tried to use Port B instead or port A, but the behavior is exactly the same: the device reboots when init is invoked...

        1 Reply Last reply Reply Quote 0
        • C
          cdouglas845
          last edited by

          I have exactly the same issue. The ENV call from the unit library to initialise it causes the reboot:

          env3_0 = ENV(i2c=i2c0, type=3)

          I can remove that, then do a scan on i2c0 and fetch the addresses of the sensors: [68, 112]

          I can then interface with I2C directly to read from the correct address and pull data from the buffer. That proves the ENV3 is connected correctly and that I2C isn't broken.

          It looks like a library issue for ENV3 I guess?

          I've also tried sending a command on I2C to the sensor to initiate a temperature measurement (writing 0x2C06) however I must be doing something wrong there as it then fails to allow me to read from the device any more and I have to hard reset it before I can continue.

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

            I’ve reported it to M5STACK and they are looking into it

            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!

            C M 2 Replies Last reply Reply Quote 0
            • C
              csierra67
              last edited by

              A workaround is to use Core or Core2 with Env III and UI Flow
              No problem

              1 Reply Last reply Reply Quote 0
              • C
                cdouglas845 @ajb2k3
                last edited by cdouglas845

                @ajb2k3 Ok thanks.

                FYI and anyone else that would like to get the ENV III data on CoreS3, I managed to get it working using I2C directly.

                Here is the code to go in your loop assuming I2C has been initialised as the default i2c0 variable:

                i2c0.writeto(68, '\x2C\x06', True)
                time.sleep_ms(100)
                data = i2c0.readfrom(68, 6, True)

                temp = (((data[0] << 8 | data[1]) * 175) / 0xFFFF) - 45
                hum = (((data[3] << 8 | data[4]) * 100.0) / 0xFFFF)

                I then output this Temperature (C) and Humidity (%) formatted using (assuming you've initialised label fields already):

                label_t.setText(f'{temp:#.1f}C ')
                label_h.setText(f'{hum:#.0f}%')

                1 Reply Last reply Reply Quote 2
                • M
                  mtylerjr @ajb2k3
                  last edited by

                  @ajb2k3

                  When I add the ENVIII unit to my CoreS3 on port A, and start it, I get the exception at line 98 of qmp6988.py (the call of reset() )

                  0_1694933407426_718d4a1d-c795-4781-a6c1-f91479da1434-image.png

                  The issue seems to have been noticed and fixed 8 months ago though, by some guy named Gandro:

                  https://github.com/gandro/micropython-m5stamp-c3u/commit/fe3ddc3d0c09cca4096dcfc37bbbf57e7b4a1271

                  It was (seemingly) caused by the QMP6988 chip in the ENVIII resetting in the middle of an I2c transaction during a requested reset (from line 97 of drivers/qmp6988.py), and the driver file not handling the timeout exception causing the exception/crash.

                  0_1694932494144_919af751-40ab-4af5-9fce-7e3ce72bbbf8-image.png

                  The fix was to just put a try/except around the transaction in reset(), and if the timeout is generated, ignore/handle it.

                  0_1694932524877_9855c7fb-ab8f-4ddf-a6d9-ff1c01d040f8-image.png

                  I found this with 5 minutes of googling. Not sure why M5Stack hasnt fixed it yet for all products that use the QMP6988

                  AmedeeA R 2 Replies Last reply Reply Quote 2
                  • AmedeeA
                    Amedee @mtylerjr
                    last edited by

                    @mtylerjr I am not so sure about that...

                    Even with that change, the module will reset at this line...

                    What works for me is to bypass the reset(), after that I get correct temperature/pressure; but once you reset, the next readfrom_mem() will reset the MCU

                    M 1 Reply Last reply Reply Quote 1
                    • M
                      mtylerjr @Amedee
                      last edited by

                      @amedee I think you are right. I think that fix has already been pushed, and the exception is on the readfrom_mem() now, like you say.

                      It seems like the same approach would work for that line as well.

                      1 Reply Last reply Reply Quote 0
                      • AmedeeA
                        Amedee
                        last edited by

                        If you are desperate to get it running, I have forked the micropython-m5stamp-c3u library and removed the QMP6988 reset().

                        Unfortunately I have not found a way to override the built-in libraries, so it needs some code blocks in UiFlow...

                        First install the libraries:

                        import mip
                        mip.install("https://raw.githubusercontent.com/AmedeeBulle/micropython-m5stamp-c3u/main/lib/sht30.py", target="/flash/libs")
                        mip.install("https://raw.githubusercontent.com/AmedeeBulle/micropython-m5stamp-c3u/main/lib/checksum.py", target="/flash/libs")
                        mip.install("https://raw.githubusercontent.com/AmedeeBulle/micropython-m5stamp-c3u/main/lib/qmp6988.py", target="/flash/libs")
                        

                        Once done you can query both sensors -- e.g:

                        0_1695141051212_Screenshot 2023-09-19 at 18.24.06.png

                        There are basically 3 code blocks:

                        Import libraries:

                        import sht30
                        import qmp6988
                        

                        Initialize sensors:

                        sht = sht30.SHT30(i2c0)
                        qmp = qmp6988.QMP6988(i2c0)
                        

                        Get data:

                        temperature, pressure = qmp.measure()
                        pressure = pressure / 100
                        temperature2, humidity = sht.measure()
                        

                        Note that in the above example, my ENV-III is plugged in the Port B, if you use Port A, adjust SCL/SDA accordingly!

                        1 Reply Last reply Reply Quote 3
                        • R
                          romor001 @mtylerjr
                          last edited by

                          I have the same issue with the env III unit and m5paper.

                          I do not have the time and energy to start patching libraries and modules.

                          The built in SHT30 of the m5paper is not supported by UIFlow 2 and the external unit does not work as well.

                          This is a bummer.

                          Hoping m5stack will fix this and update the module/library.
                          Is there any issue tracker where we can document and queue this for fixing?

                          kurikoK 1 Reply Last reply Reply Quote 0
                          • kurikoK
                            kuriko @romor001
                            last edited by

                            @romor001
                            Have you update your UiFlow firmware to the newest version?

                            Good morning, and welcome to the Black Mesa Transit System.

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