Notifications
Clear all

2560 Mega Wifi cannot initialize ESP module

5 Posts
2 Users
1 Reactions
383 Views
(@scsiraidguru)
Member
Joined: 8 months ago
Posts: 63
Topic starter  

https://diyodemag.com/projects/fixing_firmware_arduino_bootloader_on_uno_mega_part_1

I set 1-4 Off and 5-8 On.  I followed this document and reflashed the 2560 Mega Wifi a few weeks ago.   I was able to get the Wifi to get an IP.   I went back in and checked the flash and get the

ready
AT+GMR
AT version:1.6.2.0(Apr 13 2018 11:10:59)
SDK version:2.2.1(6ab97e9)
compile time:Jun  7 2018 19:34:26
Bin version(Wroom 02):1.6.2
OK

I put the switch setting back to 1-4 On 5-8 Off.  TX3 is set.   In the code I follow the document to set wifi to serial3 from serial1, like I did when it was working.   

  When I run the Wifi code, I get:

[WiFiEsp] Initializing ESP module
[WiFiEsp] >>> TIMEOUT >>>
[WiFiEsp] >>> TIMEOUT >>>
[WiFiEsp] >>> TIMEOUT >>>
[WiFiEsp] >>> TIMEOUT >>>
[WiFiEsp] >>> TIMEOUT >>>
[WiFiEsp] Cannot initialize ESP module

Any suggestions?  It was working after I flashed it and getting a wifi ip.  

 

 

 


   
Quote
(@scsiraidguru)
Member
Joined: 8 months ago
Posts: 63
Topic starter  

I finally got it working again.   It seems like it wants 115200 to work.   The SSID information is in Arduino_WIFI.h.  With 1-4 ON and 5-8 Off, you need to change the switch to TXD3/RXD3 and change four lines from Serial1 to Serial3.  

WebClient.ino

/*
 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"
#include "Arduino_WIFI.h"
// Emulate Serial1 on pins 6/7 if not present
#ifndef HAVE_HWSERIAL3
#include "SoftwareSerial.h"
SoftwareSerial Serial3(6, 7); // RX, TX
#endif

char ssid[] = SECRET_SSID;            // your network SSID (name)
char pass[] = SECRET_PASS;       // 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(115200);
  // initialize serial for ESP module
  Serial3.begin(115200);
  // initialize ESP module
  WiFi.init(&Serial3);

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

Arduino_WIFI.h

#define SECRET_SSID "xxxxxxx"
#define SECRET_PASS "xxxxxxx"

 


   
Josiah reacted
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 4 years ago
Posts: 7700
 

@scsiraidguru Yes, you have to match the serial monitor to the sketch for baud rate.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
ReplyQuote
(@scsiraidguru)
Member
Joined: 8 months ago
Posts: 63
Topic starter  

The notes on most sites had them 115200 and 9600.   I just glad to get it working again.  


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 4 years ago
Posts: 7700
 

@scsiraidguru As long as they match, I used to do 9600 out of habit, but for the last year or so I choose 115200.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
ReplyQuote