8266 with Nano cant get simple ConnectWPA example to work

Hi,

I am trying to get the example WiFi code working for WiFiEsp library, suipplied example code : ConnectWPA
Im using an Arduino Nano with an 8266 ESP01
I get the error below, I have double checked all wiring (tried reversing tx/rx) so am assuming the f/w in the 8266 is wrong.

[WiFiEsp] Initializing ESP module
[WiFiEsp] >>> TIMEOUT >>>
[WiFiEsp] >>> TIMEOUT >>>
[WiFiEsp] >>> TIMEOUT >>>
[WiFiEsp] >>> TIMEOUT >>>
[WiFiEsp] >>> TIMEOUT >>>
[WiFiEsp] Cannot initialize ESP module
[WiFiEsp] >>> TIMEOUT >>>
[WiFiEsp] No tag found
WiFi shield not present

I used the NODEMCU PROGRAMMER to flash the ESP01 which I assumed automatically puts in the latest version..? I searched numerous methods of programming the ESP01 but confused by many conflicting instructions on what f/w to put in..

What is the correct way to flash the 8266 and what firmware should I be using?

Thank you

fred_was_here:
I have double checked all wiring (tried reversing tx/rx)

Please give a complete list of which pin on the Nano each pin on the ESP-01 is connected to.

fred_was_here:
what firmware should I be using?

For the WiFiEsp library, you should be using the AT firmware, which the ESP-01 comes with pre-installed. It's very likely your problem is not with the firmware.

Uno Pin 2 to Rx on ESP-01 adaptor
Uno Pin 3 to Tx on ESP-01 adaptor

It was a an old board which had esphome software in it previously.
I have tried so many different versions of software now, I really just need to know what is the correct current version to work with this library ?

It seems the latest AT version is 1.7 but do I just load one .bin file or do I have to load 4, if someone can just clarify this please and the addresses please.

/*
 WiFiEsp example: ConnectWPA
 
 This example connects to an encrypted WiFi network using an ESP8266 module.
 Then it prints the  MAC address of the WiFi shield, the IP address obtained
 and other network details.

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

#include "WiFiEsp.h"

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

char ssid[] = "Pluckrose-2G";            // your network SSID (name)
char pass[] = "jake5britnee8!";        // your network password
int status = WL_IDLE_STATUS;     // the Wifi radio's status

void setup()
{
  // initialize serial for debugging
  Serial.begin(115200);
  // initialize serial for ESP module
  //Serial1.begin(9600);
  Serial1.begin(115200);
  // 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);
  }

  Serial.println("You're connected to the network");
}

void loop()
{
  // print the network connection information every 10 seconds
  Serial.println();
  printCurrentNet();
  printWifiData();
  
  delay(10000);
}

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

  // print your MAC address
  byte mac[6];
  WiFi.macAddress(mac);
  char buf[20];
  sprintf(buf, "%02X:%02X:%02X:%02X:%02X:%02X", mac[5], mac[4], mac[3], mac[2], mac[1], mac[0]);
  Serial.print("MAC address: ");
  Serial.println(buf);
}

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

  // print the MAC address of the router you're attached to
  byte bssid[6];
  WiFi.BSSID(bssid);
  char buf[20];
  sprintf(buf, "%02X:%02X:%02X:%02X:%02X:%02X", bssid[5], bssid[4], bssid[3], bssid[2], bssid[1], bssid[0]);
  Serial.print("BSSID: ");
  Serial.println(buf);

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

Correction, I am using a Uno...

fred_was_here:
It was a an old board which had esphome software in it previously.

Ah, I see. I was hoping you could skip over the fun of the ESP8266 firmware upgrade.

fred_was_here:
I really just need to know what is the correct current version to work with this library ?

The readme of the library says:

Supports ESP SDK version 1.1.1 and above (AT version 0.25 and above).

So any AT firmware version 0.25 and newer will work. That said, I haven't had any luck with using the latest AT firmware version. It just goes into a reset loop after boot. I had to go back one or two versions before I could get it to work.

fred_was_here:
do I just load one .bin file or do I have to load 4, if someone can just clarify this please and the addresses please.

There are several .bin files. The files and addresses are specified in the AT instruction set documentation:

fred_was_here:

  Serial1.begin(115200);

Software serial doesn't work reliably at 115200 baud. 115200 baud is the default speed of the AT firmware. You'll need to connect to your ESP-01 at 115200 and then use the appropriate AT command to configure it to run at a lower speed, then update that line of your code accordingly.

pert:
That said, I haven't had any luck with using the latest AT firmware version. It just goes into a reset loop after boot. I had to go back one or two versions before I could get it to work.

Ahh ok... Thank you for this little bit of gold info !

pert:
There are several .bin files. The files and addresses are specified in the AT instruction set documentation:
https://www.espressif.com/sites/default/files/documentation/4a-esp8266_at_instruction_set_en.pdf

Current version is 1.7.0 which you indicated was susspect, so if I go back to say version 1.5.1 and download
https://www.espressif.com/sites/default/files/ap/esp8266_at_bin_v1.5.1.zip

Im assuming I need the NON-BOOT version, is that correct..?

The 'Official Download Tools 3.6.5' programmer detects my chip as: 8M bit, Quad Core, 26Mhz
The readme for 8Mbit NON-BOOT quotes the following files to be uploaded:

blank.bin 0x1FB000
esp_init_data_default.bin 0x1FC000
blank.bin 0x7E0000
blank.bin 0xFE000
boot.bin 0x00000
eagle.flash.bin 0x00000
eagle.irom0text.bin 0x10000

Some files dont exist in the download...?

  • boot.bin doesnt exist so i tried substituting with boot_v1.2.bin
  • Neither eagle.flash.bin or eagle.irom0text.bin exist...

I can successfully ERASE & PROGRAM the chip, we have blue light activity and it says FINISH.

But using Putty at 115200 or 9600 on the correct COM port I just get no response...?
Where am I going wrong...?

fred_was_here:
Im assuming I need the NON-BOOT version, is that correct..?

no. see AT reference chapter "1.2.4 8 Mbit Flash"

and flash
ESP8266_NONOS_SDK_V2.0.0, AT_V1.3

1.5 is SDK V1.5. it is very old

Juraj:
no. see AT reference chapter "1.2.4 8 Mbit Flash"

and flash
ESP8266_NONOS_SDK_V2.0.0, AT_V1.3

1.5 is SDK V1.5. it is very old

OK, that works !
Thank you very much.

So, we go ignore the file names and addresses in the readme file that comes with that version, ok.

fred_was_here:
OK, that works !
Thank you very much.

So, we go ignore the file names and addresses in the readme file that comes with that version, ok.

no, there is the same table