Skip to content
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

Need Clarity on Arduino and Portenta with Native USB causing hanging #929

Open
custeve opened this issue Jul 23, 2024 · 1 comment
Open

Comments

@custeve
Copy link

custeve commented Jul 23, 2024

** Copied from a post on the Arduino Portenta H7 forum:

I'm struggling to understand why I am not finding more information about the best approach to handle the native USB Serial port on an H7, in my case, on a Portenta Machine Control device. After hours of trying to determine why any simple Arduino Portenta example for Ethernet connectivity hangs when the USB cable is removed from the device - the problem being Ethernet related was a red herring. Finally, commenting out all the Serial.* statements in my code, fixed the problem.

So - what is the standard approach for the typical Arduino "Serial.print" debugging approach, if Serial.print statements will brick the current running code if the USB cable is not connected? I may look at my own code at the moment to see if I can easily detect the condition, and skip the print statements, but I would expect this to be handled better by the Arduino core for the mbed devices. Removing all the Serial.print statements from a large codebase, so you can run it with the USB disconnected, is not practical, nor does it promote an Arduino standard usage.

Am I missing something here???

An example of my issue - The included WebServer.ino script in Arduino Portenta H7 Examples. Works fine with USB connected. Bricks with USB disconnected. Works with all Serial. statements commented out.

@custeve
Copy link
Author

custeve commented Jul 23, 2024

I have some more info... after tinkering some more, this morning, the issue was occurring when USB had been connected and then disconnected - regardless of the existence of the While(!Serial.... check in the setup. Eliminating the check AND rebooting the Portenta after disconnecting the USB is they key.

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

No branches or pull requests

1 participant