Skip to content

Serial Port Not Found error after upload when serial monitor is open #1394

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
gfvalvo opened this issue Oct 9, 2021 · 7 comments
Closed

Comments

@gfvalvo
Copy link

gfvalvo commented Oct 9, 2021

Hi.
Running Sloeber 4.4 Product on Win 10 Desktop. Problem Code:

#include <Arduino.h>
#include <deque>

std::deque<uint8_t> myQueue;

void setup() {
	Serial.begin(115200);
	delay(1000);
	Serial.println("Starting");
	myQueue.push_back(100);
}

void loop() {
}

Note that the code won't compile if the 'Serial.println()' statement is omitted. That's a known toolchain (linker) issue. Not the problem I'm asking about here.

The above code compiles, but after the Teensy Loader uploads to the T3.6, Sloeber gives this error:
image

If I comment out the 'myQueue.push_back(100)' statement, the error does NOT occur.

This problem does not happen uploading the same code to the same Teensy 3.6 using Arduino 1.8.15.

Project Properties:
image

Let me know if you require further information.

Thanks.

@jantje
Copy link
Member

jantje commented Oct 9, 2021

That is a really wierd behaviour.
The teensy upload does not use com ports. Setting the com port in the project properties->arduino for a teensy is only interesting if the USB type is amongst others serial (as in your case) and you use the open serial monitor button on the toolbar and/or want to disconnect reconnect the serial monitor during upload.

So my current thinking is that you have a serial monitor running watching com port 6 and the reconnection to com port 6 fails.
The "show error log" or the "details" button could give more info.

@gfvalvo
Copy link
Author

gfvalvo commented Oct 10, 2021

Yes it's odd. Don't think I every had this issue with Sloeber 4.3.1. But, may be I didn't use std::deque<uint8_t> before. Wonder if it's related to the toolchain issue. Here's my post on at that on Teensy forum: https://forum.pjrc.com/threads/68342-std-deque-Won-t-Compile-for-Teensy-3-x

Right, Serial Monitor was open. I closed it and had no issue with the upload. Then opened Serial Monitor and it was OK.
So, that's a workaround.

Thanks.

@jantje
Copy link
Member

jantje commented Oct 10, 2021

I think it is a timing issue. Sloeber tries to open the com port before the com port is available after upload.
For one reason or another std::deque<uint8_t> causes the com port to be available later then without it.
There are many possible reasons for that. But finding the reason is kind of useless (to me as Sloeber maintainer). Waiting longer/smarter for the com port to become available seems a better approach to fix this issue.

jantje pushed a commit that referenced this issue Oct 17, 2021
jantje pushed a commit that referenced this issue Oct 18, 2021
@jantje
Copy link
Member

jantje commented Oct 18, 2021

It was indeed a racing condition and as I optimized the upload code this racing condition happened more often.
Therefore I added code to wait for the com port to show up.
Should be fixed in the next nightly or find the latest version in actions

@jantje jantje closed this as completed Oct 18, 2021
@jantje jantje changed the title Serial Port Not Found Teensy 3.6 --- Only When Certain Code is in Program Serial Port Not Found error after upload when serial monitor is open Oct 18, 2021
@gfvalvo
Copy link
Author

gfvalvo commented Jan 4, 2022

Should be fixed in the next nightly or find the latest version in actions

How does one install and use the "nightly"? What does "latest version in actions" mean?

@jantje
Copy link
Member

jantje commented Jan 4, 2022

How does one install and use the "nightly"? What does "latest version in actions" mean?

As explained here http://eclipse.baeyens.it/nightly.php
If you want try to upgrade your environment you can use the nightly update site
I however advice to download and install the product from the actions https://github.com/Sloeber/arduino-eclipse-plugin/actions?query=branch%3Amaster
Do not forget to take a backup of you workspaces and installs as needed

@gfvalvo
Copy link
Author

gfvalvo commented Jan 4, 2022

Perfect. Thank you. And, thanks for a great product.
Not being a tool-guy, I only install the complete product (in new location) and never attempt an "upgrade".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants