arduino / arduino/ArduinoCore-samd

Cannot receive the data when data length exactly 64 or 128 bytes

Open
#391 4 comments 0 reactions 0 assignees View on GitHub
bug Component: USB-CDC
Dominant language
C
Stars
502
Forks
740
PR merge metrics
No merged PRs in 30d

Description

I tried to write the data to Arduino MKR Zero but always read 0 (Serial1.println(SerialUSB.available());) when data size exactly same as 64 bytes or 128 bytes. send 256bytes are fine.

If I work around this by issue another transaction to send the last bytes of 64/128byte data.

```
#Host side
if len(msg)%64 == 0 and len(msg) != 256:
self.comm.write(msg[0:len(msg)-1])
self.comm.write(msg[len(msg)-1:])
```

Does anyone meet this issue?
Thanks

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing USB serial transfers of exactly 64, 128, and 256 bytes on the Arduino MKR Zero, checking SerialUSB.available() and comparing them with the split-write workaround shown in the issue. Trace the SAMD21 serial receive path to determine why the boundary-sized transactions are not readable; done means 64- and 128-byte messages are received without an extra transaction.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.