# Modbus TCP Connection Cycles between Connected and Disconnected

**URL:** <https://forum.inductiveautomation.com/t/modbus-tcp-connection-cycles-between-connected-and-disconnected/61530>\
**Category:** Ignition\
**Tags:** ignition81\
**Created:** [July 5, 2022, 7:22pm UTC](https://forum.inductiveautomation.com/t/modbus-tcp-connection-cycles-between-connected-and-disconnected/61530 "2022-07-05T19:22:25Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![John\_Bray](https://avatars.discourse-cdn.com/v4/letter/j/13edae/32.png) [@John\_Bray](https://forum.inductiveautomation.com/u/John_Bray)\
**Post date:** [July 5, 2022, 7:22pm UTC](https://forum.inductiveautomation.com/t/modbus-tcp-connection-cycles-between-connected-and-disconnected/61530/1 "2022-07-05T19:22:25Z")

</div>

I’m having some issues with connecting to my Red Lion HMI. I configured it using Modbus TCP and when I setup the device, it it cycles between Disconnected and Connected. I found in the forums that this can happen if there’s no tags to keep the connection open, so I added 10 tags (just HR1-10) but all the tags display:

Quality: Bad(“Bad\_NotConnected: The variable should receive its value from another variable.”)

I’m lost, and I verified that I can read the registers with pyModbusTCP, so I don’t believe it’s an issue with my configuration of the HMI. I also monitored the network traffic between Ignition and the HMI and it seems like there’s information being exchanged roughly every 3 seconds, so I can’t believe it’s timing out. I also turned the timeout to 10 seconds and it still didn’t help, so I don’t believe it’s that.

Thanks!  
John

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [July 5, 2022, 7:37pm UTC](https://forum.inductiveautomation.com/t/modbus-tcp-connection-cycles-between-connected-and-disconnected/61530/2 "2022-07-05T19:37:04Z")

</div>

There’s probably a tag that is for an unsupported/undefined address. And it gets optimized into a larger read of multiple consecutive or near-consecutive addresses, failing them all. Consider disabling all of the tags on that devices, then re-enabling them one by one. Also look at the span gaps setting in the driver.

---

<div class="post-metadata">

**Author:** ![John\_Bray](https://avatars.discourse-cdn.com/v4/letter/j/13edae/32.png) [@John\_Bray](https://forum.inductiveautomation.com/u/John_Bray)\
**Post date:** [July 5, 2022, 8:09pm UTC](https://forum.inductiveautomation.com/t/modbus-tcp-connection-cycles-between-connected-and-disconnected/61530/3 "2022-07-05T20:09:59Z")

</div>

Hey Phil, thanks! It’s funny, a lot of the posts that I found researching this also had your name on them, you must be the resident Modbus expert 😆

That makes sense, and I went and cleared all but one tag at [RedLion]HR1, but the issue remained the same unfortunately.

---

<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:** [July 5, 2022, 8:12pm UTC](https://forum.inductiveautomation.com/t/modbus-tcp-connection-cycles-between-connected-and-disconnected/61530/4 "2022-07-05T20:12:27Z")

</div>

Can you verify with a 3rd party Modbus tool that HR1 is a valid address that the RedLion HMI is responding to?

One of the most common issues is that Ignition’s Modbus driver defaults to Unit ID 0, so if your device is using Unit ID 1 instead your address needs to be `1.HR1`. It seems to be about 50/50 whether a device uses 0 or 1 by default…

---

<div class="post-metadata">

**Author:** ![John\_Bray](https://avatars.discourse-cdn.com/v4/letter/j/13edae/32.png) [@John\_Bray](https://forum.inductiveautomation.com/u/John_Bray)\
**Post date:** [July 5, 2022, 8:22pm UTC](https://forum.inductiveautomation.com/t/modbus-tcp-connection-cycles-between-connected-and-disconnected/61530/5 "2022-07-05T20:22:18Z")

</div>

That totally worked! It’s so funny I had both you and Phil respond to my question, I think you both were on every post I read.  
Thank you so much!

---

<div class="post-metadata">

**Author:** ![John\_Bray](https://avatars.discourse-cdn.com/v4/letter/j/13edae/32.png) [@John\_Bray](https://forum.inductiveautomation.com/u/John_Bray)\
**Post date:** [July 5, 2022, 8:25pm UTC](https://forum.inductiveautomation.com/t/modbus-tcp-connection-cycles-between-connected-and-disconnected/61530/6 "2022-07-05T20:25:00Z")

</div>

Also, for anyone reading this in the future, the Red Lion product was a G10.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [July 5, 2022, 10:19pm UTC](https://forum.inductiveautomation.com/t/modbus-tcp-connection-cycles-between-connected-and-disconnected/61530/7 "2022-07-05T22:19:38Z")

</div>

> [@John\_Bray](#):
>
> funny I had both you and Phil respond to my question

Well, @Kevin.Herron is the long-standing leader of IA's driver team (and public face of the Eclipse Milo project), so him piping up on these topics should not be any surprise.

I, on the other hand, am merely a third party who happens to have an alternate Ignition [Modbus Driver](https://forum.inductiveautomation.com/t/automation-professionals-advanced-modbus-driver/41312) that fills in some gaps in available functionality. (:

---

<div class="post-metadata">

**Author:** ![Ravi\_Achan](https://avatars.discourse-cdn.com/v4/letter/r/bc8723/32.png) [@Ravi\_Achan](https://forum.inductiveautomation.com/u/Ravi_Achan)\
**Post date:** [October 6, 2024, 3:07pm UTC](https://forum.inductiveautomation.com/t/modbus-tcp-connection-cycles-between-connected-and-disconnected/61530/8 "2024-10-06T15:07:56Z")

</div>

Hello, I am getting this same error, with fluctuating Connected to Disconnected (Disconnected only for brief moments). When turning off the span gaps setting the error changes from Bad(“Bad\_NotConnected: The variable should receive its value from another variable.”)  
to just Bad\_NotConnected. The Device is 3rd party and we do not have access to it to disable all its tags.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [October 6, 2024, 7:40pm UTC](https://forum.inductiveautomation.com/t/modbus-tcp-connection-cycles-between-connected-and-disconnected/61530/9 "2024-10-06T19:40:14Z")

</div>

If you aren't using the same exact device as the OP, you should start a new topic. There are numerous possible causes for your problem, so you will need to provide a lot more detail about your situation in that new topic, including device brand/model, addresses you are trying to read, et cetera.
