Modbus communication error

More
19 Jan 2020 19:03 - 20 Jan 2020 06:50 #155171 by jsskangas
Hello

I am converting my Spindle to RS485 modbus to get one servo axis more.
My idea is to use HW COM port: ttyS0 and rs232 to 485 converter.

I have tested that RS485 converter works with VFD setup software.
Also I verified that baud rate is correct and it is in correct mode 19200, RTU and 8-N-1.





I Tested Linuxcnc with this USB to RS232 to verify that there is no HW problem.

ttyUSB0 is found:


Here is Config for modbus:




It was trying to send something (indicated by TX led in usb to rs232 conveter), but no modbus connection was made.
I was using same setup usb to rs232 + rs232 to rs485 converter to test connection with VFd softaware and it works.

Any Idea what i am missing?
Clearly something in Linux or linuxcnc..
Attachments:
Last edit: 20 Jan 2020 06:50 by jsskangas.

Please Log in or Create an account to join the conversation.

More
20 Jan 2020 07:40 - 20 Jan 2020 07:41 #155233 by Mike_Eitel
Have you tried RTS on?
RS485 needs switching of direction
Last edit: 20 Jan 2020 07:41 by Mike_Eitel.

Please Log in or Create an account to join the conversation.

More
20 Jan 2020 08:22 #155234 by cmorley
Replied by cmorley on topic Modbus communication error
It's been awhile since I did classicladder modbus but ...

run linuxcnc in a terminal and set classicladder's modbus debug setting high.
that should show the raw commands being sent and received on classicladders's side.

Sometime changing the element offset, timeouts etc. also if you can try at a slower baud rate first might be helpful.

Chris

Please Log in or Create an account to join the conversation.

More
20 Jan 2020 09:11 - 20 Jan 2020 09:22 #155235 by jsskangas
OK

I am not expert in modbus so for me this does not tell much.

It outputs this:

Serial flush all!
INFO CLASSICLADDER- Modbus I/O module to send: Lgt=8 <- Slave address-1 Function code-4 Data-8 35 0 1 23 A4
INFO CLASSICLADDER- MODBUS Length we should receive=4 (+3)
Serial config...
Set RTS=1
Serial writing...
Writing done!
Set RTS=0
select() for serial reading...
Serial reading...
5 chars found
INFO CLASSICLADDER- Modbus I/O module received: Lgt=5 -> (Slave address-1 - Function code-84 ) 1 82 C0
ERROR CLASSICLADDER- MODBUS-EXCEPTION RECEIVED:84 (Excep=1)
ERROR CLASSICLADDER- MODBUS-INCORRECT RESPONSE RECEIVED FROM SLAVE!!!
Serial flush all!
INFO CLASSICLADDER- Modbus I/O module to send: Lgt=8 <- Slave address-1 Function code-4 Data-8 35 0 1 23 A4
INFO CLASSICLADDER- MODBUS Length we should receive=4 (+3)
Serial config...
Set RTS=1
Serial writing...
Writing done!
Set RTS=0
select() for serial reading...
Serial reading...
5 chars found
INFO CLASSICLADDER- Modbus I/O module received: Lgt=5 -> (Slave address-1 - Function code-84 ) 1 82 C0
ERROR CLASSICLADDER- MODBUS-EXCEPTION RECEIVED:84 (Excep=1)
ERROR CLASSICLADDER- MODBUS-INCORRECT RESPONSE RECEIVED FROM SLAVE!!!
Serial flush all!
Last edit: 20 Jan 2020 09:22 by jsskangas.

Please Log in or Create an account to join the conversation.

More
20 Jan 2020 10:25 #155239 by cmorley
Replied by cmorley on topic Modbus communication error
Again been awhile but...

You are getting a response from the VDF.
I believe it's telling you the function (4 - read registers) is not available.
I don't see from to snippet if function 6/16 is working.
Do you have info on the modbus commands the VFD uses ?

Chris

Please Log in or Create an account to join the conversation.

More
20 Jan 2020 10:39 - 20 Jan 2020 10:40 #155240 by jsskangas
Hello

