(Solved)M5StickC+ToF:I2C bus error (19)



  • While using the M5StickC with the M5STACK-TOF-UNIT "Dostance Sensor" connected I receive the following error when running the simple block code on UIFlow

    It used to work fine(using same code), but suddenly I receive the error.

    Error:
    I2C bus error (19)

    Code(from UIFlow)

    from m5stack import *
    from m5ui import *
    from uiflow import *
    import time
    import unit
    
    setScreenColor(0x111111)
    tof0 = unit.get(unit.TOF, unit.PORTA)
    
    
    
    label0 = M5TextBox(8, 27, "Text", lcd.FONT_Default, 0xFFFFFF, rotate=0)
    
    
    while True:
      label0.setText(str(tof0.distance))
      wait(1)
      wait_ms(2)
    

    I try another code also, but I still recieved same error.
    it looks like

    tof0 = unit.get(unit.TOF, unit.PORTA)

    part might has a probelm.

    from m5stack import *
    from m5ui import *
    from uiflow import *
    import time
    import unit
    
    setScreenColor(0x111111)
    tof0 = unit.get(unit.TOF, unit.PORTA)
    
    
    
    
    
    label0 = M5TextBox(8, 27, "Text", lcd.FONT_Default, 0xFFFFFF, rotate=0)
    
    
    while True:
      label0.setText(str('Hello M5'))
      wait(1)
      wait_ms(2)
    

    Any suggestions would be appreciated.



  • Hello @Koms

    I am running your code just fine with UIFlow firmware 1.7.3 on my M5StickC.

    • are you using the latest UIFlow firmware?
    • have you tried another cable? (I get error 19 when I disconnect the unit)
    • is the cable plugged in all the way?

    Thanks
    Felix



  • Hi! @felmue

    Thank you for your advices.

    are you using the latest UIFlow firmware?

    Yes

    have you tried another cable? (I get error 19 when I disconnect the unit)

    I tried another cable, the problem is solved!

    Thank you so much!



  • Hello @Koms

    you are welcome. Thank you for reporting back. I am glad to hear you got it working.

    Cheers
    Felix