Modbus TCP master example code issue.

Vaibhav02
Posts: 32
Joined: Wed Sep 04, 2024 8:09 am

Modbus TCP master example code issue.

Postby Vaibhav02 » Fri Apr 18, 2025 10:44 am

I am trying to communicate modbus esp32 master with my pc modsim64 (tcp slave). But I am facing issue of below:
Log

Code: Select all

I (5882) esp_netif_handlers: sta ip: 192.168.1.10, mask: 255.255.255.0, gw: 192.168.1.1
I (5882) Tag _ sta ...: Got IP:192.168.1.10
I (5882) wifi_sta: connected to ap SSID:Amset password:Amset@123
I (5902) mDNS: mDNS started with hostname: esp32.local
I (5902) mqtt: [APP] Free memory: 190844 bytes
I (5902) mqtt: Other event id:7
Modbus master example started...
I (5912) MASTER_TEST: Getting IP addresses from configuration...
I (5912) MASTER_TEST: Configured IP(0) = [192.168.1.20]
I (5922) MASTER_TEST: Configured 1 IP addresse(s).
I (5922) MASTER_TEST: Modbus master stack initialized...11
Netif pointer: 0x3ffbf4fc
ip_addr: 0x3ffb02ec
ip_port: 502
ip_addr_type: 1
I (5942) MASTER_TEST: Modbus master stack initialized...
I (5942) MB_TCP_MASTER_PORT: TCP master stack initialized.
I (5952) MB_TCP_MASTER_PORT: Host[IP]: "192.168.1.20"[192.168.1.20]
I (5962) MB_TCP_MASTER_PORT: Add slave IP: 192.168.1.20
I (5962) MB_TCP_MASTER_PORT: Connecting to slaves...
-E (6402) MB_TCP_MASTER_PORT: Cannot resolve host: 192.168.1.20
.E (6432) MB_TCP_MASTER_PORT: Cannot resolve host: 192.168.1.20
-E (6462) MB_TCP_MASTER_PORT: Cannot resolve host: 192.168.1.20
.E (6492) MB_TCP_MASTER_PORT: Cannot resolve host: 192.168.1.20
-E (6522) MB_TCP_MASTER_PORT: Cannot resolve host: 192.168.1.20
.E (6552) MB_TCP_MASTER_PORT: Cannot resolve host: 192.168.1.20
Ping:

Code: Select all

PS C:\Users\Admin\Desktop\gateway> ping 192.168.1.20

Pinging 192.168.1.20 with 32 bytes of data:
Reply from 192.168.1.20: bytes=32 time<1ms TTL=128
Reply from 192.168.1.20: bytes=32 time=2ms TTL=128
Reply from 192.168.1.20: bytes=32 time=1ms TTL=128
Reply from 192.168.1.20: bytes=32 time=1ms TTL=128

Ping statistics for 192.168.1.20:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 2ms, Average = 1ms
PS C:\Users\Admin\Desktop\gateway>

nipaka
Posts: 2
Joined: Mon Apr 14, 2025 7:23 pm

Re: Modbus TCP master example code issue.

Postby nipaka » Sat May 03, 2025 10:24 pm

Hello,

since I have the same issue, I was wondering if you already could solve the problem.

Who is online

Users browsing this forum: ChatGPT-User and 1 guest