Closed thaanstad closed 4 years ago
yeah, increasing serial buffer can be useful for some project. Do you mind submitting a PR for this ?
@thaanstad since you label this as feature, please update your post to use the feature template
I’d be interested in implementing this feature. I think the thing that makes the most sense is to add a second optional argument to serial.begin since this buffer probably shouldn’t be changed after serial has been opened
@huddy987 It should have its own API setBufferSize(tx, rx)
. It can be a bit complicated since USB CDC fifo is part of tinyusb config file. The hardware UART on 832 can probably easier.
PS: this issue is closed since OP failed to response to my request. You could open an separated issue using the feature template.
I have a function called processSerialCommand() that reads data from the serial port and then uses serial comparisons to process the desired functions. It utilizes some data parsing with semicolons to get the data as required. It isn't very efficient and it is also very memory intensive but on the other hand it is very easy to use and read. When passing a serial command from the computer and the command is large enough the serial buffer on the NRF52832 isn't large enough to capture the whole command and the data is lost. I was able to increase the SERIAL_BUFFER_SIZE in the core (RingBuffer.h) from 64 to 256 and since then haven't had issues. I am interested in either increasing the size of this in the core or allowing the user to change it to their needs during setup possibly prior to or during Serial.begin().
//simple way to pass serial commands to MCU. command format is: command;data;data; (up to 8 data entries) //The user can retrieve the values as floats or as strings as shown in the examples bool processSerialCommand(Stream *ptrSer) { if (ptrSer->available()) { delay(100); char prevChar; char inputCharacter; String inputData;
}
Perhaps there is another solution but I would be interested in being able to define the size of the serial buffer per my projects requirements. Something like Serial.setBuffer(256). Perhaps the ringbuffer class could have a new constructor that allows allocating this size. In the Uart class the rxBuffer could be pointer to a RingBuffer object and then it would be easy to define a new RingBuffer object with this increased buffer size. If this seems reasonable to others I can try to implement and test it otherwise I am open to other suggestions as to how this would best be implemented.