Core S3 with ENV3 sensor bug?



  • 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



  • 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...



  • 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



  • @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



  • 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



  • @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!



  • Nope still hanging



  • 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



  • 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



  • 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