Usage of Modbus RTU Master and Modbus RTU Client simultaneously

Hello,

We want to use a nrf52840 as a logic controller which reads data from Modbus RTU Sensors (as Modbus RTU Master) and simultaneously is the Modbus RTU Server for an higher unit, which reads calculated values and process values from a bunch of nrf52840-devices. When trying to implement both in one application, by enabling both roles in the conf, some functions of the master implementation become undefined:

CONFIG_MODBUS=y
CONFIG_MODBUS_ROLE_CLIENT=y
CONFIG_MODBUS_ROLE_SERVER=y
 

c:/ncs/toolchains/cf2149caf2/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: app/libapp.a(main.c.obj): in function `main':
C:/path/to/the/project/workspace/evaldemo/src/main.c:281: undefined reference to `modbus_read_holding_regs'

When using only one role at a time, the sample works fine.

Is there a way to use both roles in one application? (of course on different interfaces, therefore we choose the nrf52840 instead of the nrf52832, which only has one UART interface)

Thank you!

BR Thomas

Related