M5Paper / Touch only working on USB power



  • Hello,

    i am trying to create a home automation with M5Paper and M5Flow. I flashed the UIFlow 1.9.0 to the device, but somehow the touch is only working when on USB-power.

    To reproduce the problem i wrote a very easy flow:

    0_1641776179822_2022-01-10 01_55_14-.jpg

    I burned the program via "Download" to the M5Paper.

    Behaviour an USB-power:
    -Reset the device via button on the back
    -UIFlow boot logo appears
    -Program is working as intended (circle set to touch coordinates on touch with screen refresh afterwards)

    Behaviour on battery-power:
    -Power down device via button on the back
    -Power on device via 2sec center button push
    -UIFlow boot logo appears
    -No circle is shown on touch

    I tried to check if system is running by adding some MQTT in the loop and a label with "get touch coordinates" that is refreshed with every loop iteration. Loop is definitely working but touch status is always false.

    I don't think it is a hardware problem because other programs like "Calculator" or "Factory Test" from M5Burner work also on battery power.

    Any idea what i am doing wrong?



  • Hello @BiGbEn

    hmm, your code example runs fine on my M5Paper from battery. So no, I don't think you're doing something wrong.

    The only idea I have at this point is that maybe the battery is too weak to initialize the touch screen properly? Have you tried to charge your M5Paper for a couple of hours before trying again?

    Thanks
    Felix



  • Hello @felmue,

    thanks for your reply. Yes, i charged the device for about 12h via USB power adapter. As i mentioned other programs like Calculator or Factory Test work without any problem.
    Also MQTT is transmitted in the loop and the screen refreshes constantly if I put a "Set screen show" in the loop.
    I will try to put a batterty voltage label on screen when i am home to check the battery.

    When i start/reset the device with USB power attached, then remove the USB, the program works until i power down the M5Paper with the button on the back. After Powerup with center-button no touch is recognized anymore.

    Thanks
    Sven



  • Hello,

    battery voltage is ~4.7V when on battery. No matter what i do, it is impossible for me to get touch working when on battery und using UIFlow.
    I tried to use Arduino IDE and compiled the Touch example from GitHub m5stack/M5EPD.
    Nothing is displayed on display (another problem?)
    But if i start the M5Paper on battery and connect USB afterwards to PC i can see the serial.printf in COM monitor. Touch is detected correctly.

    If i try the same with UIFlow (put "print get touch coordinates" in the loop), "status" in COM monitor is always false and coordinates are 0,0.

    0_1641845862566_screen2.jpg

    Any other ideas?

    Thanks
    Sven



  • I have same issue.

    I checked the documentation of the GT911 touch panel and found that the i2c address has two modes, 0x5D or 0x14, depending on the High/Low of INT at boot.

    After checking the i2c address with the code below, it is highly possible that the i2c address of the touch panel is different and is not being controlled correctly.

    • USB power boot: 0x5D
    • Battery power boot: 0x14

    from machine import Pin, I2C
    i2c = I2C(scl=Pin(22), sda=Pin(21), freq=400000)
    i2c.scan()

    I think it need to fix initial pin config of M5PAPER touch panel driver or m5paper firmware.



  • Hi @kinako

    I think you found the root cause. The M5EPD library checks for both I2C addresses:

    Wire.beginTransmission(0x14);
    if (Wire.endTransmission())
    {
      Wire.beginTransmission(0x5D);
      if (Wire.endTransmission())
      {
        log_e("Touch screen IIC connection error");
        return ESP_FAIL;
      }
      _iic_addr = 0x5D;
    }
    

    And I guess M5Paper UIFlow firmware probably isn't doing that.

    In addition I found that the 10k pull-up resistor (R87) on the INT line is not populated in my M5Paper. And the GPIO the INT line is connected to (GPIO36) is an input only GPIO which doesn't support internal pull-up or down. Which means the INT line is more or less floating.

    With UIFlow I confirmed that touch does not work in my M5Paper (running from battery) if I populate the 10k pull-up resistor. And touch does work if the INT line is pulled down during startup.

    Edit: I've just run your test code on my M5Paper (with INT floating) and I get the I2C address 0x5D in both cases, running from USB and running from battery.

    Thanks
    Felix



  • Hello @kinako and @felmue,

    wow, your findings sound promising. I can confirm with i2c.scan() on my device that i2c addresses on battery are integers [20, 68, 80, 81] and on USB [68, 80, 81, 93] so the (int)20 switches to (int)93 what is exactly the mentioned HEX addresses 0x14 and 0x5D.

    I used following UIFlow Python code and watched output on COM Monitor:

    from m5stack import *
    from m5ui import *
    from uiflow import *
    from machine import Pin, I2C
    
    while True:
      i2c = I2C(scl=Pin(22), sda=Pin(21), freq=400000)
      print(i2c.scan())
      wait_ms(500)
    

    Any idea what is the best way to create a bug report about this?





  • I think I am experiencing similar issue. I am able to use UIFLOW for my M5paper by using the "RUN" but when I do the "DOWNLOAD", the program seems to be fine, but I get a blank screen, and no touch, but know the program is functioning as I use the side rotating button which "things" appear on the screen as I expected, but on startup blank screen, and no touch, the only way I know the program is running is the toggling of UP and DOWN wheel.

    Wondering if it is similar issue or something else is going on?



  • Hello @joefly,

    regarding the your touch problem i think it is the same issue that we found here. About the blank screen on powerup: Do you have a "set screen show" block at the end of your Setup block? The screen is only shown/updated with "Set screen show" also after powerup.



  • @BiGbEn Hi.

    As I said, the program works fine on "Run" with Set Screen Show on setup. But only on Download does the program does not function as expected, particularly screen and touch not working/incorrectly. I noticed that the bug was not listed under the bug report list. Any hope of this being resolved?



  • An Update, I found my own problem. So my issues is not related to this above bug, it was due to no doing wifi connect within the program downloaded. I guess RUN integrates the wificonnect and the download does not.

    Related: I noticed using the download, I am not able to connect to device using UIFLOW IDE, have to put the device is FLOW mode. Is there away to program it to allow for UIFLOW to still connect?



  • Hi @all,

    Hi, sorry for taking so long to reply.Next version(v1.9.2) will jugement the address after power on.



  • Hello,

    i can confirm that touch is now working with firmware 1.9.2 in battery mode. Thanks @all for the help.