@jan-reitinger
I as understand it, multi master is possible on modbus TCP, that is what I am using. I tried your solution with the enable flags, and it works for a short time :
The main problem now is that the rexygen modbus reads are very unreliable:
When I use the 'SRTF' version i see timeouts in the log, I don't see those when I use the 'enable' version. But still the SRTF version seems to work slighly better.
If I use labview or python I don't have any problems controlling or reading from the same device..
For example if I run the following python script from the command prompt:
import timeit
timeit.timeit('client.read_holding_registers(45399).registers',
setup='from pymodbus.client import ModbusTcpClient; client=ModbusTcpClient("192.168.169.100")',
number=1000)
it returns about 2.4 sec for 1000 runs repeatable and without errors.
If I replace the level 0 task with a basically empty task (just display a constant), it behaver better, I don't see the errors.
My level 0 tick is 0.002 and the level 1 loop time is 0.002 * 50 = 100ms. :
My thinking is the level tasks should have plenty of time to do their job but apparently the leverl0 job seems to ruin things. This task is a PIDE regulation block that has not given me any problems so far.
What is preventing the reading of the modbus registers?