MODBUS RTU slave.poll() return always 0

Hello everyone!

I'm using two arduino and one rasperry connected by rs485 ModBus, my goal is send from arduino_1 (master+slave) to raspberry_2 (master) the data received from the arduino_2 (slave).

Raspberry_1 (master) makes a call to arduino_1 (slave) and next arduino_1 (master) makes a call to arduino_2 (slave)

I tried arduino_1 can do at the same time master and slave so I think that arduino_1 can do as a concentrator for arduino_2, arduino_3 ... arduino_n but I need to intercept in arduino_1's code when the raspberry (master) calls him so I wrote:

Rxstate = slave.poll(au16regs, 16);
if (Rxstate >4) {
to do.... (call to arduino slave)

}

but Rxstate (uint_8 type) is always 0.
I check the code of ModbusRtu.h and I see slave.poll() process should return a value of i8state (4 < i8state < 7) if no exception occurred .
Why slave.poll() function returns always 0?

thank you for answer.

Hi, I have tested arduino as master and slave modbus rtu in this blog documentation exists about the exception occurs in the debug terminal arduino ide? I used the functions read and write holding registers.

best regards,