homieiot / homie-esp8266

💡 ESP8266 framework for Homie, a lightweight MQTT convention for the IoT
http://homieiot.github.io/homie-esp8266
MIT License
1.36k stars 308 forks source link

using ESP32 Serial1 interface triggers homie reset #738

Closed wirefitz closed 1 year ago

wirefitz commented 1 year ago

Hello,

I use homie on an esp32-wroom-32d to control a device via serial port 1 (pin 17RX and 18TX / GPIO 9 and 10). The serial port 0 I use as a normal debugging interface. Every time the controller receives data, homie restarts. This can be reproduced by pulling GPIO9 to ground. The "Homie.disableResetTrigger();" function is executed before the "Homie.setup();" function. Also the LED feedback is disabled for safety. Unfortunately nothing helps. I also did not find any other place in the source code where GPIO9 is defined as reset pin. I am using the current developer branch. With the following code the error can already be reproduced. Can anyone tell me how this happens? In a test program without the homie framework the communication over both interfaces works fine.

Thank you for your help!

#include <Arduino.h>
#include <Homie.h>

void cyclicTaskHandler();
unsigned long lastDataRequest = 0;

void setup()
{
  Serial.begin(115200);
  Serial1.begin(2400);

  Homie_setFirmware("bare-minimum", "1.0.0"); // The underscore is not a typo! See Magic bytes
  Homie.disableLedFeedback();
  Homie.disableResetTrigger();
  Homie.setup();
}

void loop()
{
  Homie.loop();
  delay(10);
}

void cyclicTaskHandler()
{
  if (millis() - lastDataRequest >= 2000)
  {
    Serial.println("Hallo World");
    Serial1.println("give me some feedback");
    lastDataRequest = millis();
  }
  else if (lastDataRequest > millis())
  {
    lastDataRequest = millis();
  }
}
wirefitz commented 1 year ago

Sorry it is not a homie issue. GPIO 9 and 10 are needed for the internal flash chip. My test program only works because it does not use this flash chip and can therefore use the uart1 interface. Can be closed and thanks to all who have already taken the time to read it.