Insufficient bytes recieved

Modbus device: Slave- Absolute multi turn encoder by kubler Modbus RTU
Master- PC(Windows 10)

Hi everyone. I have been trying to change slave id of the encoder using Modbus poll software and an RS485 converter while testing out encoder with default node id 63
Insufficient bytes received
error pops out. I have read other posts over this forum about Modbus but it didn't helped me. I have attached required files about the problem. Hope someone help to figure this out.


Device have an M12 Connector of 5 pins
Pin descriptiom;
1. GND
2. +V ( I am providing +24 V DC)
3. 0V
4. D1( D+)
5. D0 (D-)

My coverter only have A & B ( D+ and D-). so 2 and 3 are connected with 24V SMPS and 4&5 with D+ and D- of RS485 converter.
First, confirm you can even communicate with the slave device using Modbus Poll by reading a single register. According to the documentation, the register for Node Address is 40262 (which is the 1-based "PLC address", as Modbus Poll calls it). You can configure Modbus Poll's Read/Write Definition by entering 261 in the Address field (which is the 0-based register address) and 1 in the Quantity field as shown here:


If you are still seeing an error message, click on Display->Communication... in Modbus Poll to display the communication traffic and include this in your response.
A timeout error is usually due to either incorrect wiring or mismatched configuration settings such as baud rate, parity, or address. You would not see any RX packets at all if the configuration settings do not match.

Since you are seeing RX packets (although they are not valid Modbus packets), my first guess is that you may have a grounding issue, since you have only wired the A & B signals and do not have a 0V signal reference connected. Does your converter have a ground, reference, signal common, or similar terminal? If so, this should be wired to Pin 3: 0V of the M12 connector (in addition to the negative/ground/0V lead from your 24V power supply).

What is the converter you're using?
I'm using a generic usb to rs485 bought from amazon. It does not have any gnd screw terminal only A and B. I used earthing terminal of my 24v SMPS as ground for encoder device. I tried connecting both ground and 0v of device to earthing of smps but error still pops up. Insufficient bytes received.
Keep in mind that Earth ground and a 0V logic ground are two very different things, and should typically be kept separate. As far as communications is concerned, Earth ground is only used to connect one end of the cable shielding. The RS-485 ground reference and power supplies of all RS-485 devices (assuming non-isolated devices) should be connected together to 0V logic ground, which does not connect to Earth ground.

Try another Modbus tool to see if you have the same results. Here are a couple:

Simply Modbus

So that I may help you with proper wiring, please provide the vendor and model number of your USB to RS-485 converter and the 24V SMPS.
Thank you for the additional details and for your results with ModScan.

It appears that ModScan is successfully reading registers 40261 - 40270, as there is data shown (even though the values don't seem correct) and the Valid Slave Responses is greater than 0.

Make sure to pay attention to the 40xxx numbers in the Modbus tools you're using, because not all tools use the same numbering for registers (see here for details

Modbus Poll, by default (when the PLC Addresses option is not checked), uses 0-based register numbering, so when you enter 261 for the address, this equates to 40262. But ModScan uses 1-based register numbering, so when you enter 261 for the address, it actually equates to 40261. Therefore, you need to enter 262 into the address field in ModScan to start at the Node Address at register 40262 for your encoder.

What are the results with ModScan if you enter 262 for the Address and 1 for the Length? Do you receive an error? If so, what Length setting results in successful communication?
You have successful communications, but it seems you're not getting the expected data back. I recommend that you contact Kubler about this. From what you've shown, the device does not seem to be behaving as it's documentation says it should. Are you able to read correct values for any registers in the range 40002 - 40017 (such as the serial number in 40015 and 40016)?

As far as the write is concerned, ModScan will use function code 6 by default, which according to the encoder's documentation, is not supported (only function code 16 is supported). This is very likely why you are getting an exception response. You can force ModScan to use function code 16 by clicking Connection->Connect, then click the Protocol Selections button, then check the checkbox for the "Force modbus command 15 and 16 for single-point writes" option.
The serial number you're reading is actually correct, 2104000610. Also, all of the other values seem reasonable (such as battery voltage, temp, etc.).

For the serial number, you just need to have ModScan interpret it as an unsigned 32-bit integer instead of two signed 16-bit integers. In ModScan, set Address to 15, Length to 2. Click Setup->Display Options->Long Integer->Most Significant Register First. You should now see 2104000610 for register 40015.

As far as registers 40257 - 40283, it's possible that the encoder doesn't actually return valid data when these are read and considers these registers as write-only (which in my opinion is a very poor implementation choice if true). I recommend confirming this with Kubler.

Try checking the "Force modbus command 15 and 16 for single-point writes" option as I described in my last post, set Address to 262, Length to 2, write a new node address value to 40262, then write a value of 1 to 40263 (or power cycle the encoder instead). The encoder should cease communicating with ModScan at address 63 and begin communicating at the new address you wrote.
It appears you have your display options set to long integer in ModScan, which is incorrect. This should be left at the default. I don't have access to my computer right now to tell you the exact setting, but if I recall, I believe the default display option is unsigned or decimal.

Did you check the "Force modbus command 15 and 16 for single-point writes" option?

Alternatively you can click Setup->Extended->Preset Multiple Registers to use function code 16. Set the address to 262 and length to 1, then enter the value you want. Again going off memory here on the settings.
I think modscan64 requires paid version to write node update because extended option is disabled by the software. Correct me if I am wrong. Tried many time updating register 262 to any value gives error.
Did you check the "Force modbus command 15 and 16 for single-point writes" option under Connection->Connect, Protocol Selections?

If the extended options are unavailable, this could certainly only be available in the paid version.

But you're receiving an exception response from your encoder, which is absolutely not due to the fact you're using the free version of ModScan. The exception response is sent by the encoder because it deemed the request invalid for some reason.

You can determine the exception returned by your encoder by disconnecting immediately after receiving the exception, then click on Display->Show Traffic (going off memory, the actual menu selection may be different).

You can certainly go back to trying Modbus Poll again or try other Modbus tools, such as the following:

Simply Modbus

I think modscan64 requires paid version to write node update because extended option is disabled by the software. Correct me if I am wrong.
From WinTECH's page here, it states, "All applications available from this site are fully functional time-limited demos."

The Extended menu options in ModScan are disabled if you are not connected. In other words, once you click Connection->Connect and click the OK button in the Connection Details window, the Extended menu options become available (note that ModScan will continuously send read requests to the Modbus slave when connected).