Problem with ESP32 + AXP202c

Hi guys, I am messing around with the LilyGo T-Watch that comes with an ESP32 and an ST7789 display. In this smartwatch, there is an axp202c Power Management Unit and I want to measure the power consumption of the watch in different modes. The axp202c is connected via I2C to the ESP32. I have written a simple script that reads the “fuel gauge” register and displays this value on a label. The function is called by lv_timer every second. That works fine.

Now I want to display the value in a meter. The meter looks great and I only have replaced the label by the meter, but now I am running into some error messages:

Traceback (most recent call last):
  File "lv_utils.py", line 123, in task_handler
  File "<stdin>", line 9, in set_value
  File "YAM_init.py", line 15, in get_Battery_Level
  File "axp202c.py", line 795, in getBattPercentage
  File "axp202c.py", line 420, in read_byte
OSError: [Errno 19] ENODEV

If I understand this correctly, there is a problem addressing the axp202c via I2C, or am I wrong? But how can this happens, when it works for the label? Do you have any ideas? I would be very grateful for any small tip or hint. Thanks, cyr

Hi @sad_cyrano ,

I’m trying to understand if this is related to LVGL.

Maybe get_Battery_Level is simply being called too fast too many times a second?
Could you reproduce this with a minimal example without LVGL? (that calls get_Battery_Level every 10ms for example)

Hi amirgon, sorry for the long delay and thank you very much for your reply and your valuable tips. Indeed it hasn´t been related to LVGL. In this system, there are some sensors on an I2C bus with id=0 on scl=22 and sda=21 but the touch controller FT63x6 is connected via I2C on scl=32 and sda=23. In the ft6x36 driver, the id is also 0 and therefore there was a conflict… simply like this ;-)))
Best regards,
sad_cyrano