WiFiSPIESP between DUE and ESP doesn't work

Hello,

I am trying to get this to work with an Arduino Due and a Wemos D1. Connections for SPI are from the ICSP header on the Due, SS is connected to the default D10. Testing with an oscilloscope shows activity on all 4 SPI signals.
The serial output from the Due is repeating:
"Attempting to connect to WPA SSID: xxxxxx" (xxxxx is my wifi network)
The serial output from the Wemos is also repeating:
"Conn: xxxxxx -> 7" with sometimes a "Heap: 50736".

I believe that the communication between the Due and Wemos is working because there are no other error messages. There are a number of errors when I remove the Wemos.
I have tried several examples from:

but all show the same problem.

Hardware is OK: an ethernet adapter on the DUE using the same SPI pins is working fine and a simple sketch on the Wemos connects to my wifi network.
What could be wrong? Below is an example that doesn't work.

/*

 This example connects to an unencrypted Wifi network.
 Then it prints the MAC address of the Wifi module,
 the IP address obtained, and other network details.

 Circuit:
   1. On ESP8266 must be running (flashed) WiFiSPIESP application.
    
   2. Connect the master (Arduino or STM32F103) to the following pins on the esp8266:

            ESP8266         |        |
    GPIO    NodeMCU   Name  |   Uno  | STM32F103
  ===============================================
     15       D8       SS   |   D10  |    PA4
     13       D7      MOSI  |   D11  |    PA7
     12       D6      MISO  |   D12  |    PA6
     14       D5      SCK   |   D13  |    PA5

    Note: If the ESP is booting at a moment when the SPI Master (i.e. Arduino) has the Select line HIGH (deselected)
    the ESP8266 WILL FAIL to boot!

 original sketch for WiFi library created 13 July 2010
 by dlf (Metodo2 srl)
 modified 31 May 2012
 by Tom Igoe
 
 modified for WiFiSpi library 14 Mar 2017
 by Jiri Bilek
 */
 
#include <WiFiSpi.h>

// WiFi credentials
char ssid[] = "xxxxx";     // your network SSID (name)
char pass[] = "yyyyyyy";  // your network password

void setup() {
  //Initialize serial and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }
  Serial.println("Startup");

  // Initialize the WifiSpi library
  WiFiSpi.init();

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

  if (!WiFiSpi.checkProtocolVersion()) {
    Serial.println("Protocol version mismatch. Please upgrade the firmware");
    // don't continue:
    while (true);
  }

  // attempt to connect to Wifi network:
  int status;     // the Wifi radio's status

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

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

void loop() {
  // check the network connection once every 10 seconds:
  delay(10000);
  printCurrentNet();
}

void printWifiData() {
  // print your WiFi module's IP address:
  IPAddress ip = WiFiSpi.localIP();
  Serial.print("IP Address: ");
  Serial.println(ip);

  // print your MAC address:
  byte mac[6];
  WiFiSpi.macAddress(mac);
  Serial.print("MAC address: ");
  Serial.print(mac[5], HEX);
  Serial.print(":");
  Serial.print(mac[4], HEX);
  Serial.print(":");
  Serial.print(mac[3], HEX);
  Serial.print(":");
  Serial.print(mac[2], HEX);
  Serial.print(":");
  Serial.print(mac[1], HEX);
  Serial.print(":");
  Serial.println(mac[0], HEX);
}

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

  // print the MAC address of the router you're attached to:
  byte *bssid = WiFiSpi.BSSID();
  Serial.print("BSSID: ");
  Serial.print(bssid[5], HEX);
  Serial.print(":");
  Serial.print(bssid[4], HEX);
  Serial.print(":");
  Serial.print(bssid[3], HEX);
  Serial.print(":");
  Serial.print(bssid[2], HEX);
  Serial.print(":");
  Serial.print(bssid[1], HEX);
  Serial.print(":");
  Serial.println(bssid[0], HEX);

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

What firmware are you running on the ESP when you try to use the DUE to connect to it? Are you flashing the WIFISPIESP?

Firmware is the latest version 0.3.0 and is flashed in the Wemos D1.

Hi,
apologies for late reply.

I am seeing my comment in WiFiSPIESP about version of the Arduino core (see Readme in the repo).
Unfortunately, I don't know the current state of the problem. I will check it ASAP with the new Arduino core but if you want to try, you're free to install Arduino core 2.7.4 for ESP and compile the WiFiSPIESP app. This is the setup that worked for me.

Sorry for not updating earlier.
I wanted to keep the most recent ESP libraries on my main PC and tried to edit the wl_definitons.h file but that didn't work, I might have made an error. Could you explain on how to do this:

If you are really into using the bleeding edge esp8266/Arduino repo, 
go to WiFiSpi library and change the *wl_status_t* in *wl_definitons.h* 
file according to the esp8266 repo.

I have then installed the ESP 2.7.4 release on an old computer, connected the Wemos with voltage dividers to a Nano and this is working now.

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