Menu

#172 DFU code upload breaks Serial Monitor output Arduino Nano ESP32

none
invalid
nobody
None
2023-10-23
2023-07-25
Steve Ryan
No

The requested information is below.

I have a minimal Arduino program as a test.

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

int i = 0;
void loop() {
  Serial.print("This is "); Serial.println(i++);
  delay(4000);
}

Expected behavior:

  • I see This is 1, This is 2, etc in the serial monitor every time I compile and upload the program.

What happens:

  • The first run is fine, and I see the expected output.
  • While the Serial Monitor tab is visible click the "right arrow" button in the IDE to compile and upload.
  • Compilation and upload are successful, but the IDE is left "on 1-10", which the port tool indicates are DFU ports.
  • The serial monitor no longer shows the output, but has the message "No monitor available for the port protocol dfu. Could not connect to 1-10 dfu port."
  • Re-selecting the COM port does not restore the connection, and I get a message that the serial port is busy.
  • Closing the serial monitor, checking that the COM port is selected and re-opening the serial monitor also fails, with the same message.
  • Only physically unplugging the USB cable and reconnecting, followed by reselecting the COM port and then starting the serial monitor restores functionality.

This is already a pretty big annoyance when developing code, but it will become very serious when my users, who are biologists rather that computer types, suddenly find that their output data isn't displayed.

Environment: Windows 11, intel i9-13900
dfu-util 0.11-arduino4
Arduino Nano ESP32
Driver: whatever came with the Arduino IDE 2.1.1
-l and command line: Not applicable

Opening DFU capable USB device...
Device ID 2341:0070
Device DFU version 0101
Claiming USB DFU Interface...
Setting Alternate Interface #0 ...
Determining device status...
DFU state(2) = dfuIDLE, status(0) = No error condition is present
DFU mode device DFU version 0101
Device returned transfer size 4096
Copying data from PC to DFU device

lines showing download percent

DFU state(7) = dfuMANIFEST, status(0) = No error condition is present
DFU state(2) = dfuIDLE, status(0) = No error condition is present

Discussion

  • Steve Ryan

    Steve Ryan - 2023-07-25

    A couple of things I should have mentioned. This does not happen with an Arduino Mega, but it does happen with the new Nano ESP32. Also, I tried this with the older 1.8.x version of the Arduino IDE and got similar behavior, but without the messages.
    When I use the Mega I do get a block of about 30 square boxes on the serial monitor at about the time the sketch uploads, as if it is connected, but at the wrong baud rate. This happens every time I re-upload that simple sketch.

     
  • Steve Ryan

    Steve Ryan - 2023-07-25

    Yet another followup. It seems that if I put a 15 second delay after Serial.begin(), I can make things work part of the time. 10 seconds is not enough. There really needs to be a proper solution to this, but here is my unreliable workaround:

    • Close serial monitor
    • Click the compile and upload button.
    • After the upload prints "Done!" wait several seconds.
    • If the "on 1-10" message appears, re-select the COM port which was deselected at upload time.
    • Open serial monitor
      If this is all completed within the 15 second delay, but not too quickly, it usually results in correct output on the serial monitor.

    In my experience across half a dozen languages and several industries, things that usually work are about as valuable as things that don't work at all.

     
  • Anonymous

    Anonymous - 2023-07-31

    same issue with my new board that just came yesterday. Pls. help.

     
  • Tormod Volden

    Tormod Volden - 2023-07-31

    dfu-util 0.11-arduino4

    Driver: whatever came with the Arduino IDE 2.1.1

    You must bring this up with the people providing the Nano board package and integrating their own version of dfu-util. From what I can see here, dfu-util works fine. The interaction with the serial port is part of the Arduino bootloader.

     
  • Tormod Volden

    Tormod Volden - 2023-08-03
    • summary: DFU code upload breaks Serial Monitor output in Arduino IDE --> DFU code upload breaks Serial Monitor output Arduino Nano ESP32
     
  • Tormod Volden

    Tormod Volden - 2023-08-03

    This is maybe where you have to report this?
    https://github.com/arduino/arduino-esp32

    See also their Troubleshooting section.

     
  • Tormod Volden

    Tormod Volden - 2023-08-17
    • status: open --> needsinfo
     
  • Tormod Volden

    Tormod Volden - 2023-08-17

    Please post a link here to your Arduino bug report.

     
  • Tormod Volden

    Tormod Volden - 2023-10-23

    Did you report it somewhere?

     
  • Tormod Volden

    Tormod Volden - 2023-10-23
    • status: needsinfo --> invalid
     

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB