adafruit / adafruit/Adafruit_TinyUSB_Arduino

Serial crash when receiving incoming data faster than handled

Open
#293 34 comments 0 reactions 0 assignees View on GitHub
Bug
Dominant language
C
Stars
654
Forks
183
PR merge metrics
No merged PRs in 30d

Description

### Operating System

Linux

### Arduino IDE version

Platform.io with

### Board

pico

### ArduinoCore version

earlephilhower#master

### TinyUSB Library version

2.1.0

### Sketch as ATTACHED TXT

The attached program just returns input or output '.' when no output is available, as fast as possible.
It limits the rate to 1000 characters per second, by using a delay in the loop.

[serial-crash.zip](https://github.com/adafruit/Adafruit_TinyUSB_Arduino/files/11343867/serial-crash.zip)

Using that program writing data from the host will quickly crash the pico (like by pasting 10 lines of codes again and again)
When crashed, the pico won't reboot for sketch upload.

Removing the delay in the loop seems to avoid crash of the program.

I've tried running on the second core, with the same results.

### Compiled Log as ATTACHED TXT

No log available

### What happened ?

The pico becomes unresponsive. Serial seems dead.

### How to reproduce ?

Run the attached platform io program
Watch the serial monitor
Send bunch of data

The output will stop at some point, the pico won't even reboot.

### Debug Log

_No response_

### Screenshots

_No response_

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by running the attached serial-crash.zip PlatformIO program on a Pico under Linux, then send repeated bursts of data while the loop is rate-limited. Compare behavior with and without the delay and inspect the serial handling path for the cause of the crash. Done means sustained incoming data no longer makes the Pico unresponsive or prevent sketch uploads.

Written by the indexing model from the issue text.

Assessment

Tech stack
arduino, c
Domain
embedded-iot
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
56/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.