How to check modbus comunication

Topics about the Hardware of Revolution Pi
User avatar
volker
Posts: 1046
Joined: 09 Nov 2016, 15:41

Re: How to check modbus comunication

Post by volker »

Okay,
I think the reason is you have mixed up Modbus addresses and Modbus register numbers. The type of indication in your manual tells me that the table is using Modbus register addresses as they are transmitted in the Modbus telegram. Thus they start with 0. In PiCtory we are using the register numbers (which are mostly also referred to as Modbus register addresses) which do start with a 1. So if you enter the register address 2 the telegram which is built by the master uses address 1 which is wrong and results in a Modbus error code. So you will need to use a 3 as Modbus register number because the value seems to be stored in the 3rd and 4th Modbus register. please give this a try...
Unser RevPi Motto: Don't just claim it - make it!
francescoizzi
Posts: 18
Joined: 17 Feb 2018, 12:10

Re: How to check modbus comunication

Post by francescoizzi »

Hi Volker,

i dont really understand the means of piTest -r Modbus_Master_Status and piTest -r Modbus_Action_Status_1 commands.

this is my values:

pi@RevPi4067:~ $ piTest -r Modbus_Master_Status
1 Byte-Value of Modbus_Master_Status: 0 dez (=00 hex)
1 Byte-Value of Modbus_Master_Status: 0 dez (=00 hex)
1 Byte-Value of Modbus_Master_Status: 0 dez (=00 hex)
1 Byte-Value of Modbus_Master_Status: 0 dez (=00 hex)
1 Byte-Value of Modbus_Master_Status: 0 dez (=00 hex)
1 Byte-Value of Modbus_Master_Status: 0 dez (=00 hex)
1 Byte-Value of Modbus_Master_Status: 0 dez (=00 hex)

pi@RevPi4067:~ $ piTest -r Modbus_Action_Status_1
1 Byte-Value of Modbus_Action_Status_1: 1 dez (=01 hex)
1 Byte-Value of Modbus_Action_Status_1: 1 dez (=01 hex)
1 Byte-Value of Modbus_Action_Status_1: 1 dez (=01 hex)
1 Byte-Value of Modbus_Action_Status_1: 1 dez (=01 hex)
1 Byte-Value of Modbus_Action_Status_1: 1 dez (=01 hex)
1 Byte-Value of Modbus_Action_Status_1: 1 dez (=01 hex)
1 Byte-Value of Modbus_Action_Status_1: 1 dez (=01 hex)
1 Byte-Value of Modbus_Action_Status_1: 1 dez (=01 hex)
1 Byte-Value of Modbus_Action_Status_1: 1 dez (=01 hex)

the "1" means that the connection is successfull enstabilished ? or mean an error ?

Thanks for your support
User avatar
volker
Posts: 1046
Joined: 09 Nov 2016, 15:41

Re: How to check modbus comunication

Post by volker »

Please read my last posting carefully:
The 1 means an error (see Tutorial: https://revolution.kunbus.com/tutorials ... rect=en_US) "Illegal Function Call"
The reason seems to be a wrong register address you are using. Please try to use 3 instead of 2 and you might have success...
Unser RevPi Motto: Don't just claim it - make it!
francescoizzi
Posts: 18
Joined: 17 Feb 2018, 12:10

Re: How to check modbus comunication

Post by francescoizzi »

Hi have have tried this but without succes.
Schermata 2018-02-19 alle 12.39.29.png
Schermata 2018-02-19 alle 12.39.29.png (25.76 KiB) Viewed 9208 times
and always give me:

pi@RevPi4067:~ $ piTest -r Modbus_Action_Status_1
1 Byte-Value of Modbus_Action_Status_1: 1 dez (=01 hex)
1 Byte-Value of Modbus_Action_Status_1: 1 dez (=01 hex)
1 Byte-Value of Modbus_Action_Status_1: 1 dez (=01 hex)
1 Byte-Value of Modbus_Action_Status_1: 1 dez (=01 hex)
1 Byte-Value of Modbus_Action_Status_1: 1 dez (=01 hex)
User avatar
volker
Posts: 1046
Joined: 09 Nov 2016, 15:41

Re: How to check modbus comunication

Post by volker »

Have you rebooted the system?
Only if you reboot or if you reset the error status by writing FF to the status reset byte in the process image it will show you the actual result.
Unser RevPi Motto: Don't just claim it - make it!
francescoizzi
Posts: 18
Joined: 17 Feb 2018, 12:10

Re: How to check modbus comunication

Post by francescoizzi »

I always test with Reset Driver ... is not enough?

Now I also tried to reboot ... but not success yet.!
User avatar
volker
Posts: 1046
Joined: 09 Nov 2016, 15:41

Re: How to check modbus comunication

Post by volker »

okay.
I have tried using my poor Italien language skills to understand your manual. It seems the given address of 2 is indeed the Modbus register number and thus you should configure it back to 2 in PiCtory.
I can't really understand why your slave is responding with "illegal function code" to function 04. Maybe you need to fall back to any Modbus slave SW Emulation on Windows. Could you install a Modbus slave on your PC and use a second USb to Modbus dongle to set up a master-slave communication? I just can't see any fault when looking on your screen dumps. Your Modbus connection does establish (because there is a 0 in the general status of the master) but your slave refuses the function code "read modbus registers" (04) although your slave manual says that the slave should know this function code.
With a Modbus slave on a Windows PC you often have also the possibility to look into the incoming telegram. Thus we could see if there is any communication fault.

You could also try and use "ReadInputRegisters" with any other address and may be just 1 register instead of 2. Just to be sure that you can read any register from the slave.
Finally you could use a serial analyze tool to catch the data stream and display it. Thus you would also be able to at least find out if the master is sending the correct telegram and the slave really responds with "illegal function call error".

Hope one of the ways will help you finding the reason for the malfunction...
Unser RevPi Motto: Don't just claim it - make it!
francescoizzi
Posts: 18
Joined: 17 Feb 2018, 12:10

Re: How to check modbus comunication

Post by francescoizzi »

Ciao Volker,

no way to fix the BTicino comunication at all.

To test that all working, i check the comunication with a simulation and all works fine: i attach an image: Now i can test other meter (Shnider iem3255) i hope that this works fine.
Schermata 2018-02-20 alle 14.24.26.jpg
Schermata 2018-02-20 alle 14.24.26.jpg (159.74 KiB) Viewed 9195 times
Thanks for your support and indication.
User avatar
volker
Posts: 1046
Joined: 09 Nov 2016, 15:41

Re: How to check modbus comunication

Post by volker »

I now would suggest the other way round: use the PC to run a modbus master software (e.g. QModBus) and connect the PC over a USB to RS485 to the meter. Try to request the values from the meter using the PC. I wonder what the meter is responding when you send a read input registers to 2,2 using QMOdBus...
Unser RevPi Motto: Don't just claim it - make it!
francescoizzi
Posts: 18
Joined: 17 Feb 2018, 12:10

Re: How to check modbus comunication

Post by francescoizzi »

Hi Volker,

i have just tried with QModbus installed on my Raspberry i retrieve the same error "Illegal Function"..... GOOD NEWS :) .... i finally say (for my experience and for all of my tests) BTicino F3N3000 not work with RS485 protocol

Thanks for your support!
Post Reply