Skip to content

The monitor sometimes fails to reconnect to my Nano 33 BLE board after an upload #1966

Open
@kittaakos

Description

@kittaakos

Describe the problem

The monitor sometimes fails to reconnect to my Nano 33 BLE board after an upload.

To reproduce

  • You have a Nano 33 BLE board,
  • Create two new sketches with the following content,
  • Both have this content:
unsigned long previousMillis;

void setup() {
  Serial.begin(9600);
}

void loop() {
  if (Serial.available() > 0) {
    while (Serial.available() > 0) {
      Serial.write(Serial.read());
      delay(10);
    }
  } else if (millis() - previousMillis >= 1000) {
    previousMillis = millis();
    Serial.println("hello");
  }
}
  • Save the sketches,
  • Connect to the Nano 33 BLE board from one of the sketches, upload the sketch, and open the monitor to verify it works.
  • Connect to the Nano 33 BLE board from the other sketch, and open the monitor. Both monitor works.
  • Start uploading the sketch to the board while the monitor runs.
  • If you do it enough times, it fails (on my mac, it takes 4-5 uploads, and I could randomly reproduce IDE remains in uploading state after completion of upload to network port #1356 too)
no_monitor_reconnect_after_upload_nano33ble.mp4

Expected behavior

The monitor can reconnect.

Arduino IDE version

2.0.4

Operating system

macOS

Operating system version

12.6.3

Additional context

Even if both monitors can reconnect after the upload, there is an unhandled error in the logs:

2023-03-20T07:35:59.690Z daemon INFO ERRO[0031] stopped decode loop: EOF                      monitor=serial-monitor

2023-03-20T07:35:59.690Z daemon INFO INFO[0031] Monitor process killed                        monitor=serial-monitor

2023-03-20T07:35:59.691Z monitor-service ERROR Error: 2 UNKNOWN: Port monitor error: command 'open' failed: no such file or directory
    at Object.callErrorFromStatus (/Applications/Arduino IDE 2.0.4.app/Contents/Resources/app/node_modules/@grpc/grpc-js/build/src/call.js:31:19)
    at Object.onReceiveStatus (/Applications/Arduino IDE 2.0.4.app/Contents/Resources/app/node_modules/@grpc/grpc-js/build/src/client.js:413:49)
    at Object.onReceiveStatus (/Applications/Arduino IDE 2.0.4.app/Contents/Resources/app/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:328:181)
    at /Applications/Arduino IDE 2.0.4.app/Contents/Resources/app/node_modules/@grpc/grpc-js/build/src/call-stream.js:187:78
    at processTicksAndRejections (node:internal/process/task_queues:78:11)
for call at
    at ServiceClientImpl.makeBidiStreamRequest (/Applications/Arduino IDE 2.0.4.app/Contents/Resources/app/node_modules/@grpc/grpc-js/build/src/client.js:398:30)
    at ServiceClientImpl.monitor (/Applications/Arduino IDE 2.0.4.app/Contents/Resources/app/node_modules/@grpc/grpc-js/build/src/make-client.js:105:19)
    at MonitorService.createDuplex (/Applications/Arduino IDE 2.0.4.app/Contents/Resources/app/node_modules/arduino-ide-extension/lib/node/monitor-service.js:155:34)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async startPolling (/Applications/Arduino IDE 2.0.4.app/Contents/Resources/app/node_modules/arduino-ide-extension/lib/node/monitor-service.js:226:39)
2023-03-20T07:35:59.691Z monitor-service INFO monitor to /dev/cu.usbmodem14301 using serial closed by server
2023-03-20T07:36:00.481Z daemon INFO INFO[0032] from discovery builtin:serial-discovery received message type: add, port: /dev/cu.usbmodem14301

Issue checklist

  • I searched for previous reports in the issue tracker
  • I verified the problem still occurs when using the latest nightly build
  • My report contains all necessary details

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: codeRelated to content of the project itselftopic: serial monitorRelated to the Serial Monitortype: imperfectionPerceived defect in any part of project

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions