arduino / arduino/ArduinoCore-mbed

Need Clarity on Arduino and Portenta with Native USB causing hanging

Open
#929 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
411
Forks
225
PR merge metrics
No merged PRs in 30d

Description

** 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.

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the included WebServer.ino example from the Arduino Portenta H7 Examples with the USB cable connected and disconnected, noting where Serial.* calls cause the hang. Then trace the ArduinoCore-mbed native USB Serial entry point and determine the expected behavior; done means the example runs without USB connected while retaining its Serial statements, with the standard approach identified.

Written by the indexing model from the issue text.

Assessment

Tech stack
arduino, c
Domain
embedded-iot
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.