adafruit / adafruit/Adafruit_TinyUSB_Arduino
nRF52 crashes with longer strings in .print()
- Dominant language
- C
- Stars
- 654
- Forks
- 183
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
Passing in strings over a certain length freezes the device.
May be related to buffer overflow? looks like it crashes after 64 characters.
**Set up (please complete the following information)**
- nRF52840 Feather Express
- TinyUSB library version: 0.8.2
- MacOS 10.15.4
- Chrome 83
**To Reproduce**
Steps to reproduce the behavior:
1. Open `webusb_serial` example [here](https://github.com/adafruit/Adafruit_TinyUSB_Arduino/blob/master/examples/WebUSB/webusb_serial/webusb_serial.ino#L79)
2. change line *79* from
`if ( connected ) usb_web.println("TinyUSB WebUSB Serial example");`
to
`if ( connected ) usb_web.println("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.");`
3. Compiles & upload as expected
4. Connect via https://adafruit.github.io/Adafruit_TinyUSB_Arduino/examples/webusb-serial/
5. Notice expected string gets only partially returned and devices is unresponsive.
**Expected behavior**
Full string is printed out via web_usb without crashing
**Screenshots**
If applicable, add screenshots to help explain your problem.

**Additional context**
Seems to work as expected on SAMD21 boards
Tested in Chrome 83.0.4103.14 and Brave browser (Chromium)
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with examples/WebUSB/webusb_serial/webusb_serial.ino at line 79 and reproduce the long-string case on an nRF52840 Feather Express using the stated browser and TinyUSB versions. Compare the behavior with SAMD21 boards; done means the complete string is returned through WebUSB without the device becoming unresponsive.
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
- Mostly clear
- Newbie friendliness
- 45/100