Skip to main content
Arduino

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

How does the Arduino handle serial buffer overflow?

How does the Arduino handle serial buffer overflow? Does it throw away the newest incoming data or the oldest? How many bytes can the buffer hold?

Answer*

Draft saved
Draft discarded
Cancel
2
  • 1
    I get the impression that if I transmit data to the Arduino and don't have an active "puller" of data on the Arduino side then if more data arrives than can fit in the buffer, it will be discarded. Can you confirm that? I had naively assumed that the transmitter would block until space available to hold the data became available. Commented Jun 19, 2015 at 18:54
  • 1
    I just looked through all that code (under /usr/share/arduino/hardware/arduino/core/arduino/HardwareSer‌​ial.cpp) and can confirm what you wrote here. The only thing I would add is that since the SRAM is 2K (RAMEND>1000) then that if statement will always use 64 rather than 16 on a Nano or an Uno. So if one would want to expand the size of the ring buffer that would be the place to change it Commented Aug 19, 2017 at 6:10

AltStyle によって変換されたページ (->オリジナル) /