BSeries - Using the W5500 chip to send/receive Modbus/TCP data packets through ethernet

Hi all,

We are currently using the B Series SoM with the M.2 eval board for a project. We need to use the built-in ethernet port to send and receive data packets (Modbus/TCP Protocol). I’ve been experimenting with the W5500 libraries trying to simply open a socket. No luck. Here is the documentation I’ve been using. The libraries can be found here.

I’ve tried directly opening a socket following the example shown in the documentation. And I’ve also tried opening one through the abstraction provided in socket.h.

Has anyone found an effective way to do this? Any advice would be greatly appreciated.

Make sure you’ve disable Ethernet support in Device OS:


void setup() 

This is necessary because you need to prevent Device OS from touching the W5500. If Device OS detects that you have a W5500 it will attempt to use it for the cloud connection, and during initialization it will enable PPP mode, which will prevent using it in socket mode from your code.

As long as you’ve disabled Ethernet in Device OS you should be able access it using plain SPI and a 3rd-party W5500 library as a socket device.

1 Like

Added that in and no luck. When I use the abstraction from socket.h I get SOCKERR_SOCKINIT. When I program the registers directly the socket just never opens.

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