If you look at my first post, second picture.
There is there is two messages i tried trough ModBus.
First one is read register 2100, this went OK.
Then write register 2001, again ok.
and you can see answer from VFD to those requests.


I did look a manual and all requester and written register exists.
Last edit: 20 Jan 2020 10:40 by jsskangas.

Please Log in or Create an account to join the conversation.

More
20 Jan 2020 10:40 #155241 by cmorley
Replied by cmorley on topic Modbus communication error
Looks from your setup software that the function should be 3 (read hold registers)not 4 ....

Please Log in or Create an account to join the conversation.

More
20 Jan 2020 11:04 #155244 by jsskangas
I did try 3 (read hold registers) and it did not make any difference:

Serial reading...
5 chars found
INFO CLASSICLADDER- Modbus I/O module received: Lgt=5 -> (Slave address-1 - Function code-83 ) 2 C0 F1
ERROR CLASSICLADDER- MODBUS-EXCEPTION RECEIVED:83 (Excep=2)
ERROR CLASSICLADDER- MODBUS-INCORRECT RESPONSE RECEIVED FROM SLAVE!!!
Serial flush all!
INFO CLASSICLADDER- Modbus I/O module to send: Lgt=8 <- Slave address-1 Function code-3 Data-8 34 0 1 C7 A4
INFO CLASSICLADDER- MODBUS Length we should receive=4 (+3)
Serial config...
Serial writing...
Writing done!
select() for serial reading...
Serial reading...
5 chars found
INFO CLASSICLADDER- Modbus I/O module received: Lgt=5 -> (Slave address-1 - Function code-83 ) 2 C0 F1
ERROR CLASSICLADDER- MODBUS-EXCEPTION RECEIVED:83 (Excep=2)
ERROR CLASSICLADDER- MODBUS-INCORRECT RESPONSE RECEIVED FROM SLAVE!!!
Serial flush all!
INFO CLASSICLADDER- Modbus I/O module to send: Lgt=8 <- Slave address-1 Function code-3 Data-8 34 0 1 C7 A4
INFO CLASSICLADDER- MODBUS Length we should receive=4 (+3)
Serial config...
Serial writing...
Writing done!
select() for serial reading...
Serial reading...
5 chars found
INFO CLASSICLADDER- Modbus I/O module received: Lgt=5 -> (Slave address-1 - Function code-83 ) 2 C0 F1
ERROR CLASSICLADDER- MODBUS-EXCEPTION RECEIVED:83 (Excep=2)
ERROR CLASSICLADDER- MODBUS-INCORRECT RESPONSE RECEIVED FROM SLAVE!!!
Serial flush all!
INFO CLASSICLADDER- Modbus I/O module to send: Lgt=8 <- Slave address-1 Function code-3 Data-8 34 0 1 C7 A4
INFO CLASSICLADDER- MODBUS Length we should receive=4 (+3)
Serial config...
Serial writing...
Writing done!
select() for serial reading...
Serial reading...
5 chars found
INFO CLASSICLADDER- Modbus I/O module received: Lgt=5 -> (Slave address-1 - Function code-83 ) 2 C0 F1
ERROR CLASSICLADDER- MODBUS-EXCEPTION RECEIVED:83 (Excep=2)
ERROR CLASSICLADDER- MODBUS-INCORRECT RESPONSE RECEIVED FROM SLAVE!!!
Serial flush all!

Please Log in or Create an account to join the conversation.

More
20 Jan 2020 11:18 #155245 by cmorley
Replied by cmorley on topic Modbus communication error
It did make a difference - the exception code is now 2 - illegal data address

So the function (3) is corrected but seems the address is wrong
is address 2101 legal? in your test you used 2100

Please Log in or Create an account to join the conversation.

More
20 Jan 2020 11:29 #155246 by cmorley
Replied by cmorley on topic Modbus communication error
ahh I bet you did set 2100 in classicladder - try setting 'modbus element offset' to 0

Chris

Please Log in or Create an account to join the conversation.

Time to create page: 0.257 seconds
Powered by Kunena Forum