# Modbus TCP with TM221 Schneider - Read and write error

**URL:** <https://forum.inductiveautomation.com/t/modbus-tcp-with-tm221-schneider-read-and-write-error/12174>\
**Category:** Ignition\
**Created:** [September 27, 2016, 8:12am UTC](https://forum.inductiveautomation.com/t/modbus-tcp-with-tm221-schneider-read-and-write-error/12174 "2016-09-27T08:12:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![altar](https://avatars.discourse-cdn.com/v4/letter/a/90ced4/32.png) [@altar](https://forum.inductiveautomation.com/u/altar)\
**Post date:** [September 27, 2016, 8:12am UTC](https://forum.inductiveautomation.com/t/modbus-tcp-with-tm221-schneider-read-and-write-error/12174/1 "2016-09-27T08:12:17Z")

</div>

Hi,

I use a TM221 PLC Modbus TCP.  
I can not read or write to an address.  
The connection is OK but an error in the log.

```auto
ReadHoldingRegistersRequest Uncaught throwable handling response. key = 2 req = [], rsp = [00 02 00 00 00 06 00 03 00 00 00 02]
```

` 	
java.lang.ArrayIndexOutOfBoundsException: 0
at com.inductiveautomation.xopc.driver.util.OldByteUtilities.getInt(OldByteUtilities.java:143)
at com.inductiveautomation.xopc.driver.util.UAByteUtilities.getInt32(UAByteUtilities.java:120)
at com.inductiveautomation.xopc.driver.util.UAByteUtilities.getDataValue(UAByteUtilities.java:52)
at com.inductiveautomation.xopc.drivers.modbus2.requests.handlers.RegisterReadHandler.read32Bit(RegisterReadHandler.java:179)
at com.inductiveautomation.xopc.drivers.modbus2.requests.handlers.RegisterReadHandler.getValue(RegisterReadHandler.java:109)
at com.inductiveautomation.xopc.drivers.modbus2.requests.handlers.RegisterReadHandler.handle(RegisterReadHandler.java:83)
at com.inductiveautomation.xopc.drivers.modbus2.requests.ReadHoldingRegistersRequest.handleResponse(ReadHoldingRegistersRequest.java:123)
at com.inductiveautomation.xopc.drivers.modbus2.requests.AbstractModbusRequest.receiveMessage(AbstractModbusRequest.java:158)
at com.inductiveautomation.xopc.drivers.modbus2.requests.AbstractModbusReadRequest.receiveMessage(AbstractModbusReadRequest.java:101)
at com.inductiveautomation.xopc.drivers.modbus2.requests.AbstractModbusReadRequest.receiveMessage(AbstractModbusReadRequest.java:59)
at com.inductiveautomation.xopc.driver.api.BasicRequestCycle.deliverMessage(BasicRequestCycle.java:184)
at com.inductiveautomation.xopc.driver.api.BasicRequestCycle.messageArrived(BasicRequestCycle.java:166)
at com.inductiveautomation.xopc.driver.api.AbstractDriver.messageArrived(AbstractDriver.java:708)
at com.inductiveautomation.xopc.driver.api.AbstractIODelegatingDriver.messageArrived(AbstractIODelegatingDriver.java:110)
at com.inductiveautomation.xopc.driver.api.SocketIODelegate$DriverIOEventHandler$1.run(SocketIODelegate.java:177)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)`

If someone an idea of the problem.

thank you

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [September 27, 2016, 2:03pm UTC](https://forum.inductiveautomation.com/t/modbus-tcp-with-tm221-schneider-read-and-write-error/12174/2 "2016-09-27T14:03:05Z")

</div>

Can you turn the logger for ReadHoldingRegistersRequest to TRACE and then post a bit of the logs? I’m not sure whether or not to trust what’s being logged as “rsp” in that error message.

---

<div class="post-metadata">

**Author:** ![altar](https://avatars.discourse-cdn.com/v4/letter/a/90ced4/32.png) [@altar](https://forum.inductiveautomation.com/u/altar)\
**Post date:** [September 29, 2016, 8:16am UTC](https://forum.inductiveautomation.com/t/modbus-tcp-with-tm221-schneider-read-and-write-error/12174/3 "2016-09-29T08:16:05Z")

</div>

Hello,  
Thank you for your reply.

I’m not sure I understand the manipulation. you want me to go in TRACE in the console. If that is what I have the same message.  
I do not understand why with other software modbus tcp I have no problem but only with Modbus TCP ignition driver.

Cordially.
