Walid
Walid

Reputation: 119

Raspberry Pi USB Serial Communication

I have a project consists of (micro controller RP2040 and Raspberry pi 4), the micro controller should send 2000 bytes every 10 millisecond to the raspberry pi over USB communication, and there is an application on raspberry pi which consume this data from USB.

The issue is, if the consumer app waits 200 milliseconds and then consume from USB, this causes a bottleneck on the micro controller which leads to lose data.

How can I increase the USB buffer size of the raspberry pi? I'm working on Raspberry pi OS 32bit.

Thank you

Upvotes: 0

Views: 348

Answers (1)

David Grayson
David Grayson

Reputation: 87486

You should probably just make the consumer app faster or use a thread so it doesn't wait 200 milliseconds at the wrong time. If you can't do that, it might be possible to increase the size and number of read buffers in the Linux kernel by editing the code in cdc-acm.c. I'm not an expert on that code, but when I search for the word read_buffers I see some code that looks relevant. I'm assuming your microcontroller's USB interface is CDC ACM.

Upvotes: 0

Related Questions