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

String data = USBCOM.readString(); #9969

Open
1 task done
Red-Owl opened this issue Jun 30, 2024 · 4 comments
Open
1 task done

String data = USBCOM.readString(); #9969

Red-Owl opened this issue Jun 30, 2024 · 4 comments
Assignees
Labels
Chip: ESP32-S3 Issue is related to support of ESP32-S3 Chip Resolution: Unable to reproduce With given information issue is unable to reproduce

Comments

@Red-Owl
Copy link

Red-Owl commented Jun 30, 2024

Board

ESP32 wt32-s3-wrover (wt32sc01 plus)

Device Description

ESP32 wt32-s3-wrover (wt32sc01 plus)

Hardware Configuration

ESP32 wt32-s3-wrover (wt32sc01 plus)

Version

v2.0.16

IDE Name

Platformio

Operating System

win11

Flash frequency

40mhz

PSRAM enabled

yes

Upload speed

115200

Description

ERROR A stack overflow in task usbd has been detected.

Sketch

void usb_as_serial_read(){
    String data = USBCOM.readString();
}

Debug Message

***ERROR*** A stack overflow in task usbd has been detected.


Backtrace: 0x40378296:0x3fcb8c90 0x4037d7e9:0x3fcb8cb0 0x40380c9a:0x3fcb8cd0 0x4037f49c:0x3fcb8d50 0x4037d8a0:0x3fcb8d80 0x4037d896:0x00000000 |<-CORRUPTED

Other Steps to Reproduce

send via serial monitor a INFO string in repeat mode repeat 10
arrow up, INFO enter
arrow up,INFO enter
arrow up,INFO enter
....
panic !!
or send \r\n
panic !!

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.
@Red-Owl Red-Owl added the Status: Awaiting triage Issue is waiting for triage label Jun 30, 2024
@lbernstone
Copy link
Contributor

Once again, programming error. Don't pass Strings (or any large object) around, use pointers. USBCOM is not part of the code here. For help with 3rd party libraries, you need to contact the author.

@SuGlider SuGlider self-assigned this Aug 2, 2024
@SuGlider
Copy link
Collaborator

SuGlider commented Aug 2, 2024

@Red-Owl - please provide more details about how to reproduce this issue.
What is USBCOM obejct? Is it an external library as commented by @lbernstone?

@SuGlider
Copy link
Collaborator

SuGlider commented Aug 2, 2024

ESP32-S3 has two possible USB CDC objects: from HW Serial JTAG and from USB OTG. Both implement Stream which allows to execute Serial.readString() whenever Serial is configured as the USB port.

Is that the issue?

@SuGlider
Copy link
Collaborator

SuGlider commented Aug 2, 2024

Arduino Core 3.0.3 works fine, using S3 with HWSerial_JTAG and with USB_OTG.

void setup() {
  Serial.begin();
  Serial.setDebugOutput(true);
  while (!Serial) delay(100);
  Serial.println("Starting...");
  log_i("Starting from LOG_I");  // testing DBG ouput
}

void loop() {
  String data = "";
  data = Serial.readString(); // timeout is 1 second by default. This function will take 1 sec to return.
  if (data.length() > 0) { 
    Serial.println(data);
  } else {
    Serial.println("Loop: No data read.");
  }
}

@SuGlider SuGlider added Resolution: Unable to reproduce With given information issue is unable to reproduce Chip: ESP32-S3 Issue is related to support of ESP32-S3 Chip and removed Status: Awaiting triage Issue is waiting for triage labels Aug 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Chip: ESP32-S3 Issue is related to support of ESP32-S3 Chip Resolution: Unable to reproduce With given information issue is unable to reproduce
Projects
None yet
Development

No branches or pull requests

3 participants