Wiznet Bridge help

I am trying to set up my Wiz550s2e to connect to a server using a client static IP. Basically on the uart side I want to connect a device that supports HTTP and obviously on the Ethernet side to the network.

My client Static IP is 192.168.1.251
Server IP is 192.168.1.250
HTTP port 80

So for setting up the Wiznet this is what I have

AT+NSET=S,192.168.1.251,255.255.255.0,192.168.1.250
AT+NDATA

Is this all I need to do?

Also, is there a way to persist the settings above so after reset or power up it retains those settings?

Thanks

If you want to store AT commands in EEPROM, there are two ways.

The methods are AT+NMODE and AT+MSAVE.

For more information, please refer to each link.

What is AT+NDATA?
Is it AT+MDATA?

You must proceed with socket initialization after network settings. Please use the AT+NOPEN command, and please refer to Example of retrieving web page of www.google.com in Dynamic IP and TCP Client mode for further information.

In my case the client has to have a Static IP 192.168.1.251 and the web server is 192.168.1.250 on port 80.

I want the wiznet to act as a bridge from the network side to the UART side. Do I use
AT+NSET=S,192.168.1.251,255.255.255.0,192.168.1.250
AT+NOPEN=C,192.168.1.250,80

and

AT+MDATA

to open the connection to the web server?

Yes, that’s right.

However, if you want the module to act as a bridge to a web page, you must send it in an http format that your web page can understand in serial.

As you may have noticed, the S2E module is a simple convert function.

I am still having issues getting this to work.

My configuration is an ESP8266 configured as a WiFi Access Point. I have a second serial port SWSerial that is connected to the Wiznet550s2e serial port UART. I am able to send AT commands to the Wiznet and configure the IP, etc. I then issue the AT+MDATA command to go into data transmission mode.

I have the Ethernet port of the Wiznet connected to a web server via direct Ethernet cable(crossover type).
I then use my smartphone to access the ESP8266 AP and point my browser to the AP IP for the ESP8266 (192.168.4.1) default. I am using the ESP8266WiFi libraries in the Arduino IDE to run a simple program running a WiFi client. I can see the HTML request coming from my phones browser, but I don’t get any response from the web server connected to the Wiznet.

Is there something else I am missing? Is there a simple way to make this work? Seems simple enough, any help appreciated…

Thanks…

I ask you to make sure I understand your composition.

[Smartphone] --(wifi)-- [ESP8266] --(serial)-- [WIZ550S2E] --(ethernet)-- [Webserver]


Have you checked whether your web server is communicating with WIZ550S2E?

First of all, except for ESP8266, check whether you can communicate with Webserver through WIZ550S2E serial.
(Whether they are in the same network, etc.)

I think this part should be checked first.

I used the example from the wiki the Google, but used the IP of my web server and that worked.

Maybe an example using the esp8266 might help. I thought it would be easy, but I can’t seem to make it work…

Thanks…

Is your web server located on the Local Network?

I think it would be nice to check that the WIZ550S2E’s network configuration exists on the same network as your Webserver.

Since WIZ550S2E acts as a simple serial to Ethernet converter, regardless of whether you are using the ESP8266 or not, your data will be sent to the Webserver via Ethernet if you send to WIZ550S2E’s serial data that the webserver understands.

In my case there is just a point to point connection from the Wiznet module to the web server device that is the reason I am using the cross-over cable.

The configuration is like you had except the cross-over cable:

[Smartphone Accessing 192.168.4.1] --(wifi)-- [ESP8266] --(serial)-- [WIZ550S2E Static IP 192.168.1.251] --(Cross-Over Cable)-- [Webserver IP 192.168.1.250]

I am actually using the WEMOS D1 Mini (Esp8266) which has a built-in USB to Serial on the default Serial port of the device. In addition, I have set up a Software Serial port on the D1 Mini that is connected to the Wiznet UART (115200 baud). I can send the +++ to enter command mode and then the other AT commands to set the static IP and to open the port 80, etc… That works fine. Lastly I send AT+MDATA to switch to data mode. From the D1 Mini set as WiFi AP I use my phone to open the D1 Mini’s IP (192.168.4.1) and hopefully connect to the web server by Ethernet. I can see the HTTP request come through as I am using the default serial port as a monitor, but I get no response from the web server…Does this help any? Should I upload the code I am using on the D1 Mini?

As I said before, it is most accurate to communicate only with WIZ550S2E and Webserver.

However, if you want to use it easily through the library provided with ESP8266, the following method is recommended.

From your other topics, your webserver seems to work on your PC.
If your OS is macOS or windows, please use Wireshark to see if the Ethernet data is coming to your PC correctly.
(Whether data comes from the IP address of WIZ550S2E)

Please check this first and ask us any additional questions.

Guys, I have already spent too much time trying to get this to work. This should be a simple application.

At this point I going to try another route, maybe another Ethernet adapter and see if I can get this working.

Thanks…

As you say, this is a very simple application.

Often these problems are caused by missing a very basic part.
I want to help you more, but I can not help it if you have decided so.

If you have any questions, please ask questions here.

Thanks.

OK- Here is my code running on the Wemos D1 Mini (ESP8266) using Arduino IDE. See if this make sense or if I am doing something wronr. Reference the diagram I had posted earlier. Thanks…

#include <SoftwareSerial.h>
SoftwareSerial swSer(14, 12);

#include <WiFiClient.h>
WiFiClient client;

#include <ESP8266WiFi.h>
WiFiServer server(80);

String rx,tx;
bool AT_Done,ATNSTAT_Done, ATNOPEN_Done, ATMDATA_Done = false;


