Open justlikeef opened 1 year ago
After running the simple diagnostic sketch for more than 24 hours, I can verify that all the GPIOs are functioning as expected. There are no strange state changes or other weird behavior as there are when running the Esphome firmware. Since the same behavior occurs with multiple i2c GPIO expander chips, I would think it is likely either within the i2c or gpio components.
I'm not a C programmer, so please forgive me if this is not right. I'll be happy to do whatever needs to be done to troubleshoot this issue...
I've added some basic logging code to the pin setup and attached a log of what I am getting. I see no TX log entries, which I think I should be seeing based on the code in i2c_bus_esp_idf line 164:
ESP_LOGVV(TAG, "0x%02X TX %s", address, debug_hex.c_str());
nor do I see logging from the code I added:
void PCF8574Component::pin_mode(uint8_t pin, gpio::Flags flags) {
if (flags == gpio::FLAG_INPUT) {
ESP_LOGCONFIG(TAG, "Pin Mode: Input");
// Clear mode mask bit
this->mode_mask_ &= ~(1 << pin);
// Write GPIO to enable input mode
this->write_gpio_();
} else if (flags == gpio::FLAG_OUTPUT) {
ESP_LOGCONFIG(TAG, "Pin Mode: Output");
// Set mode mask bit
this->mode_mask_ |= 1 << pin;
}
}
Two logs with slightly different results, but the same behavior. After some time of running (45 minutes to an hour in this case for both logs), there start to be problems controlling the switches. The values of the sensors are wrong from the beginning. Nothing jumps out that I can see.
If I run a very simple sketch that either allows me to either read the current status of or turn the gpios on and off, I don't have any issues after running for 48 or more hours, so I don't think it's the electronics.
The problem
I have two different i2c GPIO expanders (MCP23017 and PCF8575) that are behaving in the same manner. I have also tried with multiple esp32 boards (Olimex POE using wired ethernet and generic WROOM DevkitC using wireless) and have the same result.
All expansion GPIOs are configured in output mode and inverted.
I am currently testing with a very simple sketch using Arduino IDE that initializes the 8575, does some bit banging, then lets it sit. So far I have seen none of the strange pin state changes with this sketch as when I'm running ESPHome.
Which version of ESPHome has the issue?
v2023.1.0-dev
What type of installation are you using?
Home Assistant Add-on
Which version of Home Assistant has the issue?
2023.2.4
What platform are you using?
ESP32
Board
Olimex POE and Generic DevKit-C
Component causing the issue
i2c MCP23017 PCF8575 gpio
Example YAML snippet
Anything in the logs that might be useful for us?
Additional information
No response