Project

General

Profile

Modbus problems

Added by linuxmate about 3 years ago

Hi,
I am testing one PM3255 instrument made by Schneider Electric, with modbus RTU protocol, with new Domotiga module.
I have an original FTDI USB RS485 interface. I have set the serial communication on the device to 9600 speed, parity none, 1 bit stop.

If for example I want to read the register n. 3110 (frequency, value about 50Hz), data type declared by technical sheet as 32bit float IEEE... Domotiga read these values, for example...8110192255 ... 520192255 ...12022192255 ... 1419192255

I have attached here the user manual, with also modbus protocol technical info.

I tried also with "modpoll" utility but I don't understand the results...

./modpoll -b 9600 -p none -m rtu -t 4:float -a 1 -r 3110 -c 1 /dev/ttyUSB0 -1
modpoll 3.4 - FieldTalk(tm) Modbus(R) Master Simulator
Copyright (c) 2002-2013 proconX Pty Ltd
Visit http://www.modbusdriver.com for Modbus libraries and tools.

Protocol configuration: Modbus RTU
Slave configuration...: address = 1, start reference = 3110, count = 1
Communication.........: /dev/ttyUSB0, 9600, 8, 1, none, t/o 1.00 s, poll rate 1000 ms
Data type.............: 32-bit float, output (holding) register table

TRACELOG: Set retry count 0
TRACELOG: Set poll delay 0
TRACELOG: Open port: /dev/ttyUSB0
TRACELOG: Parameters: 9600, 8, 1, 0
TRACELOG: Configuration: 1000, 1000, 0
TRACELOG: Frame silence: 5
-- Polling slave...
TRACELOG: Read multiple floats 1 3110
TRACELOG: Send(8): 01 03 0C 25 00 02 D6 90
TRACELOG: Recv(9): 01 03 04 42 48 21 1A F7 C6
[3110]: 0.000000
TRACELOG: Close port

./modpoll -b 9600 -p none -m rtu -a 1 -r 3110 -c 2 /dev/ttyUSB0 -1
modpoll 3.4 - FieldTalk(tm) Modbus(R) Master Simulator
Copyright (c) 2002-2013 proconX Pty Ltd
Visit http://www.modbusdriver.com for Modbus libraries and tools.

Protocol configuration: Modbus RTU
Slave configuration...: address = 1, start reference = 3110, count = 2
Communication.........: /dev/ttyUSB0, 9600, 8, 1, none, t/o 1.00 s, poll rate 1000 ms
Data type.............: 16-bit register, output (holding) register table

TRACELOG: Set retry count 0
TRACELOG: Set poll delay 0
TRACELOG: Open port: /dev/ttyUSB0
TRACELOG: Parameters: 9600, 8, 1, 0
TRACELOG: Configuration: 1000, 1000, 0
TRACELOG: Frame silence: 5
-- Polling slave...
TRACELOG: Read multiple registers 1 3110
TRACELOG: Send(8): 01 03 0C 25 00 02 D6 90
TRACELOG: Recv(9): 01 03 04 42 48 1D 7C 66 EC
[3110]: 16968
[3111]: 7548
TRACELOG: Close port

Please, can someone help me to resolve the problem?
Thanks
Marcello


Replies (25)

RE: Modbus problems - Added by Alexie about 3 years ago

I can confirm the 32-bit IEEE hasn't been properly implemented (now works as 32-bit integer). I will see if it is easy to fix.

RE: Modbus problems - Added by Alexie about 3 years ago

The 32-bit IEEE should be supported in the BETA branch now. If you want to try:

cd ~domotiga
git checkout beta
git pull
./DomotiGa3.gambas

To rollback to the master:

cd ~domotiga
git checkout master
./DomotiGa3.gambas

Don't upgrade the DB, that's for later ;-)

RE: Modbus problems - Added by linuxmate about 3 years ago

I have tried the BETA versione, but unfortunately the problem now is the following: no values are read from modbus, even if the communication is ok and the polling regular.
I am shure the instrument that I am testing is working well, because already tested before in other systems.
Thanks
Marcello

RE: Modbus problems - Added by ThomasDr about 3 years ago

Hello,

Modbus have a Problem with the Register, you can start count by 0 or 1.
Next Problem is the bit sorting, big or litle indian.
a good start is reading 1 register at 3108, 3109, 3110, 3111 and 3112.
Post this here and the display value. Then i can tell you the correct setting.
I use many Schneider device at Work and think i can help you.

regards
Thomas

RE: Modbus problems - Added by ThomasDr about 3 years ago

Hello,

i have take a look at you data 3110 and 3111 looks like ok.
3110 is 16968 = 0100001001001000
3111 is 7548 = 0001110101111100
In 32 bit:
3110 + 3111 = 01000010010010000001110101111100
And in IEEE 754:
50.028793 Hz

regards
Thomas

RE: Modbus problems - Added by linuxmate about 3 years ago

Hello,
with the Thomas contribute, now I am shure that the problem is only in the Domotiga Modbus module. I hope this bug will be easy to fix.
Thanks

Regards
Marcello

RE: Modbus problems - Added by Alexie about 3 years ago

I need the debug logfile of the Modbus plugin, i currently don't know what's read calculated in your setup.

RE: Modbus problems - Added by ThomasDr about 3 years ago

Hello,

to linuxmate:
it can be the problem i tell before.
At your test software you request 3110, but the soft send 0c25 in dec 3109 to the device.
Now the question when you reqest in domotiga 3110, domotiga send 3110 or 3109?
Try in domotiga 3109 and tell us whats going on.

regards
Thomas

RE: Modbus problems - Added by ThomasDr about 3 years ago

Hello,

i am looking at your examples and i am realy sure if you tell domotiga 3110, domotiga send 3110.
If you get the 50 Hz by reqest 3109, this is not realy a bug. If Alexie change this, the next one use the Realadress and recive a bad Value.

regards
Thomas

RE: Modbus problems - Added by linuxmate about 3 years ago

Hello,
I have also made a test on Domotiga (latest beta version) with the suggestion of Thomas (address 3109 --> C25, instead of the 3110): I confirm that it doesn't work and no values are recorded in Domotiga Value section.

This is the Log, with addresses C25 (and BD4, voltage):

2016/07/08 14:48:59 [Modbus] Checksum Calc: 6C26
2016/07/08 14:48:59 [Modbus] Checksum Recv: 6C26
2016/07/08 14:48:59 [Modbus] Address: 01:C25
2016/07/08 14:48:59 [Modbus] Function: 03
2016/07/08 14:48:59 [Modbus] Register: C25
2016/07/08 14:48:59 [Modbus] Slave ID: 01
2016/07/08 14:48:59 [Modbus] Received 'Read Holding Registers' response:
2016/07/08 14:48:59 [Modbus] > 01 03 0C 25 00 02 D6 90
2016/07/08 14:48:59 [Modbus] Checksum Calc: 5D0A
2016/07/08 14:48:59 [Modbus] Checksum Recv: 5D0A
2016/07/08 14:48:59 [Modbus] Address: 01:BD4
2016/07/08 14:48:59 [Modbus] Function: 03
2016/07/08 14:48:59 [Modbus] Register: BD4
2016/07/08 14:48:59 [Modbus] Slave ID: 01
2016/07/08 14:48:59 [Modbus] Received 'Read Holding Registers' response:
2016/07/08 14:48:59 [Modbus] > 01 03 0B D4 00 02 86 17
2016/07/08 14:48:49 [Modbus] Checksum Calc: 2899
2016/07/08 14:48:49 [Modbus] Checksum Recv: 2899
2016/07/08 14:48:49 [Modbus] Address: 01:C25
2016/07/08 14:48:49 [Modbus] Function: 03
2016/07/08 14:48:49 [Modbus] Register: C25
2016/07/08 14:48:49 [Modbus] Slave ID: 01
2016/07/08 14:48:49 [Modbus] Received 'Read Holding Registers' response:
2016/07/08 14:48:49 [Modbus] > 01 03 0C 25 00 02 D6 90
2016/07/08 14:48:49 [Modbus] Checksum Calc: 0EB5
2016/07/08 14:48:49 [Modbus] Checksum Recv: 0EB5
2016/07/08 14:48:49 [Modbus] Address: 01:BD4
2016/07/08 14:48:49 [Modbus] Function: 03
2016/07/08 14:48:49 [Modbus] Register: BD4
2016/07/08 14:48:49 [Modbus] Slave ID: 01
2016/07/08 14:48:49 [Modbus] Received 'Read Holding Registers' response:
2016/07/08 14:48:49 [Modbus] > 01 03 0B D4 00 02 86 17
2016/07/08 14:48:39 [Modbus] Checksum Calc: EDBE
2016/07/08 14:48:39 [Modbus] Checksum Recv: EDBE
2016/07/08 14:48:39 [Modbus] Address: 01:C25
2016/07/08 14:48:39 [Modbus] Function: 03
2016/07/08 14:48:39 [Modbus] Register: C25
2016/07/08 14:48:39 [Modbus] Slave ID: 01
2016/07/08 14:48:39 [Modbus] Received 'Read Holding Registers' response:
2016/07/08 14:48:39 [Modbus] > 01 03 0C 25 00 02 D6 90
2016/07/08 14:48:39 [Modbus] Checksum Calc: BAF4
2016/07/08 14:48:39 [Modbus] Checksum Recv: BAF4
2016/07/08 14:48:39 [Modbus] Address: 01:BD4
2016/07/08 14:48:39 [Modbus] Function: 03
2016/07/08 14:48:39 [Modbus] Register: BD4
2016/07/08 14:48:39 [Modbus] Slave ID: 01
2016/07/08 14:48:39 [Modbus] Received 'Read Holding Registers' response:
2016/07/08 14:48:39 [Modbus] > 01 03 0B D4 00 02 86 17
2016/07/08 14:48:29 [Modbus] Checksum Calc: 2393
2016/07/08 14:48:29 [Modbus] Checksum Recv: 2393

If I try to read address C26 (and BD4)...

