SoftwareSerial vs NeoSWSerial - What am I doing wrong?

My appologies if this in the wrong place.

I'm testing SoftwareSerial and NeoSWSerial with the following code, SoftwareSerial works but NeoSWSerial fails as shown.
Between tests, there are no hardware changes being made (just changing code!).

I'm using a Nano connected to a DT-06 wifi module which uses a ESP M1 module from DOITING in China.

/*
 WiFiEsp example: WebClient

 This sketch connects to google website using an ESP8266 module to
 perform a simple web search.

 For more details see: http://yaab-arduino.blogspot.com/p/wifiesp-example-client.html
*/

#include "WiFiEsp.h"

// Emulate Serial1 on pins 11/12 if not present
#ifndef HAVE_HWSERIAL1
//#include "SoftwareSerial.h"
//SoftwareSerial Serial1(11, 12); // RX, TX
#include "NeoSWSerial.h"
NeoSWSerial Serial1(11, 12); // RX, TX
#endif

char ssid[] = "#2";            // your network SSID (name)
char pass[] = "PASSWORD";        // your network password
int status = WL_IDLE_STATUS;     // the Wifi radio's status

char server[] = "arduino.cc";

// Initialize the Ethernet client object
WiFiEspClient client;

void setup()
{
  // initialize serial for debugging
  Serial.begin(9600);
  // initialize serial for ESP module
  Serial1.begin(9600);
  // initialize ESP module
  WiFi.init(&Serial1);

  // check for the presence of the shield
  if (WiFi.status() == WL_NO_SHIELD) {
    Serial.println("WiFi shield not present");
    // don't continue
    while (true);
  }

  // attempt to connect to WiFi network
  while ( status != WL_CONNECTED) {
    Serial.print("Attempting to connect to WPA SSID: ");
    Serial.println(ssid);
    // Connect to WPA/WPA2 network
    status = WiFi.begin(ssid, pass);
  }

  // you're connected now, so print out the data
  Serial.println("You're connected to the network");
  
  printWifiStatus();

  Serial.println();
  Serial.println("Starting connection to server...");
  // if you get a connection, report back via serial
  if (client.connect(server, 80)) {
    Serial.println("Connected to server");
    // Make a HTTP request
    client.println("GET /asciilogo.txt HTTP/1.1");
    client.println("Host: arduino.cc");
    client.println("Connection: close");
    client.println();
  }
}

void loop()
{
  // if there are incoming bytes available
  // from the server, read them and print them
  while (client.available()) {
    char c = client.read();
    Serial.write(c);
  }

  // if the server's disconnected, stop the client
  if (!client.connected()) {
    Serial.println();
    Serial.println("Disconnecting from server...");
    client.stop();

    // do nothing forevermore
    while (true);
  }
}


void printWifiStatus()
{
  // print the SSID of the network you're attached to
  Serial.print("SSID: ");
  Serial.println(WiFi.SSID());

  // print your WiFi shield's IP address
  IPAddress ip = WiFi.localIP();
  Serial.print("IP Address: ");
  Serial.println(ip);

  // print the received signal strength
  long rssi = WiFi.RSSI();
  Serial.print("Signal strength (RSSI):");
  Serial.print(rssi);
  Serial.println(" dBm");
}

The NeoSWSerial failure:

[WiFiEsp] Initializing ESP module
[WiFiEsp] Warning: Unsupported firmware 3.0.4
Attempting to connect to WPA SSID: #2
[WiFiEsp] Connected to #2
You're connected to the network
SSID: #2
IP Address: 192.168.1.42
Signal strength (RSSI):-69 dBm

Starting connection to server...
[WiFiEsp] Connecting to arduino.cc
Connected to server
[WiFiEsp] >>> TIMEOUT >>>
[WiFiEsp] No tag found

Disconnecting from server...

And that all that happens...

I had to update the firmware as the module would not work at all on arrival!

This is being done in an attempt to solve problems in another sketch using MQTT as I'm running out of Nano resources!

Bob

use my WiFiEspAT library with AT 1.7 from SDK 3.
WiFiEsp is optimized for 9600 baud.
WiFiEspAT works at all baud rates supported by transport Serial

Hi Juraj,

Thanks for the reply.
From the DT-06

AT+GMR
AT version:1.7.4.0(May 11 2020 19:13:04)
SDK version:3.0.4(9532ceb)
compile time:May 27 2020 10:12:17
Bin version(Wroom 02):1.7.4
OK

This now runs the test sketch fine and the main project using MQTT works as well.

Have you done any work on a library to allow this WiFi module to run as SPI?????

Thanks again

Bob

rover-bob:
Hi Juraj,

Thanks for the reply.
From the DT-06

AT+GMR
AT version:1.7.4.0(May 11 2020 19:13:04)
SDK version:3.0.4(9532ceb)
compile time:May 27 2020 10:12:17
Bin version(Wroom 02):1.7.4
OK

This now runs the test sketch fine and the main project using MQTT works as well.

Have you done any work on a library to allow this WiFi module to run as SPI?????

Thanks again

Bob

only AT 2.1 on esp32 can run over SPI and it is experimental.

there are two firmware with corresponding library which use SPI connection, but they are not great. they have many issues.

SPI nano to D1 mini: