Does Linux Have a Maximum Buffer Size for Serial on Embedded Systems?

hey @melta101 are you aware if Linux has had a set maximum buffer size for serial?
24 Replies
32bitSaviour
32bitSaviour2mo ago
I am working on a 32-bit embedded Linux, kernel is 2.6 running on a 64mb device.
32bitSaviour
32bitSaviour2mo ago
Trying to stream in some 2MB of data into the device but get stuck after reading in a couple of KBs.
32bitSaviour
32bitSaviour2mo ago
dmesg gives me circ_buf_get err now with c:<no of bytes>
melta101
melta1012mo ago
for which device is it?
melta101
melta1012mo ago
i have seen TI's related driver have a default of 2kB as buffer normally
melta101
melta1012mo ago
honestly if possible, try using HW/SW control to stream data
32bitSaviour
32bitSaviour2mo ago
a proprietary device datasheet is very vague on speccific
attachment 0
32bitSaviour
32bitSaviour2mo ago
been thinking it is an algorithmic issue.
melta101
melta1012mo ago
most probably, as 2kB is more than enough for buffer
melta101
melta1012mo ago
i would either break the stream into small payloads or use some form of control flow
32bitSaviour
32bitSaviour2mo ago
@melta101 it was a HW constraint issue. The device is configured to accept only 16K of data at a go. I simply just read 16K then send an ack byte to inform the sender to give me more data. The implementation is a bit slow since I need to read the data over 128 iterations.
melta101
melta1012mo ago
ahh, That's nice how were you able to find it to be HW contraints
32bitSaviour
32bitSaviour2mo ago
An almost strongly worded email to the manufacturer of the device, asking for docs, but I was only offered the buffer size constraint.
32bitSaviour
32bitSaviour2mo ago
I am thinking how easy it would be to use setvbuf with the serial file descriptor for automated streaming. Maybe I will run away from those loops.
melta101
melta1012mo ago
what's the prob with the fragemented approach, like the one above, other than some overhead, it should be fine
32bitSaviour
32bitSaviour2mo ago
the solution is perfectly fine but if I could be faster. Be greater, since theoretically with 115200 baud and some 100ms of copying to another buffer and sending back ack, the stream should take about 3 minutes.
ZacckOsiemo
ZacckOsiemo2mo ago
Stupid question DMA?
32bitSaviour
32bitSaviour2mo ago
It's a linux box and the serial is usb. DMA would be overkill. Killing a cockroach with an atomic bomb and not even achieving better results, not dying faster.
ZacckOsiemo
ZacckOsiemo2mo ago
Ah I see, same round trips too if the hardware limit exists
32bitSaviour
32bitSaviour2mo ago
Exactly. I am thinking I can shave off sometime with a bigger baudrate... I'll see. And cut out buffer copying with setvbuf... not sure how that'll work, yet.
melta101
melta1012mo ago
which subset of USB? serial, or acm?
melta101
melta1012mo ago
or something else?
32bitSaviour
32bitSaviour2mo ago
ACM, I think the driver is custom or a modified version of some bcm usb cdc
32bitSaviour
32bitSaviour2mo ago
At least that what I have gathered from a bit of digging. But I realize it has become irrelevant, what I need to solve is more high level at this point.

Did you find this page helpful?