Go Down

Topic: ESP8266 SPI WiFi Shield ("nice to have") (Read 5451 times) previous topic - next topic

bilekj

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.

Juraj

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
You can't write an Arduino sketch if you didn't learn programming. Not the language, but the concepts of programming - algorithms and data types.


gcampos

#33
Feb 06, 2019, 01:32 pm Last Edit: Feb 06, 2019, 01:33 pm by gcampos
Fixed in commit https://github.com/JiriBilek/WiFiSpi/tree/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.

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.

gcampos

Fixed in commit https://github.com/JiriBilek/WiFiSpi/tree/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:

Quote
[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?

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.

Juraj

@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 https://github.com/JiriBilek/WiFiSpiESP/tree/OTA_AVR_ISP_(optional)#optional-ota-avr-isp
:-)
You can't write an Arduino sketch if you didn't learn programming. Not the language, but the concepts of programming - algorithms and data types.

gcampos

Jiri, treti odstavec v https://github.com/JiriBilek/WiFiSpiESP/tree/OTA_AVR_ISP_(optional)#optional-ota-avr-isp
:-)
Sorry, my linguistic skills are not enough1 :) :) :)

gcampos

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:
Code: [Select]

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);
    }
  }
}

bilekj

#40
Feb 06, 2019, 10:03 pm Last Edit: Feb 06, 2019, 10:15 pm by bilekj
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 :)
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

gcampos

@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!

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?


----


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?


Juraj

#43
Feb 07, 2019, 05:47 pm Last Edit: Feb 07, 2019, 05:54 pm by Juraj
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."

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
You can't write an Arduino sketch if you didn't learn programming. Not the language, but the concepts of programming - algorithms and data types.

gcampos

#44
Feb 07, 2019, 06:28 pm Last Edit: Feb 07, 2019, 06:30 pm by gcampos
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... ;):):):) )



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)?

 

Go Up