Skip to content

When the USB is not connected and the COM port is not open, system crashes. #527

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
stnih opened this issue May 19, 2019 · 3 comments
Closed
Assignees
Labels
duplicate This issue or pull request already exists

Comments

@stnih
Copy link

stnih commented May 19, 2019

When COM port is open ;

  • LED_BLUE is blinking.
  • Green led on when I press the button.

When COM port is close or USB unconnection ;

  • LED_BLUE blinking several times and stops.
  • Green led not working when I press the button.

System crashes when the com port is not open. How can we deal with this?

void setup()
{
	pinMode(LED_BLUE, OUTPUT);
	pinMode(LED_GREEN, OUTPUT);
	pinMode(USER_BTN, INPUT);
	
	SerialUSB.begin();
}

void loop()
{
	SerialUSB.println("Hello from app.");
	
	digitalWrite(LED_BLUE, !digitalRead(LED_BLUE));
		
	if (digitalRead(USER_BTN) == HIGH) {
		digitalWrite(LED_GREEN, HIGH);
	}
	else {
		digitalWrite(LED_GREEN, LOW);
	}
	
	delay(100);
}
@fpistm
Copy link
Member

fpistm commented May 19, 2019

H @stnih Which board, host os, core version , build options,...

@stnih
Copy link
Author

stnih commented May 19, 2019

Board : Discovery
Board part number : STM32F407G-DISC1
Host OS : Windows 10
Version : 1.5.0
Arduino Version : 1.8.9

What is build options?

When USB unconnection, LED_BLUE blinking several times and stops. I don't think it is caused by the operating system.
When I open the com port after connecting usb to the computer, LED_BLUE continues blinking.

@fpistm fpistm self-assigned this May 20, 2019
@fpistm fpistm added the duplicate This issue or pull request already exists label May 20, 2019
@fpistm
Copy link
Member

fpistm commented May 20, 2019

Hi @stnih
As I though, it is already corrected on master thanks #444
I've tested with 1.5.0 and reproduced your issue. On top of the master it is now ok.
In fact, this is not really a system crash, only a blocking state.

@fpistm fpistm closed this as completed May 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants