Help
  • Explore Community
  • Get Started
  • Ask the Community
  • How-To & Best Practices
  • Contact Support
Notifications
Login / Register
Community
Community
Notifications
close
  • Forums
  • Knowledge Center
  • Events & Webinars
  • Ideas
  • Blogs
Help
Help
  • Explore Community
  • Get Started
  • Ask the Community
  • How-To & Best Practices
  • Contact Support
Login / Register
Sustainability
Sustainability

Ask Me About Webinar: Data Center Assets - Modeling, Cooling, and CFD Simulation
Join our 30-minute expert session on July 10, 2025 (9:00 AM & 5:00 PM CET), to explore Digital Twins, cooling simulations, and IT infrastructure modeling. Learn how to boost resiliency and plan power capacity effectively. Register now to secure your spot!

M340 READ_VAR Fails with 16#0007 Error on Modbus TCP Gateway Communication

Modicon PAC Forum

A forum for topics related to the scope of Modicon PAC offers and ecosystem along the whole lifecycle: Modicon M580 and 340, EcoStruxure Control Expert, EcoStruxure Process Expert (Unity Pro) and more.

cancel
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Home
  • Schneider Electric Community
  • Industrial Automation
  • Modicon PAC Forum
  • M340 READ_VAR Fails with 16#0007 Error on Modbus TCP Gateway Communication
Options
  • Mark Topic as New
  • Mark Topic as Read
  • Float this Topic for Current User
  • Bookmark
  • Subscribe
  • Mute
  • Printer Friendly Page
Invite a Co-worker
Send a co-worker an invite to the portal.Just enter their email address and we'll connect them to register. After joining, they will belong to the same company.
You have entered an invalid email address. Please re-enter the email address.
This co-worker has already been invited to the Exchange portal. Please invite another co-worker.
Please enter email address
Send Invite Cancel
Invitation Sent
Your invitation was sent.Thanks for sharing Exchange with your co-worker.
Send New Invite Close
Top Experts
User Count
Trinxs1
Lt. Commander Trinxs1 Lt. Commander
10
ciupol
Lieutenant ciupol
9
MatthewM
Lt. Commander MatthewM
8
RoozeeR
Lt. Commander RoozeeR Lt. Commander
7
View All

Invite a Colleague

Found this content useful? Share it with a Colleague!

Invite a Colleague Invite
Back to Modicon PAC Forum
kelvinviroja93
Crewman kelvinviroja93
Crewman

Posted: ‎2025-07-23 10:31 AM . Last Modified: ‎2025-07-23 11:05 AM

0 Likes
2
63
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

Posted: ‎2025-07-23 10:31 AM . Last Modified: ‎2025-07-23 11:05 AM

M340 READ_VAR Fails with 16#0007 Error on Modbus TCP Gateway Communication

Hi all,

I'm using a BMEX342020 controller in my project, and I’m not using any physical I/O modules. The task is to read data from several Modbus RTU devices via Modbus TCP gateways.

I’ve used the READ_VAR block to fetch data from the slave devices. The configuration and addressing appear to be correct. However, I’m facing an intermittent issue:

  • Sometimes the READ_VAR block succeeds, and I get correct values.

  • Most of the time, it fails with error code 16#0007.

  • Meanwhile, if I use ModScan or similar tools from my PC with the same gateway and slave, the data is read successfully every time.

Here are some more details:

  • PLC: BMEX342020

  • Protocol: Modbus TCP to Modbus RTU (via gateways)

  • Modbus Gateways: Third-party, configured correctly (as verified with ModScan)

  • Using READ_VAR for polling multiple slave IDs

My questions:

  1. What exactly does error 16#0007 indicate in this context?

  2. Is there any timing or connection-related configuration I might be missing in the READ_VAR setup?

  3. Do I need to handle socket disconnections manually in this kind of setup?

  4. Could this be related to Modbus response timeout, or gateway holding the socket open?

Any insights or experiences from similar setups would be greatly appreciated.

Thanks in advance!

