# Error: Modbus exception 254 on modbus-tcp

**URL:** <https://discourse.nodered.org/t/error-modbus-exception-254-on-modbus-tcp/24448>\
**Category:** General\
**Created:** [8 April 2020 09:57 UTC](https://discourse.nodered.org/t/error-modbus-exception-254-on-modbus-tcp/24448 "2020-04-08T09:57:36Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![kokkak](https://avatars.discourse-cdn.com/v4/letter/k/71e660/32.png) [@kokkak](https://discourse.nodered.org/u/kokkak)\
**Post date:** [8 April 2020 09:57 UTC](https://discourse.nodered.org/t/error-modbus-exception-254-on-modbus-tcp/24448/1 "2020-04-08T09:57:36Z")

</div>

Hello all, i have gateway to read data from modbus device and i use modbus-tcp in node-red to read data form device.  
I config listener port 505 in gateway ,when i read modbus it response "Error: Modbus exception 254".  
Could you please help me in this regards?

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/d/edbf65ef9309c068c3eb47beb7670e776e22d22e.png)  
This above image is the setting of gateway.  
But when i use modbus-serial (USB-modbus) as the same address, it succes to read data.  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/1/e1f2f148290ba1a67906813a3016a5a67d3c0638.png)

> **Flow**
>
> [{"id":"62059c78.4b0de4","type":"modbus-read","z":"7121fe96.cef1e","name":"","topic":"","showStatusActivities":true,"logIOActivities":false,"showErrors":true,"unitid":"1","dataType":"HoldingRegister","adr":"1","quantity":"10","rate":"10","rateUnit":"s","delayOnStart":false,"startDelayTime":"1","server":"20de53c2.01385c","useIOFile":false,"ioFile":"","useIOForPayload":false,"x":170,"y":300,"wires":[["d6c37260.6d189"],[""]]},{"id":"20de53c2.01385c","type":"modbus-client","z":"","name":"","clienttype":"tcp","bufferCommands":true,"stateLogEnabled":true,"tcpHost":"172.20.10.4","tcpPort":"505","tcpType":"DEFAULT","serialPort":"/dev/ttyUSB","serialType":"RTU-BUFFERD","serialBaudrate":"9600","serialDatabits":"8","serialStopbits":"1","serialParity":"none","serialConnectionDelay":"100","unit\_id":"1","commandDelay":"1","clientTimeout":"5000","reconnectOnTimeout":true,"reconnectTimeout":"2000","parallelUnitIdsAllowed":true}]

---

<div class="post-metadata">

**Author:** ![rromele](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rromele/32/18431_2.png) [@rromele](https://discourse.nodered.org/u/rromele)\
**Post date:** [12 April 2020 21:30 UTC](https://discourse.nodered.org/t/error-modbus-exception-254-on-modbus-tcp/24448/2 "2020-04-12T21:30:52Z")

</div>

hi,  
the port to use by default with modbus tcp / ip is 502, not 505, try it.

---

<div class="post-metadata">

**Author:** ![hominidae](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hominidae/32/4174_2.png) [@hominidae](https://discourse.nodered.org/u/hominidae)\
**Post date:** [12 April 2020 21:35 UTC](https://discourse.nodered.org/t/error-modbus-exception-254-on-modbus-tcp/24448/3 "2020-04-12T21:35:43Z")

</div>

using a serial connection would probably require a so called null-modem cable, where RX/TX lines need to be reversed on one side.of the connection.  
Edit: Ah, my bad...thought from the pics that you were trying to read via serial.

---

<div class="post-metadata">

**Author:** ![kokkak](https://avatars.discourse-cdn.com/v4/letter/k/71e660/32.png) [@kokkak](https://discourse.nodered.org/u/kokkak)\
**Post date:** [13 April 2020 08:40 UTC](https://discourse.nodered.org/t/error-modbus-exception-254-on-modbus-tcp/24448/4 "2020-04-13T08:40:20Z")

</div>

i change listener port to 502, but it's not working.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/a/4a61fd9305637db9e7326c98010ffec7adecba35.png)  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/d/bde144db92372399e1d1761039eeebde9d786875.png)

---

<div class="post-metadata">

**Author:** ![hominidae](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hominidae/32/4174_2.png) [@hominidae](https://discourse.nodered.org/u/hominidae)\
**Post date:** [13 April 2020 09:09 UTC](https://discourse.nodered.org/t/error-modbus-exception-254-on-modbus-tcp/24448/5 "2020-04-13T09:09:37Z")

</div>

...try the TCP-Type from DEFAULT to RTU-BUFFERED in the client settings

---

<div class="post-metadata">

**Author:** ![kokkak](https://avatars.discourse-cdn.com/v4/letter/k/71e660/32.png) [@kokkak](https://discourse.nodered.org/u/kokkak)\
**Post date:** [13 April 2020 14:17 UTC](https://discourse.nodered.org/t/error-modbus-exception-254-on-modbus-tcp/24448/7 "2020-04-13T14:17:39Z")

</div>

it's not working.  
i think the problem was my gateway, i'll find another gateway and try again.

---

<div class="post-metadata">

**Author:** ![rromele](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rromele/32/18431_2.png) [@rromele](https://discourse.nodered.org/u/rromele)\
**Post date:** [13 April 2020 20:09 UTC](https://discourse.nodered.org/t/error-modbus-exception-254-on-modbus-tcp/24448/8 "2020-04-13T20:09:01Z")

</div>

ok but if you need help put some more data because without information it is difficult to give you support...

---

<div class="post-metadata">

**Author:** ![kokkak](https://avatars.discourse-cdn.com/v4/letter/k/71e660/32.png) [@kokkak](https://discourse.nodered.org/u/kokkak)\
**Post date:** [14 April 2020 01:32 UTC](https://discourse.nodered.org/t/error-modbus-exception-254-on-modbus-tcp/24448/9 "2020-04-14T01:32:32Z")

</div>

Thank you.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [13 June 2020 01:32 UTC](https://discourse.nodered.org/t/error-modbus-exception-254-on-modbus-tcp/24448/10 "2020-06-13T01:32:35Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
