nantais

We are evaluating the Due for a project and it all looks great except for the 64-byte receive buffer for serial communications. I realize the 1.5 code is still in beta and it is a port of the earlier product. Does anyone know if this buffer is going to be increasing in size before the release? I know that the past code has had to run on some very limited hardware -- is that going to be the case with 1.5 or is it just for Due and better? Our project involves a chatty serial protocol running at 115,200, which means we have to poll that buffer every 5 ms or we lose data. We'd be much more comfortable with another order of magnitude and it definitely seems as though the Due can afford that. But if 1.5 is eventually going to run on hardware with 2K of SRAM, I can understand the decision to limit to 64 bytes and we'll look for another platform.

nantais

AFAIK it's just a matter of changing the SERIAL_BUFFER_SIZE #define in HardwareSerial.cpp, however the same value is used for both Tx and Rx so you waste a lot of RAM if your comms is one-sided.

This should really be a parameter or another Serial method call IMO.

______Rob

That makes a lot of sense. There are two issues that I know of. The first is that 1.5 doesn't appear to be using a Tx buffer from what I see in the sourcecode. I might be wrong about that, but at first read it appears to be the case. The single-byte write() method has a spin lock until the TXRDY status bit is set. We're working around that by testing TXRDY ourselves in the main loop() and only calling write() when we know the bit is set. The second issue is that we would need to make sure the variables in the ring buffer are being updated atomically if they're going to be holding values bigger than 255. That's probably true for the Due, but we would need to be sure.