I have am putting together multiple arduinos on a RS485 network (connected to Rx/Tx on the arduino and using Serial - connection via one of these https://www.ebay.co.uk/itm/272929871278) - RS485 because it is spread over quite a distance - total linear wiring approx 200m.

My question is: If I have Master, Slave1 and Slave2 on the bus, and the link is running at full speed in comms between Master and Slave1 - then what is the expected interrupt handler overhead on Slave2 in putting the incoming traffic into the ring buffer? (since as it is RS485 all devices not sending see all the traffic)

My "finger in the air" estimate is around 5%-15% at 256k baud and would scale fairly linearly with baud rate.

Does anyone have a definitive answer on this or can point to any profiling done on this?

  • A lot depends on your software. I have no information on the part you are using, can you post a link showing technical information not sales information.
    – Gil
    Aug 8, 2021 at 2:25
  • @Gil the technical isn’t really relevant. Just treat it that everything sent by any Arduino hardware serial on the link is received by every other Arduino via hardware serial
    – Simm
    Aug 8, 2021 at 8:21
  • @Gil as for the software. It doesn’t really matter. Let’s assume loop is just a busy loop doing simple mathematical operations and counting how many times it goes round the loop in 10 seconds.
    – Simm
    Aug 8, 2021 at 8:23
  • @Simm Count the clock cycles used by the ISR in different situations (buffer usage percentage - empty, half full, overflow, etc). Calculate the number of clock cycles that would pass during one byte's transmission period. Do some math. There's your answer.
    – Majenko
    Aug 8, 2021 at 9:24

1 Answer 1


So I decided a little empirical testing was in order. This is using a nano (328P)

Using a simple for loop in loop() (calculating the squares of 0 to 255) over 10 seconds with and without there being serial traffic and at different speeds.

Note: this is without any inspection of the ring buffer on incoming data - just measuring the overhead of there being traffic on the wire. The traffic on the wire was the maximum an arduino mega was able to send at that baud rate.

No load: 2600462 iterations
256k: 2381219 iterations
2M: 1349142 iterations

256k takes 8.5% of the runtime
2M takes 48% of the runtime

Code block as requested for the unit doing the timing (it includes calls to the libraries I am using for my environment, but I am sure you can abstract those away to something else and should not be significant to the stats)

uint32_t start_time;
void setup() {
    start_time = millis();

uint32_t count = 0;
uint16_t foo;
void loop() {
    byte buff[MESSAGE_BUFFER_SIZE];
    if (millis() - start_time < 10000){
        for(int i = 0; i<256; i++) {
            foo = i * i;
    else {
        if (getMessage(buff)) {
            char msg[30];
            sprintf(msg, "Count: %lu ---", count);
  • 1
    code would tell us what the test really meant in greater detail than the note. would also make the test results easier to repeat and verify
    – Abel
    Aug 8, 2021 at 12:27

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.