2016/07/08 14:54:09 [Modbus] Checksum Calc: 9BD0
2016/07/08 14:54:09 [Modbus] Checksum Recv: 9BD0
2016/07/08 14:54:09 [Modbus] Address: 01:C26
2016/07/08 14:54:09 [Modbus] Function: 03
2016/07/08 14:54:09 [Modbus] Register: C26
2016/07/08 14:54:09 [Modbus] Slave ID: 01
2016/07/08 14:54:09 [Modbus] Received 'Read Holding Registers' response:
2016/07/08 14:54:09 [Modbus] > 01 03 0C 26 00 02 26 90
2016/07/08 14:54:09 [Modbus] Checksum Calc: 09AA
2016/07/08 14:54:09 [Modbus] Checksum Recv: 09AA
2016/07/08 14:54:09 [Modbus] Address: 01:BD4
2016/07/08 14:54:09 [Modbus] Function: 03
2016/07/08 14:54:09 [Modbus] Register: BD4
2016/07/08 14:54:09 [Modbus] Slave ID: 01
2016/07/08 14:54:09 [Modbus] Received 'Read Holding Registers' response:
2016/07/08 14:54:09 [Modbus] > 01 03 0B D4 00 02 86 17
2016/07/08 14:53:59 [Modbus] Checksum Calc: 6BF1
2016/07/08 14:53:59 [Modbus] Checksum Recv: 6BF1
2016/07/08 14:53:59 [Modbus] Address: 01:C26
2016/07/08 14:53:59 [Modbus] Function: 03
2016/07/08 14:53:59 [Modbus] Register: C26
2016/07/08 14:53:59 [Modbus] Slave ID: 01
2016/07/08 14:53:59 [Modbus] Received 'Read Holding Registers' response:
2016/07/08 14:53:59 [Modbus] > 01 03 0C 26 00 02 26 90
2016/07/08 14:53:59 [Modbus] Checksum Calc: 54C6
2016/07/08 14:53:59 [Modbus] Checksum Recv: 54C6
2016/07/08 14:53:59 [Modbus] Address: 01:BD4
2016/07/08 14:53:59 [Modbus] Function: 03
2016/07/08 14:53:59 [Modbus] Register: BD4
2016/07/08 14:53:59 [Modbus] Slave ID: 01
2016/07/08 14:53:59 [Modbus] Received 'Read Holding Registers' response:
2016/07/08 14:53:59 [Modbus] > 01 03 0B D4 00 02 86 17
2016/07/08 14:53:49 [Modbus] Checksum Calc: 1F30
2016/07/08 14:53:49 [Modbus] Checksum Recv: 1F30
2016/07/08 14:53:49 [Modbus] Address: 01:C26
2016/07/08 14:53:49 [Modbus] Function: 03
2016/07/08 14:53:49 [Modbus] Register: C26
2016/07/08 14:53:49 [Modbus] Slave ID: 01
2016/07/08 14:53:49 [Modbus] Received 'Read Holding Registers' response:
2016/07/08 14:53:49 [Modbus] > 01 03 0C 26 00 02 26 90
2016/07/08 14:53:49 [Modbus] Checksum Calc: 6432
2016/07/08 14:53:49 [Modbus] Checksum Recv: 6432
2016/07/08 14:53:49 [Modbus] Address: 01:BD4
2016/07/08 14:53:49 [Modbus] Function: 03
2016/07/08 14:53:49 [Modbus] Register: BD4
2016/07/08 14:53:49 [Modbus] Slave ID: 01
2016/07/08 14:53:49 [Modbus] Received 'Read Holding Registers' response:
2016/07/08 14:53:49 [Modbus] > 01 03 0B D4 00 02 86 17
2016/07/08 14:53:39 [Modbus] Checksum Calc: 596E
2016/07/08 14:53:39 [Modbus] Checksum Recv: 596E

Bye
Marcello

RE: Modbus problems - Added by ThomasDr about 3 years ago

Hello,

i see no response.
With Domotiga release you get a response, but the wrong Value?
if you can test the last release you use before with Register 3109.

regards
Thomas

RE: Modbus problems - Added by Alexie about 3 years ago

The modbus debug output doesn't seem to be complete, i am missing the lines like:
[Modbus] Checking device named ...

Did you filter the output? If you did, please supply the full output - the current information is incomplete. You can email it to ualex73 [at] gmail [dot] com

Anyway, the address should be in format "node:register", the "register" HAS to be in HEX value. So it should be something like "1:3110".

RE: Modbus problems - Added by linuxmate about 3 years ago

I have no filters on logs, but I will send to your mail the entire log files.

"... the address should be in format "node:register", the "register" HAS to be in HEX value. So it should be something like "1:3110"... "

Excuse me: If the register has to be in HEX, should be something as my log: "1:C26" (or 1:C25 as test with the suggestion of Thoms), ok?

Bye
Thanks
Marcello

RE: Modbus problems - Added by Alexie about 3 years ago

Hi Marcello,

You're right, your manual has every in decimal ... so 3110 is C26 in hex, so it should "1:C26" as you said.

I see where it goes wrong, the address is "1:C26", but we are 'searching' for "01:C26" ... I will have a look to fix this incompatibility.

RE: Modbus problems - Added by Alexie about 3 years ago

I think i see another possible issue, we are sending the commands to quickly after eachother .. I think we need to wait before sending a second command, unless we received a response.

RE: Modbus problems - Added by ThomasDr about 3 years ago

Hello,

here a timing diagramm for Register 3000 to see current at L1,L2,L3 in Float32.
At 19200 Baud.

