This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Modbus Profile Write Errors
#1
Hi,

We've an installation where there are two modbus RTU slaves connected to port 1.
These devices only allow single register read/write and its max timeout is 2.1 seconds.
Reading works pretty well using 3 timeout seconds, but when writting sometimes it returns "Write failed: Operation timed out"

When this happens what does modbus mapper do? Try to write it again?
If not, on next reading poll will KNX object be updated to previous value (read from modbus) or will it remain as it has been written?
Is there any way to be sure that the value has been written?

How are writes managed? Are it done after the slave reading poll? Or is it interrupted and the write is done and then readings resumed?

Thanks
Reply
#2
The mapper writes only once. No retry is done in case of an error. Next write is triggered when new group write happens. Writes do not interrupt reading.
As a workaround you can resend the values periodically: https://forum.logicmachine.net/showthread.php?tid=1878
Reply
#3
(21.02.2024, 14:42)admin Wrote: The mapper writes only once. No retry is done in case of an error. Next write is triggered when new group write happens. Writes do not interrupt reading.
As a workaround you can resend the values periodically: https://forum.logicmachine.net/showthread.php?tid=1878

And is there any way to know to which register is the error refered? To resend it only when necessary....
Reply
#4
You can create a profile with two definitions per each register - control (write-only) and status (read-only). Then you can compare control and status values and act accordingly.
Reply
#5
(21.02.2024, 14:58)admin Wrote: You can create a profile with two definitions per each register - control (write-only) and status (read-only). Then you can compare control and status values and act accordingly.

Ok i'll try it.

Thanks!
Reply
#6
(21.02.2024, 14:58)admin Wrote: You can create a profile with two definitions per each register - control (write-only) and status (read-only). Then you can compare control and status values and act accordingly.

Are delays applied to writes? If for example 3 writes to different registers are queued how are they managed? Because it seems that this device only accepts one write for second...
Reply
#7
Hi,

I've been doing some tests using a modbus sniffer and it seems that after reads, writes are done without any delay and I think that's why the slave can't manage it... Is there any way add a delay between writes?
Reply
#8
In profiles there is only read delay option. You can use modbus proxy script for writing and handle it there.
------------------------------
Ctrl+F5
Reply
#9
Do you have any mbproxy functions list? And how to use them?
Reply
#10
Some examples here
https://forum.logicmachine.net/showthrea...7#pid22637
------------------------------
Ctrl+F5
Reply
#11
Hi,
I've done some tests using this code:

Code:
mbproxy = require('mbproxy')
mb = mbproxy.new()
mb:setslave(1)
log('write')
local a=mb:writemultipleregisters(48094, 1)
log('a: '..a)
local b=mb:writemultipleregisters(48092, 480)
log('b: '..b)

I don't know how to add a delay between them... It seems that both are queued and executed when polling cycle is finished (sometimes the second one is written on the next cycle...) and sometimes writemutipleregisters returns nil (is it when value has not been written?)

I need to manage some kind of writting queue, writing registers one by one (using function 16) with 1 second delay between them...

Don't know if it's possible in some way....
Reply
#12
Use os.sleep(1) between writes
------------------------------
Ctrl+F5
Reply


Forum Jump: