ESP8266 SPI WiFi Shield ("nice to have")

Issued a request for adding the library to library manager, thanks for hint.

I'm glad if I was able to be assistance. Judging from what I've seen of the library and the quality of your support on this thread, I think it will be a very welcome addition!

pert:
I'm glad if I was able to be assistance. Judging from what I've seen of the library and the quality of your support on this thread, I think it will be a very welcome addition!

Kudos on that!!!!!

the Library Manager will not help to get the latest fixes. to update from GitHub, use git

Juraj:
the Library Manager will not help to get the latest fixes.

What do you mean?
Every so often the Arduino IDE warns me of library updates, so why not?

Juraj:
to update from GitHub, use git

Is there info on using git?
Or you mean downloading by hand?

On github you can download the whole repository (actually only a selected branch) using the green button "Clone or download". You will get a .zip file with the files.

gcampos:
What do you mean?
Every so often the Arduino IDE warns me of library updates, so why not?

Is there info on using git?
Or you mean downloading by hand?

Library Manager offers new releases, not partial fixes

google about git

Thanks.

bilekj:
Fixed in commit GitHub - JiriBilek/WiFiSpi at 4d12b26c8c5e80786d972e845f90f7bb858427b0
Please get new version of master library and try again.

I re-downloaded the entire lib from the root - not from this commit - and although it had a few misfires the first couple of tries, now it seems to work fine.

I added a "ticker" to WiFiSpiESP so that it blinks while connecting to the wifi network and it blinks slowly if wifimanager is enabled and gets called. After connecting, the led goes steady.
If you think this is interesting, I can send you the .ino file to publish.

@gcampos: it would be great to add an example to the library. Especially an example for wifimanager that, I admit, haven't time to try yet.
The best way would be to visit the github page of the WifiSPIESP project and add the example as a pull request.

bilekj:
Fixed in commit GitHub - JiriBilek/WiFiSpi at 4d12b26c8c5e80786d972e845f90f7bb858427b0
Please get new version of master library and try again.

I am trying it out.
On my DUE I set up a client which connects to a server (my PC).
The Due is just waiting for PC to send data.

After some time I got the following error, just once, but the system is still running:

[espspi_proxy.h:329] W: Slave tx is not ready, status 0

I was not trying for time endurance, so I don't know exactly how long after last data exchange this happened, maybe 2 to 3 hours.

Any thoughts?

Status 0 means SPISLAVE_TX_NODATA, i.e. master requested data but ESP8266 didn't have any prepared for it. A quick look in the code gives the thought:
It could mean:
a) loss of a message in SPI communication. Then after a timeout master repeats the message.
b) slow response from the internet that leads to a timeout. Hopefully master got the data later.

I wasn't able to understand if the communication was broken from the point the "Slave not ready" message was written or if it continued to run. Changes in version 0.2.0 were made especially to increase robustness of message exchange.

bilekj:
@gcampos: it would be great to add an example to the library. Especially an example for wifimanager that, I admit, haven't time to try yet.
The best way would be to visit the github page of the WifiSPIESP project and add the example as a pull request.

Jiri, treti odstavec v GitHub - JiriBilek/WiFiSpiESP at OTA_AVR_ISP_(optional)
:slight_smile:

Juraj:
Jiri, treti odstavec v GitHub - JiriBilek/WiFiSpiESP at OTA_AVR_ISP_(optional)
:slight_smile:

Sorry, my linguistic skills are not enough1 :slight_smile: :slight_smile: :slight_smile:

bilekj:
Status 0 means SPISLAVE_TX_NODATA, i.e. master requested data but ESP8266 didn't have any prepared for it. A quick look in the code gives the thought:
It could mean:
a) loss of a message in SPI communication. Then after a timeout master repeats the message.
b) slow response from the internet that leads to a timeout. Hopefully master got the data later.

I wasn't able to understand if the communication was broken from the point the "Slave not ready" message was written or if it continued to run. Changes in version 0.2.0 were made especially to increase robustness of message exchange.

When I saw the error message, I tried to send data from the server to Arduino and it received and displayed correctly.
That's why I think that the code on the DUE continued to run waiting for data, and communication was not broken, otherwise I would have other messages about reconnecting.

Here's the code:

void loop()
{
  
  if(!client.connected())
  {
       // if you get a connection, report back via serial:
      Serial.print(++count) ;
      Serial.print(" - Connecting to server: "); Serial.print(TARGET_ADDR);
      if(client.connect(TARGET_ADDR, TARGET_PORT))
      {
        Serial.println("... Connected!");
      }
      else
      {
        Serial.println("... Not connected!!!!");
        client.flush();
        client.stop();
        delay(2000);
        if(count>1000)
        {
          count=0;
          do
          {
            WiFiSpi.disconnect();
            Serial.print("\r\nAttempting to REconnect to network: "); Serial.println(ssid);
            // Connect to WPA/WPA2 network:
            status = WiFiSpi.begin(ssid, pass); // connect to specific network
            //status = WiFiSpi.begin("", ""); // connect to last succeffull connected network
            // wait 5 seconds for connection:
            delay(6000);
          }
          while(status != WL_CONNECTED);
        }
        // you're connected now, so print out the data:
        Serial.println("Connected to the network!");
      }
  }
  
  if(client.connected())
  {
    if(client.available())
    {
      Serial.println("\rFromServer---");
      while(client.available())
      {
        char c = client.read();
        Serial.write(c);
        delay(5);
      }
      Serial.println("\r\n--------------");
    }
    else
    {
       delay(20);
    }
  }
}

So then everything is as expected. An error in communication, either between master and ESP or between ESP and the internet. And the new protocol managed to sort it out :slight_smile:
FYI, I added checksum to data messages and a trivial handshaking mechanism that can resubmit the message in case it had not been delivered properly.

Edit: I meant current v0.2.0

bilekj:
@gcampos: it would be great to add an example to the library. Especially an example for wifimanager that, I admit, haven't time to try yet.
The best way would be to visit the github page of the WifiSPIESP project and add the example as a pull request.

Done!

Although I am using WiFiManager, it seems I must always connect with specific SSID and PASSWD in WiFiSpi.begin(ssid, pass).

I tried WiFiSpi.begin() and WiFiSpi.begin("", "") and this will give error.

This defeats the very purpose of WiFiManager itself.

How can start WiFiSpi when WiFiManager has already connected to the last network?


WiFiManager will go into AP mode only if it does not find last connected SSID.

Is there a way to programmatically force it into AP mode, even if last SSID is available?

gcampos:
1)

Although I am using WiFiManager, it seems I must always connect with specific SSID and PASSWD in WiFiSpi.begin(ssid, pass).

I tried WiFiSpi.begin() and WiFiSpi.begin("", "") and this will give error.

This defeats the very purpose of WiFiManager itself.

How can start WiFiSpi when WiFiManager has already connected to the last network?

about that was the link
"With WiFi Manager active, do not use WiFiSpi.begin() in the sketch. Only wait while WiFiSpi.status() != WL_CONNECTED."

gcampos:
2)
WiFiManager will go into AP mode only if it does not find last connected SSID.

Is there a way to programmatically force it into AP mode, even if last SSID is available?

from the sketch you could use WiFiSpi.disconnect() and then reset

Juraj:
about that was the link
"With WiFi Manager active, do not use WiFiSpi.begin() in the sketch. Only wait while WiFiSpi.status() != WL_CONNECTED."

Thanks, it worked.
(you know engineers, they never RTFM... ;):):):slight_smile: )

Juraj:
from the sketch you could use WiFiSpi.disconnect() and then reset

You mean soft reset the module (what is the command via WiFiSpi) or hard reset (I must wire one output from arduino to the reset pin of the ESP module)?