regards
Thomas

10000-2.png (25.9 KB) 10000-2.png Timing Diagram
2666

RE: Modbus problems - Added by Alexie about 3 years ago

I just committed the possible fix into the BETA branch, can you give it a try?

The address/device should be found now, and extended the queue timer from 100msec to 1 sec ...

RE: Modbus problems - Added by linuxmate about 3 years ago

Hi Alex,
I have tested the new beta... I am sorry but it doesn't work.
I will send you the new debug log file made after the test.

Thanks
Bye
Marcello

RE: Modbus problems - Added by Alexie about 3 years ago

Sorry it isn't working, i will have a look into your debug (thanks for the logfile!)

RE: Modbus problems - Added by ThomasDr about 3 years ago

linuxmate wrote:

If for example I want to read the register n. 3110 (frequency, value about 50Hz), data type declared by technical sheet as 32bit float IEEE... Domotiga read these values, for example...8110192255 ... 520192255 ...12022192255 ... 1419192255

Hello,
I still think the normal version works with Adress 3109.
The Value you post look like Adress 3111 and 3112.
8110192225 in Bin:
01001111111100011011001111011011
Cut off 3112:
0100111111110001
Get Adress 3110:
0100001001001001
3110 + 3111:
01000010010010010100111111110001
And you get:
50.328068 Hz

regards
Thomas

RE: Modbus problems - Added by Alexie about 3 years ago

I have been busy with personal things, but i will have a look very soon in this Modbus topic.

RE: Modbus problems - Added by Alexie about 3 years ago

Just send a fixed binary to linuxmate, it should fix the IEEE issue (the examples i had for encoding as IEEE were wrong :().

RE: Modbus problems - Added by linuxmate about 3 years ago

Great Alexie!
I have tested the new software version that you send me by email... now it is working fine! The values are the same of the instrument display.

But... the only "problem"(?) is that If I want to read the registers 3110 (Hz) and 3128 (V) I have to set into Domotiga modbus device, in according as Thomas suggestion...
C25 (3109 decimal) to see the right 3110 modbus register IEEE Float32 (Frequency, about 50Hz)
BD3 (3027 decimal) to see the right 3028 modbus register IEEE Float32 (Voltage, about 220-230V)

I will send you by mail the new log file, so you can see the results: the first test is with "normal" register and latest test is with the interested modbus register "-1".

Only now I don't understand if this inversion of the modbus register is simply a feature of Schneider modbus instruments or not: if yes there are no other bugs, only I have to remember this important rule.

Thank you for all
Marcello

RE: Modbus problems - Added by Alexie about 3 years ago

Ok, i the 'fix' is also committed in the BETA (so isn't lost, and available in the 1.0.024 too).

Thomas is right, because the "modpoll" application shows the same behaviour:

./modpoll -b 9600 -p none -m rtu -a 1 -r 3110 -c 2 /dev/ttyUSB0 -1
...
Slave configuration...: address = 1, start reference = 3110, count = 2
...
TRACELOG: Send(8): 01 03 0C 25 00 02 D6 90

Decimal in the manual shows 3110, but hexdecimal is 1C25 (so 3109 in hex) is the value to retrieve. This is new to me too ... I will update the Wiki with this information too.

So the Modbus issue is resolved now ;-)

RE: Modbus problems - Added by linuxmate about 3 years ago

I have talked about the question of modbus register with the necessity to decrease -1 to my friend that is a professional modbus specialist: He said me (like Thomas in the first note) that the answer in this case is only into the holding register index, because the single producer of the device may choose to start with register number 0 or 1.
The most common case is start with 0: infact in this case you have to decrease the register value, exactely like "modpoll" action that decrease -1 by default in hex the specified decimal value.
At the ending... now Domotiga modbus module is ok, because another instrument maybe working correctly directly with the declared register (without do -1), is only an important information to report in the Domotiga Wiki.

Thank you for all
Marcello

    (1-25/25)