Error compiling Modbus library


I am trying to use the modbus mater and slave sketch from the blog but get an error when trying to compile for the D21G.

If I choose another samd21 board it compiles OK.

How can I fix this?

Arduino: 1.8.13 (Windows 10), Board: "Industruino D21G"

libraries\ArduinoModbus\libmodbus\modbus.c.o: In function `_sleep_response_timeout':

C:\Users\frank\Documents\Arduino\libraries\ArduinoModbus\src\libmodbus/modbus.c:157: undefined reference to `delayMicroseconds'

collect2.exe: error: ld returned 1 exit status

exit status 1

Error compiling for board Industruino D21G.


This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

So I have downgraded from modbus library v1.04 to v1.03 and it seems to compile OK. Is this the reccomended procedure?

Dries Van Craen
Dries Van Craen
| 0 0 0
Asked on 5/30/21, 12:12 AM

Hi, yes that example was based on ArduinoModbus v1.0.1

It seems this commit removes a line that is necessary for Industruino D21G, i have asked to include it again

In the meantime, if you want to use the current v1.0.4 you could include that line in modbus.c 

| 1 1 3
Answered on 5/31/21, 1:26 AM

Your answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

Ask a Question

Keep Informed

About This Forum

This community is for professionals and enthusiasts of our products and services.

Read Guidelines

Question tools

63 follower(s)


Asked: 5/30/21, 12:12 AM
Seen: 1312 times
Last updated: 5/31/21, 1:26 AM