I've changed the connection to serial and also I've tried connect terminators 120ohm on the start and at the end of the bus and still there are a lot of timeouts. Now I've connected this only energy meter to the RS-485-2 (very short distance ~5m) and I am trying read values from it via resident script but also there are a lot of timeouts How can I change timeout of every request on resident script?
This is what I am using now for testing:
This is what I am using now for testing:
Code:
require('luamodbus')
mb = luamodbus.rtu()
mb:open('/dev/RS485-2', 9600, 'N', 8, 1, 'H')
mb:connect()
mb:setslave(4)
-- L1 - N
-- read 32-bit floating point value from input register nr 123, use word swap
res, err = mb:readinputregistervalue(0, "float32", "w")
log(res, err)
-- L2 - N
res, err = mb:readinputregistervalue(2, "float32", "w")
log(res, err)
-- L3 - N
res, err = mb:readinputregistervalue(4, "float32", "w")
log(res, err)
mb:close()