Erayd24 Posted October 13, 2017 Report Share Posted October 13, 2017 My end goal is to send data over ethernet using the TCP/IP protocol to a raspberry pi. I already have the pi coded in python to look for a connection to its ip on a socket that I bound to it. My problem I believe is within the V570 PLC programming logic itself. I have initialized the card with ip 10.1.10.160 and my laptop with ip 10.1.10.100. Those two communicate correctly over ethernet. My pi is at ip 10.1.10.166. The pi is bound to a socket and currently waiting for something to connect to it on port 8888. I initialized socket 3 on the PLC as a Master on port 20257 and set the name to 'raspberryplc' Like I mentioned, the PLC and PC communicate correctly over ethernet. Lastly I have the TCP/IP config block which is initialized to socket 3 at ip 10.1.10.166 on port 8888. I then use SB142, 146 and 150 to check if I'm ready to attempt a connection, all still good and expected. I get a status 0 from the TCP/IP config block which signifies an all set response. I then have my TCP/IP CONNECT block set to Socket 3 to remote ip 10.1.10.166 on port 8888. At this point SB150 never goes high and I don't establish a connection. I can see something must be happening as when I stop and start the connection attempt on the PLC side, I can see the ethernet lights blinking on the raspberry pi. Thoughts? Either I'm missing something or it's correct but my raspberry pi is messed up. Thank you for any help anyone can offer. Quote Link to comment Share on other sites More sharing options...
MVP 2022 Joe Tauser Posted October 15, 2017 MVP 2022 Report Share Posted October 15, 2017 Is socket 3 configured as a Client or a Server? Just for grins, you may want to use a port above 20000 for the Pi. Joe T. Quote Link to comment Share on other sites More sharing options...
Erayd24 Posted October 16, 2017 Author Report Share Posted October 16, 2017 Socket 3 is configured as a Client and I believe the limit for the pi is that the port must be above 1024 as the first 1024 ports are reserved for system purposes. I tried 20200 anyway and still no luck. Quote Link to comment Share on other sites More sharing options...
MVP 2022 Joe Tauser Posted October 16, 2017 MVP 2022 Report Share Posted October 16, 2017 Configure it as a Server and see what happens. Joe T. 1 Quote Link to comment Share on other sites More sharing options...
Erayd24 Posted October 18, 2017 Author Report Share Posted October 18, 2017 Thank you Joe, that was the problem. I ran a test on my raspberry pi and windows laptop to make sure it wasn't my python code being the problem. I managed to connect to the PI and PC over sockets using ethernet IP. I did find out my IP to the PI was wrong though, two different IPs, one for the WI-FI and one for hard wired. By correcting that in the PLC program, it still didn't work, but coupled with the set as server change as you mentioned, it did. Makes no sense really since both are now configured as clients but if it works I really don't care. 1 Quote Link to comment Share on other sites More sharing options...
MVP 2022 Joe Tauser Posted October 19, 2017 MVP 2022 Report Share Posted October 19, 2017 Cool. I've been round and round with the Server/Client quandary in my Modbus TCP adventures in figuring out Master and Slave. One way works. The other doesn't. Joe T. 2 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.