I'm both sending and receiving strings to Arduino from my Python program on the PC and the opposite. I don't check by code if one is finished before doing the other. Are they seprate buffers, or is it just pure luck my program has been running fine until now and each program has been reading the right string ?

  • 1
    Yes there are separate buffers for Tx and Rx.
    – Nick Gammon
    Sep 24 '15 at 21:30

There shall be separate buffers for Tx and Rx (in Arduino Serial library). The actual buffer size may vary, but shall be around 8-16 bytes and there is also hardware buffer in MCU. Please try to increase serial baudrate, if possible.

UPD: In HardwareSerial.h:

#if (RAMEND < 1000)


unsigned char _rx_buffer[SERIAL_RX_BUFFER_SIZE];
unsigned char _tx_buffer[SERIAL_TX_BUFFER_SIZE];

It seems for Atmega328 the buffers are 16 bytes each

UPD: As Nick pointed, for Atmega328:

#define RAMEND       0x8FF     /* Last On-Chip SRAM Location */

So the buffers are 64 byte each.

  • What is Tx and Rx mean? Also, who downvoted the answer? If it is incorrect or unrelated, please comment what the issue is.
    – Leo Ervin
    Sep 24 '15 at 21:06
  • 1
    It was probably downvoted for factual inaccuracy. The Atmega328 has 2048 bytes of RAM and therefore the buffer will be 64 bytes, not 16. Tx is shorthand for Transmit and Rx is shorthand for Receive. Why? Historical reasons probably.
    – Nick Gammon
    Sep 24 '15 at 21:29
  • Well knowing they are separate is all I needed to know. I was worried that writing to Serial then reading could result in reading (a part of) what I had written to it. That would cause some issues. However, this might not only depend on the buffer...
    – Leo Ervin
    Sep 24 '15 at 21:44
  • BTW, you don't plainly downvote for inaccurate number, you point it out as comment and/or edit the post. That was just plain rude.
    – Leo Ervin
    Sep 25 '15 at 10:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.