[NEW] UiFLow V1.2.3 I2C error "error OSError('I2C bus error (-1)',)"



  • Hello, yesterday i received my seven M5 packages and i was rather productive despite the multiple problems i reported in separated topics. I am reporting this as a bug because i was able to understand how to reproduce it. Yesterday i successfully implemented a RFID access control using the RFID module conected to Porta A and an RGB module connected to Port B. Actually it seems that there are two ways to get the "error OSError('I2C bus error (-1)',)" immediately after download/run command. A) The FIRST ONE seems to be that if when you select the Unit you dont select the right Port from the beginning (e.g. C instead of B for the RGB); i.e. if you change the selection it after the Unit has been already added. In that case the only thing that it helps is deleting the Unit (fortunately the associated Blockly code is not lost in doing so) and adding it again with the right port designation A, B or C pre-selected. B) THE SECOND ONE i.e. the other way to get this error is the following: yesterday after i successfully implemented and tested my RFID access control i saved the *.m5f file (by the way that is another bug, the UIFlow does not add the *.m5f extension by default and if you try to open the file without the extension you will have an empty program )...today i reopen the *.m5f that worked perfectly yesterday and downloaded without modification; the result is again "error OSError('I2C bus error (-1)',)" ...then checking the Port of the RGB , which was set as B yesterday, it has changed to C....but changing it back to B does not help because reason A. I hope you guys can figure out this soon, it is too annoying as all the peripherals are I2C controlled. (My test has been done with UIFlow Desktop under Windows 10 64bit). Thank you!



  • When the error or "Lack of change" happens, can you go into micropython mode and change it in the code?



  • @ajb2k3 What do you mean with 'When the error or "Lack of change" happens'...i haven't see such error but "error OSError('I2C bus error (-1)',)" as reported...



  • @jcabad100 said in [NEW] UiFLow V1.2.3 I2C error "error OSError('I2C bus error (-1)',)":

    @ajb2k3 What do you mean with 'When the error or "Lack of change" happens'...i haven't see such error but "error OSError('I2C bus error (-1)',)" as reported...

    Sorry having problems finding the words, 'When the error or "Lack of change" happens' is not a message that the m5stack will show you.

    You are changing the port using the drop down box the pops up when you click the unit. This you are finding doesn't work when you try uploading the update. Click on </>PYTHON to switch to the python mode and you will get

    from m5ui import *
    import units
    clear_bg(0x222222)
    rfid0 = units.get(units.rfid,units.PORTA)
    btnA = M5Button(name="ButtonA", text="ButtonA", visibility=False)
    btnB = M5Button(name="ButtonB", text="ButtonB", visibility=False)
    btnC = M5Button(name="ButtonC", text="ButtonC", visibility=False)
    

    You can try altering the port by just changing the code to

    from m5ui import *
    import units
    clear_bg(0x222222)
    rfid0 = units.get(units.rfid,units.PORTB)
    btnA = M5Button(name="ButtonA", text="ButtonA", visibility=False)
    btnB = M5Button(name="ButtonB", text="ButtonB", visibility=False)
    btnC = M5Button(name="ButtonC", text="ButtonC", visibility=False)
    

    DON'T SWITCH BACK TO BLOCKY AFTER MAKING CHANGE!
    Can you try this and see if it works?
    Its not a fix as UIFlow is still quite buggy.



  • @ajb2k3 i just retested my RFID access application that worked 3 days ago using Port A for the RFID sensor and Port C for the RGB unit. As soon as i downloaded the same version i got the I2C error as reported...i checked what the Python code does and the Ports A and C are properly set for each unit....if i change the port in Blockly the Phyton code is always correct...and despite of that the I2C error occur 100% of the time. I tried changing ports A+B, A+A and changing it on Blockly, to not avail , the I2C error always occurr. I then tried deleting jus the RGB unit and adding it again; does not help. then the RFID units, it does not help. The only workaround that works is delete BOTH UNITS (all units) and add them back with correct port preselection. Then the application works again. Please ask you R&D to reproduce the error (after something works save the program, close UIFlow Desktop and reopen it, open the previous program...the error should appear). Here the phyton code for the working application with Ports A and C used.: from m5stack import *
    from m5ui import *
    import units

    clear_bg(0x222222)
    rfid0 = units.get(units.rfid,units.PORTA)
    rgb0 = units.get(units.rgb,units.PORTC, 3)

    btnA = M5Button(name="ButtonA", text="ButtonA", visibility=False)
    btnB = M5Button(name="ButtonB", text="ButtonB", visibility=False)
    btnC = M5Button(name="ButtonC", text="ButtonC", visibility=False)
    label1 = M5TextBox(35, 28, "RFID by J.C.Abad", lcd.FONT_Comic,0xFFFFFF, rotate=0)
    label2 = M5TextBox(33, 93, "TagID:", lcd.FONT_Comic,0xFFFFFF, rotate=0)
    tagID = M5TextBox(130, 99, "Text", lcd.FONT_Comic,0xFFFFFF, rotate=0)
    label3 = M5TextBox(37, 144, "TagText:", lcd.FONT_Default,0xFFFFFF, rotate=0)
    tagText = M5TextBox(39, 176, "Text", lcd.FONT_Default,0xFFFFFF, rotate=0)

    masterKeyID = None
    masterKeyText = None
    tempID = None
    tempRFIDText = None

    masterKeyID = '1234567890' //Modified
    masterKeyText = 'Key Owner: J.C.Abad ...., please return!' //Modified
    rgb0.setColorAll(0xffff33)
    rgb0.setBrightness(10)
    wait(1)
    while True:
    if rfid0.card_on():
    wait(1)
    tempID = rfid0.read_uid()
    tagID.setText(str(tempID))
    tempRFIDText = rfid0.read_str(1)
    tagText.setText(str(tempRFIDText))
    if tempID == masterKeyID:
    rgb0.setColorAll(0x33cc00)
    wait(3)
    if not len(tempRFIDText):
    rfid0.write_block(1,masterKeyText)
    rgb0.setColorAll(0xffff33)
    wait(10)
    tempRFIDText = rfid0.read_str(1)
    tagText.setText(str(tempRFIDText))
    else:
    rgb0.setColorAll(0xff0000)
    else:
    wait(1)
    rgb0.setColorAll(0xcc33cc)
    tempID = ''
    tagID.setText(str(tempID))
    tempRFIDText = ''
    tagText.setText(str(tempRFIDText))



  • I am very sorry, we have retested this problem after testing, and today we will fix it.