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 485 error ! :(
#1
Hi all!
I have connected a temperature sensor that supports RS485, I have tested it with modbus poll and it works ok. But when I connect to LM, it gives an error when I receive the command, I send the command also the error, did I configure the rs485 Bus correctly as the document and like modbus poll ? 
I don't know where the error is, please help me!

Attached Files Thumbnail(s)
       
Reply
#2
Disable RTU in Modbus settings and run this script once. Post what you get in Logs.
You might need to change the serial settings in the script. It is currently set to 9600 baud, no parity (N) and 1 stop bit.
Code:
require('luamodbus')
mb = luamodbus.rtu()

mb:open('/dev/RS485-1', 9600, 'N', 8, 1, 'H')
mb:connect()

buffer = {}

mb:setdebug(function(msg)
  buffer[ #buffer + 1 ] = msg
end)

mb:setslave(1)

res, err = mb:readregisters(0)
log(res, err)

mb:close()

log(table.concat(buffer))
Reply
#3
Yes, thank admin! It's log here.
* string: [01][03][00][00][00][01][84][0A]
Waiting for a confirmation...
<01><00><02><02><00><00><46>
ERROR CRC received 0x46 != CRC calculated 0xB960
Reply
#4
This is not a valid reply from the Modbus device. This means that there's some communication issue.
Try connection power supply GND (-) of the sensor to the RS485 GND input on LM and check if it makes a difference.
Reply
#5
Oh, thank so much!
I solved it, the problem is in GND
Smile Thank admin!
Reply
#6
I hope you dont mind if i hijack this topic.

I have a problem, i have 2 of the same ABB modbus energymeters B21 212 00, the first adres is still working for a half year.
multiple times i try to add a second energymeter.
I address him 2 and so far i know all other settings of the modbus are the same.
I had more of the energymeters and i also tried others with the same settings and adres 2.
but the problem is, the Wiser still contue give problems 'in the error log is see 'Airco (RTU 1 slave 2) read failed: Operation timed out'.
but it looks like it is also working sometimes.
The total cable lengte is a 50cm (KNX kabel) and the wires are twisted under the terminal, to proceed to the 2nd module, so im sure it isnt the cable.

Do you have a idea where i have to look to solve this problem?
Reply
#7
Is the GND connected?
------------------------------
Ctrl+F5
Reply
#8
(19.07.2022, 09:33)Daniel Wrote: Is the GND connected?

Yes i connect all 3 wires
Reply
#9
Did you try swapping first meter with the second? Maybe the meter has some issue.
------------------------------
Ctrl+F5
Reply
#10
No i didnt, but i tried multiple energies meters for the second device.

you think the first is the problem?
Reply
#11
I'm just guessing, but yes try disconnecting first.
------------------------------
Ctrl+F5
Reply
#12
   
*i had a mistake about the text i add.
i mean It looks like if i set this to 14 (not 60) that this solved the problem.


I was still trying to find the problem.
It looks like if i change the 'poll interval' lower that this solved the issue, but just once a minute checking is more than enough for me.

But im not sure what timeout means. Because he's just checking at the interval i set too.
but the timeout goes to 15 seconds and the interval much more.
or is it a open connection?

EDIT: it isnt away but much less errors
Reply
#13
Timeout is simply time which Master will wait for the slave to replay. Pool interval should be much longer than the timeout as it is per register where pool interval is for whole device. How many registers do you read?
------------------------------
Ctrl+F5
Reply
#14
You get less errors because the device is polled less due to large timeout value. In the device does not answer the communication is fully blocked for 15 seconds. Timeout for RTU should not be longer than 1 second for most devices.
Reply
#15
(19.07.2022, 10:17)Daniel Wrote: Timeout is simply time which Master will wait for the slave to replay. Pool interval should be much longer than the timeout as it is per register where pool interval is for whole device.  How many registers do you read?

what do you mean with registers?
the profile for reading a modbus device? it are 67, 66 of them where already inside the Wiser (all of them from Schneider) and i add 1.
is it posible i did make a mistake with creating the profile?

Code:
{
  "product_code": "ABB_B21",
  "mapping": [
    {
      "bus_datatype": 14,
      "address": 20480,
      "value_multiplier": 0.01,
      "type": "register",
      "units": " kWh",
      "name": "Active import",
      "datatype": "int64"
    },
    {
      "bus_datatype": 14,
      "address": 20484,
      "value_multiplier": 0.01,
      "type": "register",
      "units": " kWh",
      "name": "Active export",
      "datatype": "int64"
    },
    {
      "bus_datatype": 14,
      "address": 20488,
      "value_multiplier": 0.01,
      "type": "register",
      "units": "kWh",
      "name": "Active Net",
      "datatype": "int64"
    },
      {
      "bus_datatype": 14,
      "address": 20489,
      "value_multiplier": 0.01,
      "type": "register",
      "units": "Kvarh",
      "name": "Reactive Import",
      "datatype": "int64"
    },
     {
      "bus_datatype": 14,
      "address": 20496,
      "value_multiplier": 0.01,
      "type": "register",
      "units": "Kvarh",
      "name": "Reactive Export",
      "datatype": "int64"
    },
     {
      "bus_datatype": 14,
      "address": 20500,
      "value_multiplier": 0.01,
      "type": "register",
      "units": "Kvarh",
      "name": "Reactive Net",
      "datatype": "int64"
    },
         {
      "bus_datatype": 14,
      "address": 20504,
      "value_multiplier": 0.01,
      "type": "register",
      "units": "Kvarh",
      "name": "Apparent Import",
      "datatype": "int64"
    },       
     {
      "bus_datatype": 14,
      "address": 20505,
      "value_multiplier": 0.01,
      "type": "register",
      "units": "Kvarh",
      "name": "Apparent Export",
      "datatype": "int64"
    },
         {
      "bus_datatype": 14,
      "address": 20512,
      "value_multiplier": 0.01,
      "type": "register",
      "units": "Kvarh",
      "name": "Apparent Net",
      "datatype": "int64"
    },      
     {
      "bus_datatype": 14,
      "address": 20516,
      "value_multiplier": 0.001,
      "type": "register",
      "units": "kg",
      "name": "Active Import CO2",
      "datatype": "int64"
    },
         {
      "bus_datatype": 14,
      "address": 20532,
      "value_multiplier": 0.001,
      "type": "register",
      "units": "currency",
      "name": "Active Import Currency",
      "datatype": "int64"
     },
              {
      "bus_datatype": 14,
      "address": 23296,
      "value_multiplier": 0.1,
      "type": "register",
      "units": "currency",
      "name": "Volatage",
      "datatype": "int64"
     },
                   {
      "bus_datatype": 14,
      "address": 23316,
      "value_multiplier": 0.01,
      "type": "register",
      "units": " W",
      "name": "Active power",
      "datatype": "int64"
     },
                        {
      "bus_datatype": 14,
      "address": 23296,
      "value_multiplier": 0.1,
      "type": "register",
      "units": " V",
      "name": "Voltage L1-N",
      "datatype": "int32"
     },
    {
      "bus_datatype": 14,
      "address": 23308,
      "value_multiplier": 0.01,
      "type": "register",
      "units": " A",
      "name": "Current Ampère L1",
      "datatype": "int32"
     },
     {
      "bus_datatype": 14,
      "address": 23316,
      "value_multiplier": 0.01,
      "type": "register",
      "units": " W",
      "name": "Active Total Power",
      "datatype": "int32"
     },
     {
      "bus_datatype": 14,
      "address": 23340,
      "value_multiplier": 0.01,
      "type": "register",
      "units": " Hz",
      "name": "Frequency",
      "datatype": "uint16"
     },
     {
      "bus_datatype": 10,
      "address": 35328,
      "value_multiplier": 0,
      "type": "register",
      "units": " time",
      "name": "date / time",
      "datatype": "int64"
     }
    ],
  "manufacturer": "ABB",
  "name": "B21",
  "product_range": "PM",
  "description": "Power Meter P21 1 fase"
}

from both devices i only use Active import, Active Export, Active total power in mapping, but i dont know if he still does do anything with all others.

(19.07.2022, 10:17)admin Wrote: You get less errors because the device is polled less due to large timeout value. In the device does not answer the communication is fully blocked for 15 seconds. Timeout for RTU should not be longer than 1 second for most devices.

Thanks Admin, now i understand it better.
i changed it back 60 for poll interval
and 1 second for timeout
Reply
#16
Only the ones which are mapped to object are used. You clearly have some communication issue. Is it line topology?
------------------------------
Ctrl+F5
Reply
#17
@Daniel,

yes, the wire started with the Wiser > modbus address 1 > modbus address 2.

Now i trying to remove the first adres in Wiser and just only use the second address.
Both are still wired, just remove in Wiser.
And so far (few minutes) I don't have an error.

At the moment I think maybe the problem is the json script, is it possible he gives problems to read out the next device?

EDIT
i add again address 1, now i get the same problem, but now on RTU 1 slave 1.
so it changed from slave 2 to slave 1.
it looks like the problem shows on the last added device.

i didn't made a change on wired or hardware.

and if i remove slave 2, slave 1 works well again.
Reply
#18
Is it posible that the profile script isnt good, so he will stop working?
but if it is, why will he read the first device i add to the Wiser?
Reply
#19
(19.04.2022, 11:22)admin Wrote: This is not a valid reply from the Modbus device. This means that there's some communication issue.
Try connection power supply GND (-) of the sensor to the RS485 GND input on LM and check if it makes a difference.

Hi Admin,
today I stumbled in a problem like that (CRC error). But my device a Solar Inverter has only pin RX-TX. Any suggest?
Best regards Cristian
Reply
#20
@Dré, profile does not affect device operation. Read/write can fail if the addresses or other settings are wrong. But if you have two identical devices where one is not working correctly then it's definitely not a profile issue.

@CristianAgata, do you have documentation for this inverter? There must be some DC input or output with a GND/0V connection can be used.
Reply


Forum Jump: