Skip to content
This repository was archived by the owner on Oct 1, 2024. It is now read-only.

usb-detection module fails to load #1453

Closed
benmcmorran opened this issue Feb 9, 2022 · 13 comments
Closed

usb-detection module fails to load #1453

benmcmorran opened this issue Feb 9, 2022 · 13 comments

Comments

@benmcmorran
Copy link
Member

Hi, my VS Code 1.64.1 with Arduino extension v0.4.10 experienced the same behaviour: When clicked to open the serial monitor and reseted teh device (ESP8266 in my case), no output i shown. I have increased the Developer Log Level to 'trace' and ther is en exception related to this extension in Log (Window)Output - see attached log file renderer1.log.

Originally posted by @milanbx in #1338 (comment)

@github-actions github-actions bot added the triage New issues that have not been reviewed. label Feb 9, 2022
@benmcmorran
Copy link
Member Author

@milanbx What value to you have for the arduino.enableUSBDetection setting in VS Code? I think it's been broken for a while and should default to being disabled, but if you have it enabled you might see this issue.

image

@benmcmorran benmcmorran added needs-more-info More details about this issue are needed for it to be actionable. and removed triage New issues that have not been reviewed. labels Feb 10, 2022
@milanbx
Copy link

milanbx commented Feb 11, 2022

Whell, I have never explicitly used this setting, neither turned it on, nor off, always left it in its default. I am not even sure, how it affects the serial output. Anyway, I have had it turned on until now. And yes, I see the issue, as you have described it above. Why are you asking?

@milanbx
Copy link

milanbx commented Feb 11, 2022

UPDATE: I have turned the USB deteciotn off, upgraded to Code 1.64.2 and Arduino extension 0.14.1 and the Serial Monitor still not working. And it really depends on what characters you send to the serial. If it was simple ASCII like "-------", it worked. But when I listed for example FS content (file names), nothing good came out, just single characters like '$' or 'r' etc.

@adams13x13
Copy link

adams13x13 commented Feb 11, 2022

Dear Microsoft, are you serious? With almost every update of Visual Studio Code, the serial port stops working due to the incompatible Arduino extension and the update to the extension is not yet available. I had to disable VS Code updates on my machine because of this. Within one company (even that big as Microsoft), it should be possible to establish an arrangement between the teams ("VS Code" and "Arduino") to deliver the working product.

Indeed,
VS Code 1.64.2 + Arduino 0.4.10 does not work,
VS Code 1.64.2 + Arduino 0.4.11 works.

Tested with Linux Mint 19.3 (based on Ubuntu 18.04) Kernel: 5.4.0-99 (64bit) and ESP8266 / CH341 USB-to-Serial converter.
PS. I have "arduino.enableUSBDetection": false

@adams13x13
Copy link

@milanbx, what serial transmission rate is set in your sketch and in the terminal (VS Code)? Strange single characters could be indication of the different speed setting.
You can also try the "Arduino" serial monitor from Arduino IDE - does the hardware work correctly?

@milanbx
Copy link

milanbx commented Feb 11, 2022

Good question, just to be sure, but the speed for serial is set to 115200: Serial.begin(115200); and the speed of terminal is set to the same. And I have already tried Arduino IDE's serial monitor and ti works fine with the same sketch and board.

@milanbx
Copy link

milanbx commented Feb 11, 2022

Just to give complete info, here is the simple sketch:

#include <LittleFS.h>
void setup() {
    delay(500);
    Serial.begin(115200);
    Serial.println("\n------------------");
    if (LittleFS.begin()) {
        Serial.println("FS OK");
    } else {
        Serial.println("FS failed");
        return;
    }
    Dir dir = LittleFS.openDir("");
    while (dir.next()) Serial.println(dir.fileName());
    FSInfo fsi;
    LittleFS.info(fsi);
    Serial.printf("totalBytes %lu\n", fsi.totalBytes);
    Serial.printf("usedBytes %lu\n", fsi.usedBytes);
    Serial.printf("blockSize %lu\n", fsi.blockSize);
    Serial.printf("pageSize %lu\n", fsi.pageSize);
}
void loop() { }

Code Serial Output (after 3x RST):
obrazek

and Arduino Serial Monitor output:
obrazek

@adams13x13
Copy link

@milanbx

The line at 14:14:43.263 should be boot-loader output at 74880 baud. It is strange, but normal. ;-)

I have an impression, the serial monitor in VS Code starts to work properly about 2 seconds after "opening". Try to print something later (i.e. increase the delay of 500 ms to 3000) or print in the main loop like every second (not continuously). Also waiting between Serial.begin() and first Serial.println() could be useful. Or first activate the serial port in VS Code and then reset the ESP.

@milanbx
Copy link

milanbx commented Feb 11, 2022

Well, I may try this, but every single sketch I have made until today (dozens) runs and prints to serial without any delays, even without the initial 500ms like here!

@milanbx
Copy link

milanbx commented Feb 11, 2022

OK, I have increased the initial delay to 1s and right after the sketch bin is uploaded and "Hard resetting via RTS pin..." done, the sketch starts and works fine (prints all lines as expected). However, the output is somehow snatchy, the lines are not printed at once. This is not appening in Arduino serial monitor, wher the output is fluent.
Moreover, everything described here is happening only to the first hardware reset. After that no output is given except "r$". And again, this does not happen in Arduino, where every reset just resets the sketch and prints the initial sequence over and over again. Strange...

@benmcmorran
Copy link
Member Author

@milanbx which version of the Arduino extension are you using? We made some major changes to the way serial works in version 0.4.11 that should help with handling reset, but please let me know if you're still seeing issues.

The "snatchy" behavior you see is likely related to #1412 which was required to avoid blocking the output window when there was a lot of data on the serial port. Does data appear roughly 3 times a second? That's the flushing interval for the output window.

@milanbx
Copy link

milanbx commented Feb 15, 2022

I am using 0.4.11 Preview and it seems, that no more issues appear. You may consider this case closed for now. Thanks a lot for help.

@benmcmorran
Copy link
Member Author

Thanks for following up! Closing this issue.

@github-actions github-actions bot removed the needs-more-info More details about this issue are needed for it to be actionable. label Feb 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants