Forum Rule: Always post complete source code & details to reproduce any issue!
-
Serial.addMemoryForWrite
I know I am late to the party but I have only recently discovered the very useful methods
such as
Serial1.addMemoryForRead(s1RxBuffer, sizeof(s1RxBuffer));
Serial1.addMemoryForWrite(s1TxBuffer, sizeof(s1TxBuffer));
which work nicely for me.
But when I try this
Serial.addMemoryForWrite(s1TxBuffer, sizeof(sTxBuffer));
I get the this
error: 'class usb_serial_class' has no member named 'addMemoryForWrite'
So Serial does not have methods such as 'addMemoryForWrite'.
Why is this?
Is there no need to adjust the receive and transmit buffer sizes for Serial?
Why?
Peter.
-
Senior Member+
"Serial" uses USB, which is orders of magnitude faster and additionally uses USB buffers that are larger than those for HW serial.
The code is completely different.
-
Senior Member

Originally Posted by
PDOS
Is there no need to adjust the receive and transmit buffer sizes for Serial?
Usually not.
Because USB virtual serial has built-in flow control as a fundamental part of the underlying USB protocol.
Usually RTS/CTS flow control with ordinary serial eliminates the need for larger buffers too.
-
Senior Member+
Sure, for receive.
For transmit, larger buffers allow to fill them without beeing forced to wait.
-

Originally Posted by
Frank B
Sure, for receive.
For transmit, larger buffers allow to fill them without beeing forced to wait.
Thanks for the answers. Yes, my concern, as Frank noted, was to transmit big blocks of data over Serial without adding undue delays within the main loop. But my blocks are in any case going out suspiciously fast, so it appears there are already quite big buffers in place.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules