8000 "Serial.available()" does not work after update to "Update IDF to 9a26296" from Sep 12, 2017 · Issue #645 · espressif/arduino-esp32 · GitHub
[go: up one dir, main page]

Skip to content
"Serial.available()" does not work after update to "Update IDF to 9a26296" from Sep 12, 2017  #645
Closed
@xterminos

Description

@xterminos

Hardware:

Board: ESP32 Dev Module
Core Installation/update date: 12/jul/2017
IDE name: Arduino IDE 1.84
Flash Frequency: 80Mhz
Upload Speed: 921600

Description:

As far as I can see "Serial.available()" no longer works after I updated to "Update IDF to 9a26296" from Sep 12, 2017. As soon as I try to send some chars from the arduino-serial-monitor the sketch hangs!

Sketch:

This is a slightly modified "SerialEvent"-Example from the Arduino-IDE built-in examples.

String inputString = "";         // a String to hold incoming data
boolean stringComplete = false;  // whether the string is complete

void setup() {
  // initialize serial:
  Serial.begin(115200);
  // reserve 200 bytes for the inputString:
  inputString.reserve(200);
}

void loop() {
  // print the string when a newline arrives:
  if (stringComplete) {
    Serial.println(inputString);
    // clear the string:
    inputString = "";
    stringComplete = false;
  }

  serialEvent(); //manually calling "void serialEvent()"

  Serial.print("loop: "); Serial.println(millis()); //just to show some activity on the serial monitor.

}

/*
  SerialEvent occurs whenever a new data comes in the hardware serial RX. This
  routine is run between each time loop() runs, so using delay inside loop can
  delay response. Multiple bytes of data may be available.
*/
void serialEvent() {

  Serial.println("serialEvent"); //show that "void serialEvent()" is really called every loop.

  while (Serial.available()) {

    Serial.println("inside: \"while (Serial.available())\""); //sketch never reaches this point!

    // get the new byte:
    char inChar = (char)Serial.read();
    // add it to the inputString:
    inputString += inChar;
    // if the incoming character is a newline, set a flag so the main loop can
    // do something about it:
    if (inChar == '\n') {
      stringComplete = true;
    }
  }
}

Debug Messages:

none

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0