@Trinxs1 @ciupol @YONGHO-KIM @Hennie_Smith 

Attachments
M340 R1.zip
Labels
  • Labels:
  • 00. Read me first
  • 01. Modicon M340 PAC
  • 05. Networking & Communication
  • Tags:
  • english
Reply

Link copied. Please paste this link to share this article on your social media post.

  • All forum topics
  • Previous Topic
  • Next Topic
Replies 2
Hennie_Smith
Lieutenant JG Hennie_Smith Lieutenant JG
Lieutenant JG

Posted: ‎2025-07-24 03:10 AM . Last Modified: ‎2025-07-24 03:17 AM

1 Like
0
61
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

Posted: ‎2025-07-24 03:10 AM . Last Modified: ‎2025-07-24 03:17 AM

Hi Kelvin,

There could be various factors but looking at your code I would propose trying:

 

1. On the network settings, change the Bandwidth to 'MASTERED' which will give the CPU more time to process communication.

Hennie_Smith_0-1753349745342.png

 

2. Depending on your BAUD rate to the Serial devices the Timeout of the GEST you set of the 300ms might be too short (especially if the BAUD rate is 9600), have you tried changing the timeout to 500ms?

 

3. In CALL_2 to CALL_6 also add the code to increment your scheduler counter if the activity bit change to 0 like you done for CALL_1. That said, in CALL_1 for the increment of the counter, rather only look at the falling edge of the activity bit and don't include the report status (remove GEST[2]=0). 

 

To answer your specific questions:

  1.  Most likely gateway not responding in time.

  2. No, connections is managed by the CPU, no configuration in programme

  3. No, this is managed by the CPU

  4. Yes which is why I propose setting the timeout to 500ms

 

To have a status bit if the comms to each slave is online you can use a TOF time with GEST[2]=0. Bit will be 1 if comms is healthy

 

Regards,

Hennie Smith

Reply

Link copied. Please paste this link to share this article on your social media post.

YONGHO-KIM
Lieutenant JG YONGHO-KIM Lieutenant JG
Lieutenant JG

Posted: ‎2025-07-24 05:53 PM

1 Like
0
45
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

Posted: ‎2025-07-24 05:53 PM

1) 16#07: Problem in Sending to the Destination
- Please refer to the image below for more details.

YONGHOKIM_0-1753404762781.png

 

2) Ensure Adequate Delay Between READ_VAR Requests
- If the PLC sends requests too frequently, communication errors may occur.
- See the example below for recommended timing.

YONGHOKIM_1-1753404801039.png

 

3) Check Slave Device Response Time and Timeout Settings
- Make sure the slave device is not responding too slowly.
- Also verify that the timeout setting is not too short.

 

4) Verify Gateway TCP Connection Settings
- Check the TCP connection keep-alive time and the maximum number of simultaneous connections supported by the gateway.

Reply

Link copied. Please paste this link to share this article on your social media post.

Preview Exit Preview

never-displayed

You must be signed in to add attachments

never-displayed

 
To The Top!

Forums

  • APC UPS Data Center Backup Solutions
  • EcoStruxure IT
  • EcoStruxure Geo SCADA Expert
  • Metering & Power Quality
  • Schneider Electric Wiser

Knowledge Center

Events & webinars

Ideas

Blogs

Get Started

  • Ask the Community
  • Community Guidelines
  • Community User Guide
  • How-To & Best Practice
  • Experts Leaderboard
  • Contact Support
Brand-Logo
Subscribing is a smart move!
You can subscribe to this board after you log in or create your free account.
Forum-Icon

Create your free account or log in to subscribe to the board - and gain access to more than 10,000+ support articles along with insights from experts and peers.

Register today for FREE

Register Now

Already have an account? Login

Terms & Conditions Privacy Notice Change your Cookie Settings © 2025 Schneider Electric

This is a heading

With achievable small steps, users progress and continually feel satisfaction in task accomplishment.

Usetiful Onboarding Checklist remembers the progress of every user, allowing them to take bite-sized journeys and continue where they left.

of