void setup() {
  Serial.begin(115200);
  swSer.begin(115200);

  server.begin();

  Serial.println("\nSoftware serial test started");
  Serial.println("Resetting Wiznet Board");
  resetWiznet();
  
  delay(2000);
  Serial.println("Sending +++");
  swSer.write("+++");
  delay(2000);

  /////////// WiFi Setup //////////////////
  WiFi.softAP("MyTest", "12345678");
  IPAddress myIP = WiFi.softAPIP();
  Serial.print("AP IP address: ");
  Serial.println(myIP);
}

void resetWiznet()
{
  pinMode(D7, OUTPUT);
  digitalWrite(D7,HIGH);
  digitalWrite(D7,LOW);
  delay(100);
  digitalWrite(D7,HIGH);
  delay(4000);
}


void loop() {
  
  if(!AT_Done)
  {
    delay(1000);
    Serial.println("Sending AT");
    swSer.write("AT\r\n");
    delay(2000);
    while(swSer.available())
    {
      Serial.print((char)swSer.read());
    }
    AT_Done = true;
    swSer.flush();
  }
  
  if(!ATNSTAT_Done)
  {
    delay(1000);
    Serial.println("Sending AT+NSet=S,192.168.1.251,255.255.255.0");
    swSer.write("AT+NSet=S,192.168.1.251,255.255.255.0\r\n");
    delay(1000);
    while(swSer.available())
    {
      Serial.print((char)swSer.read());
    }
    ATNSTAT_Done = true;
    swSer.flush();
  }

  if(!ATNOPEN_Done)
  {
    delay(1000);
    Serial.println("Sending AT+NOPEN=C,,192.168.1.250,80");
    swSer.write("AT+NOPEN=C,,192.168.1.250,80\r\n");
    delay(2000);
    while(swSer.available())
    {
      Serial.print((char)swSer.read());
    }
    ATNOPEN_Done = true;
    swSer.flush();
  }

  if(!ATMDATA_Done)
  {
    delay(1000);
    Serial.println("Sending AT+MDATA");
    swSer.write("AT+MDATA\r\n");
    delay(2000);
    while(swSer.available())
    {
      Serial.print((char)swSer.read());
    }
    ATMDATA_Done = true;
    swSer.flush();
  }

  ////////////////////////////////////////////////////////
  // Check if a client has connected
  if(!client.connected()) { // if client not connected 
     client = server.available(); // wait for it to connect 
     return; 
   } 
 
 
   // here we have a connected client 
   if(client.available()) { 
    rx = "";
     while(client.available()) { 
       rx += (char)client.read(); // read char from client
       delay(1);
     } 
     swSer.print(rx);
     Serial.println("From the WiFi Client...");
     Serial.print(rx);
   } 
 
 
   if(swSer.available()) { 
    tx = "";
     while(swSer.available()) { 
       tx += (char)swSer.read(); // read char from UART 
       delay(1);
     } 
     client.print(tx);
     Serial.println("From the Web Server...");
     Serial.print(tx);
   } 

}

In my opinion, the point to solve the problem is to ensure that the correct connection and data exchange between WIZ550S2E and Web Server is occurring.

You may want to test the devices by connecting them in the following configuration.

PC(serial terminal) <== Serial interface ==> WIZ550S2E <== Ethernet ==> Web Server

This test can help you check the response of an HTTP request sent via serial.
Are the intended data exchange between the devices in the above configuration properly done?

  • Notice
    • If the password of WIZ550S2E is set, please set it to no password and try again.
    • Password disable by setting it to blank

I tested as above, HTTP Get request was good, but got back random characters not a correct HTTP response.
I can connect my PC directly to the Web Server and I get the correct response.

Also, I blanked out the passwords and tried again, still no response from the web server.

Very frustrating as I think it has to do with the setup or configuration of the Wiznet module…

What else??

When you followed the diagram, did you mean that random characters were returned? When using WIZ550S2E?

Is not there a response, or is there a response but a strange character is returned?

I am concerned about the use of soft serial in your code and the baud rate.

Soft serial is unstable as fast as it controls GPIO unlike hardware serial.
I do not know about the ESP8266, but there have been many such issues in Arduino. Especially when using 115200, there are users who say that there is data loss.

So, in my opinion, do not connect WIZ550S2E to your server, but connect to your PC server and check if the HttpRequest you sent is transmitted without loss.
You can easily test using programs like PuTTY or Hercules.

Have you tested Serial to Ethernet, the most basic feature of the module?
With direct connection to a regular PC, did you check if the simple transfer of data is possible without problems using the above program?

If this basic function does not work, there is a problem with the module, but if it is not, it is not a problem with WIZ550S2E.

Yes - random characters were returned.

I swapped the serial ports on the ESP8266 so that the HW serial port is talking directly to the Wiznet serial port at 115200 and using the SW serial port for debug. This time when sending the HTTP request I get a response of 0xFF (255) that just keeps coming across the serial port. It just seems to send 0xFF continuously.

Again, if I use my PC, I get a correct response from my web server, just not with the Wiznet device.

It’s strange.

As I said before, have you tested as below?

SmartPhone --- ESP8266 --- WIZ550S2E --- PC (not WebServer)

First of all, I am wondering if the data sent to SmartPhone is properly transmitted to the ESP8266, and the data reaches the PC completely.

If you have a Serial to USB connector, please test it as below.

SmartPhone --- ESP8266 - (Serial to USB) - PC (or WebServer).

If the above works well, it will be quick to find out the problem of WIZ550S2E, otherwise it will be helpful to look at the serial side of ESP8266.

And can I see the Request Message you send and the message you need to respond to?
Exactly, I want to check the length of the messages.

I do not know what the ESP8266 is, but because of the very small size(64Byte) of the serial buffer in general Arduino codes, sending large amounts at once will cause data loss.