arduino / arduino/ArduinoCore-samd

USBDeviceClass::send fails with payloads larger than 127 bytes.

Open
#302 18 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
502
Forks
740
PR merge metrics
No merged PRs in 30d

Description

Hi!
I am working on USB MSC device. I use PluggableUSBModule, and everything is quite good, except...
My program correctly registers Bulk SCSI endpoints and correctly responses to OS driver SCSI requests, such as Inquiry, Test Unit Ready, Read Capacity etc, all that is required for MSC SCSI device.
However when I send large data in response to Read10 request, it sends only 127 bytes, and then it fails right after that.

pseudo-example:
**uint8_t data[4096];
uint32_t len=4096;
uint32_t rl = USBDevice.send(InDataEndpoint, data, len);
/*** no output after this point, device hangs ***/**

No such problem with data length smaller than 128 bytes. Like data sent on Inquiry or Read Capacity requests.

please advise.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at USBDeviceClass::send and trace the USBDevice.send(InDataEndpoint, data, len) path used by the 4096-byte Read10 response. Reproduce the failure with payloads above and below 128 bytes; done means large transfers no longer hang while the existing smaller transfers still work.

Written by the indexing model from the issue text.

Assessment

Tech stack
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.