rtu brodcast not work on 3.1.4 ...

26 views
Skip to first unread message

giorgio foga

unread,
Apr 28, 2017, 4:10:25 AM4/28/17
to libmodbus
i read the post at gihub about brodcast messages .... but is not possible send brodcast messages in RTU mode to multiple slave.... the slave bring it (ctx = 0) as a normal slave ID so the slave with ctx > 0 not receive the writing messages at all ...

regards
giorgio

Stéphane Raimbault

unread,
Apr 28, 2017, 4:30:12 AM4/28/17
to libm...@googlegroups.com
Could you explain what to you mean by normal slave ID (0 is reserved for broadcast).

I see the test isn't good because only write operations are allowed in broadcast mode


No response is returned to broadcast requests sent by the master. The broadcast requests are necessarily writing commands. All devices must accept the broadcast for writing function. The address 0 is reserved to identify a broadcast exchange.

https://github.com/stephane/libmodbus/issues/379

--
Vous recevez ce message, car vous êtes abonné au groupe Google Groupes "libmodbus".
Pour vous désabonner de ce groupe et ne plus recevoir d'e-mails le concernant, envoyez un e-mail à l'adresse libmodbus+unsubscribe@googlegroups.com.
Pour obtenir davantage d'options, consultez la page https://groups.google.com/d/optout.

giorgio foga

unread,
May 3, 2017, 4:05:33 AM5/3/17
to libmodbus
Sorry, is my horrible english .... I know these (0 is reserved for broadcast) .... but when try to send some write register with ctx=0 nothings happens .... when use ctx=255 (I know.... libmodbus use 255 as normal id) the last slave receive the writing (and last for me is ctx=5), when use ctx=1, or ctx=2 or other id slave on my chain all works perfect .... I try these on 3 plc brand ... same issue... I wrote the post because I was not sure it was a bug ... my post is like a warning to sailors ...
Your link obviusly is right (no response .....) ... I use 3.1.2 .... I must change to 3.1.4??

Regards (and real tanks for your work)
Giorgio
Pour vous désabonner de ce groupe et ne plus recevoir d'e-mails le concernant, envoyez un e-mail à l'adresse libmodbus+...@googlegroups.com.

giorgio foga

unread,
May 3, 2017, 5:14:54 AM5/3/17
to libmodbus
UPDATE .... actually instead broadcast messages I use sent single messages ... I send them in series to a slave station at a time ... after Stephane answer i try resend it with ctx = 0 .... only one messages .... after 5sec the writing ...

actually I use these snip for make connection ...

    ////////////////////////////// ini of modbus line
modbus_t
*ctx = modbus_new_rtu("/dev/ttyUSB0", 115200, 'N', 8, 1);


MyTh::MyTh(QObject *parent, bool bth4) :
   
QThread(parent), Stop(bth4)
{
   
//Debug per libmodbus
    modbus_set_debug
(ctx, false); /* i use true only for test it it seem ok*/
    modbus_set_error_recovery
(ctx, MODBUS_ERROR_RECOVERY_PROTOCOL);
   
//struct timeval responseTimeout;
   
//responseTimeout.tv_sec = timeout;
   
// responseTimeout.tv_usec = 20;
    modbus_set_response_timeout
(ctx, 2, 20);
    modbus_rtu_set_serial_mode
(ctx, MODBUS_RTU_RS485);
   
//modbus_connect(ctx);
   
if ((modbus_connect(ctx)) == -1) {
         modbus_flush
(ctx);}
}

it seems ok ... but not understand these delay on writing act..

regards
Giorgio


Reply all
Reply to author
Forward
0 new messages