Go Down

Topic: Arduino Leonardo and duinotech Wifi Shield (Read 9382 times) previous topic - next topic

pert

As I said, it's not clear to me which firmware your shield was shipped with from reading the product page. I certainly prefer the AT firmware and it was a bit of a pain figuring out how to install the AT firmware. You could contact Jaycar customer service and ask them which firmware the shield has but if you have changed that firmware then it's irrelevant at this point. I do think you should be able to expect a certain level of support from Jaycar since they have charged so much more than the going rate for this product, that money should buy you something extra and I wouldn't say their documentation justifies it since it's pretty much just a rehash of the official AT command reference.

OfficialEnlightGames

#16
Mar 29, 2017, 12:08 pm Last Edit: Mar 29, 2017, 12:17 pm by OfficialEnlightGames
I GOT IT... OH MY GOD I DONT KNOW HOW BUT I GOT IT... YES THANKS SO MUCH PERT

EDIT: it stopped working again shield not present
EDIT: sorry again i figured it out why it refused to work because the "initialize ESP" was set to 9600 instead of 115200 well thanks for the help PERT much appreciated 

nannerbm

Hi there, after a couple of days of hair pulling, I found this thread and some other similar ones on the site. I created a login on arduino.cc specifically to thank pert for helping out with a shield that generates so much conflicting advice, blog posts and dummy spits.

I am now to the point where I can run the WebServerLed on the jaycar/duinotech ESP-13 shield and a rev 3 Uno. There will be celebrations tonight.

I would like to ask a couple of questions. 

My shield came with firmware that reported the AI_something AP SSID by default. It responds OK to AT but I can t visit it's advertised 192.168.4.1 web interface. Connection to that page times out although host is pingable. Do I need this web interface (for example to slow the interface - see SoftwareSerial question below)? Should I refflash the firmware? I. Plan to use the AT command set but am not sure if there is a 'best' firmware image for driving with AT commands.

I have turned down the debug on WiFiEsp to none.

When I run SoftwareSerial at 115200 on Uno pins 6,7 communicating to shield D0, D1 (not stacked, dip switches set) and report debug info over HW/USB Serial to the monitor, I see some pretty wild ascii at times (eg, the reported ssid will have 8 out of 10 characters correct). Am I barking up the wrong tree to simultaneously attempt reliable Comms with unstacked shield and readable debug? Does sw serial run reliably at 115200? Short of using the shield's unavailable web interface, can I dial down the shield serial speed to something that might reduce errors?

Lastly, in my search for anything that works today, I upped the HardwareSerial Tx and Rx buffers to 256 bytes in the HardwareSerial.h header file. Nothing I've seen here suggests that to be necessary and it's a bit chunk of the Uno's ram. Should I roll that back?

Thanks again!

   Matt

OfficialEnlightGames

hi pert i just got a new arduino uno r3 which can be found here: https://www.jaycar.com.au/duinotech-classic-uno/p/XC4410

i retried the prosess with the serial and serial1 thing and set the both to 115200 and they dip switches are on but i noticed that when both RX and TX off i get this:
Code: [Select]
Sketch uses 14550 bytes (45%) of program storage space. Maximum is 32256 bytes.
Global variables use 1035 bytes (50%) of dynamic memory, leaving 1013 bytes for local variables. Maximum is 2048 bytes.
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x5b
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x57
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x69
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x46
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x69
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x45
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x73
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x70
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x5d
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x20
An error occurred while uploading the sketch


these arduino things are quite interesting but stressful when it comes to handling with code
by the way the code i used for the arduino was:
Code: [Select]
/*
 WiFiEsp example: WebServerAP

 A simple web server that shows the value of the analog input
 pins via a web page using an ESP8266 module.
 This sketch will start an access point and print the IP address of your
 ESP8266 module to the Serial monitor. From there, you can open
 that address in a web browser to display the web page.
 The web page will be automatically refreshed each 20 seconds.

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

#include "WiFiEsp.h"

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

char ssid[] = "TwimEsp";         // your network SSID (name)
char pass[] = "12345678";        // your network password
int status = WL_IDLE_STATUS;     // the Wifi radio's status
int reqCount = 0;                // number of requests received

WiFiEspServer server(80);

// use a ring buffer to increase speed and reduce memory allocation
RingBuffer buf(8);

void setup()
{
  Serial.begin(115200);   // initialize serial for debugging
  Serial1.begin(115200);    // initialize serial for ESP module
  WiFi.init(&Serial1);    // initialize ESP module

  while(!Serial){}
  // check for the presence of the shield
  if (WiFi.status() == WL_NO_SHIELD) {
    Serial.println("WiFi Shield Not Detected On Your Arduino Uno");
    while (true); // don't continue
  }

  Serial.print("Attempting to start AP ");
  Serial.println(ssid);

  // uncomment these two lines if you want to set the IP address of the AP
  //IPAddress localIp(192, 168, 111, 111);
  //WiFi.configAP(localIp);
 
  // start access point
  status = WiFi.beginAP(ssid, 10, pass, ENC_TYPE_WPA2_PSK);

  Serial.println("Access point started");
  printWifiStatus();
 
  // start the web server on port 80
  server.begin();
  Serial.println("Server started");
}


void loop()
{
  WiFiEspClient client = server.available();  // listen for incoming clients

  if (client) {                               // if you get a client,
    Serial.println("New client");             // print a message out the serial port
    buf.init();                               // initialize the circular buffer
    while (client.connected()) {              // loop while the client's connected
      if (client.available()) {               // if there's bytes to read from the client,
        char c = client.read();               // read a byte, then
        buf.push(c);                          // push it to the ring buffer

        // you got two newline characters in a row
        // that's the end of the HTTP request, so send a response
        if (buf.endsWith("\r\n\r\n")) {
          sendHttpResponse(client);
          break;
        }
      }
    }
   
    // give the web browser time to receive the data
    delay(10);

    // close the connection
    client.stop();
    Serial.println("Client disconnected");
  }
}

void sendHttpResponse(WiFiEspClient client)
{
  client.print(
    "HTTP/1.1 200 OK\r\n"
    "Content-Type: text/html\r\n"
    "Connection: close\r\n"  // the connection will be closed after completion of the response
    "Refresh: 20\r\n"        // refresh the page automatically every 20 sec
    "\r\n");
  client.print("<!DOCTYPE HTML>\r\n");
  client.print("<html>\r\n");
  client.print("<h1>Hello World!</h1>\r\n");
  client.print("Requests received: ");
  client.print(++reqCount);
  client.print("<br>\r\n");
  client.print("Analog input A0: ");
  client.print(analogRead(0));
  client.print("<br>\r\n");
  client.print("</html>\r\n");
}

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

  // print where to go in the browser
  Serial.println();
  Serial.print("To see this page in action, connect to ");
  Serial.print(ssid);
  Serial.print(" and open a browser to http://");
  Serial.println(ip);
  Serial.println();
}


as you can see from this code the serial and serial1 are both set to 115200 but they dont work and i used the example before i changed the serial1 to 115200 and after but it seems to not like me and i have no idea why but its driving me insane.

please help me...

- Josh

pert

I created a login on arduino.cc specifically to thank pert for helping out with a shield that generates so much conflicting advice, blog posts and dummy spits.
I'm glad if I'm able to be helpful.

My shield came with firmware that reported the AI_something AP SSID by default. It responds OK to AT but I can t visit it's advertised 192.168.4.1 web interface. Connection to that page times out although host is pingable. Do I need this web interface (for example to slow the interface - see SoftwareSerial question below)? Should I refflash the firmware?
There are two different firmwares these shields come with: DOIT and AT. The shields I bought from Aliexpress about a year ago came with the DOIT firmware installed. Posts on this forum indicate that the shields purchased from Jaycar come with the AT firmware. Since you are able to sent AT commands to your shield that shows it has the AT firmware installed. The link I previously posted (https://fineshang.gitbooks.io/esp8266-based-serial-wifi-shield-for-arduino-user/content/chapter4.html), which mentions the web configuration of the shield by connecting to the AP and opening 192.168.4.1 is specifically for the DOIT firmware and thus doesn't apply to you as long as you are using the AT firmware. You can do any necessary configuration of your shield by using the appropriate AT commands or the WiFiEsp library.

Should I refflash the firmware? I. Plan to use the AT command set but am not sure if there is a 'best' firmware image for driving with AT commands.
There are two different "flavors" of the AT firmware. AI-thinker and Espressif. Espressif is the manufacturer of the ESP8266, AI-Thinker is the manufacturer of the ESP8266 modules. I don't have a lot of knowledge on the differences between the two. I haven't found any official information on the AI-Thinker firmware. AI-Thinker's website is in Chinese and Google Translate doesn't work on it. Espressif provides fairly good documentation of their firmware. My understanding is the AI-Thinker has additional AT commands that allow you to control the GPIO pins of the ESP8266. I don't see that feature as being terribly useful because it's much easier to just use the pins on the Arduino. Other than that they should be interchangeable for the most part. I have used the WiFiEsp library with the AI-Thinker AT firmware that came on a different style of ESP8266 shield I bought about a year ago. I have also used it with a fairly recent version of the Espressif AT firmware I installed on my DOIT shield (AKA "duinotech"). The WiFiEsp library does specify a minimum AT firmware version. I'm not sure whether the two flavors follow a similar versioning scheme. My preference is to always use the latest Espressif firmware but if the one you have is working for you already it might be best to leave it as is for now to avoid any unnecessary complications. You can use an AT command to do an OTA firmware update. Espressif waits a while to make their latest firmware available via OTA updates to make sure it's stable so you may not get the new and shiny unless you do a manual update, which is significantly more complex. Jaycar does provide a download with AT and DOIT firmwares and the update tool and instructions. I haven't looked closely to see what exactly this is.

When I run SoftwareSerial at 115200 on Uno pins 6,7 communicating to shield D0, D1 (not stacked, dip switches set) and report debug info over HW/USB Serial to the monitor, I see some pretty wild ascii at times (eg, the reported ssid will have 8 out of 10 characters correct). Am I barking up the wrong tree to simultaneously attempt reliable Comms with unstacked shield and readable debug?
That's a reasonable approach. It's nice to be able to get some debug output instead of working blind but there are some drawbacks. The SoftwareSerial library does use more memory and slows things down and you lose two pins.

Does sw serial run reliably at 115200?
I haven't used SoftwareSerial but my understanding is it does not run reliably at 115200, which is the default baud rate of the shield.

Short of using the shield's unavailable web interface, can I dial down the shield serial speed to something that might reduce errors?
Yes, there are AT commands that allow you to change the speed. I'm referring to the user manual linked from the Jaycar product page as that has the best chance of applying to the firmware their shield ships with:
https://www.jaycar.com.au/medias/sys_master/images/8936207220766/XC4614-manualMain.pdf
It says you use the AT+IPR command to change the baud rate. This is disturbing to me because recent versions of Espressif AT firmware use "AT+UART_CUR" or "AT+UART_DEF" for this, which indicates there are significant differences between the AI-Thinker firmware and the Espressif firmware.


Lastly, in my search for anything that works today, I upped the HardwareSerial Tx and Rx buffers to 256 bytes in the HardwareSerial.h header file. Nothing I've seen here suggests that to be necessary and it's a bit chunk of the Uno's ram. Should I roll that back?
Since you're using SoftwareSerial I don't think that is necessary.

pert

hi pert i just got a new arduino uno r3 which can be found here: https://www.jaycar.com.au/duinotech-classic-uno/p/XC4410
Using the Uno changes things a bit. Leonardo has Serial1 on pins 0 and 1, the pins the ESP8266 is connected to. The Uno has Serial on those pins. Serial is also used for uploading sketches to your Uno and for communication with the computer (e.g. Serial Monitor). So these things can interfere with each other.

You need to always turn the two switches on the blue box on the shield to the off position before uploading to your Uno and then back on to enable communication with the ESP8266. If the Uno has already started running its sketch before you turn the switches to the on position the ESP8266 may miss important commands so you should press the reset button on the Uno after turning the switches to on after the upload finishes.

Printing to the Serial Monitor (Serial.println(), etc.) may interfere with AT commands sent to the shield. This may or may not cause an issue, I have seen it cause commands to fail but it does work sometimes. This is a problem because without debug output to Serial Monitor it's hard to know what's happening. Once you get network communication going you can send debug output to your computer through WiFi instead of Serial.

The WiFiEsp library outputs debug information on Serial by default. This will cause the library to not work. You need to edit the library source code as shown here:
https://github.com/bportaluri/WiFiEsp/pull/46/files
This means you will get less useful information for troubleshooting but will save a bunch of memory and make the Arduino run faster.

The WiFiEsp examples are written with the assumption that the ESP8266 will be connected to Serial1 on boards that have multiple hardware serial interfaces available, as the Leonardo does, or using SoftwareSerial on boards with only the one hardware serial interface, as the Uno does. This means you will need to modify the example code accordingly.

If sharing Serial with the shield is inconvenient you do have the option of connecting pins 0 and 1 of the shield to any other pins on the Uno using jumper wires, as nannerbm has done. You can either not plug the shield into the Uno or you could carefully bend pins 0 and 1 of the shield so they don't go into the female header on the Uno when you plug the shield in. Then you can use the SoftwareSerial library to communicate with the Shield and Serial for its normal uses. You will need to reduce the baud rate of the shield as mentioned in my previous reply as SoftwareSerial is not reliable at the default 115200 baud of the shield.

OfficialEnlightGames

ok im kind of confused of editing this example code from wifiesp:
Code: [Select]
/*
 WiFiEsp example: WebServerAP

 A simple web server that shows the value of the analog input
 pins via a web page using an ESP8266 module.
 This sketch will start an access point and print the IP address of your
 ESP8266 module to the Serial monitor. From there, you can open
 that address in a web browser to display the web page.
 The web page will be automatically refreshed each 20 seconds.

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

#include "WiFiEsp.h"

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

char ssid[] = "TwimEsp";         // your network SSID (name)
char pass[] = "12345678";        // your network password
int status = WL_IDLE_STATUS;     // the Wifi radio's status
int reqCount = 0;                // number of requests received

WiFiEspServer server(80);

// use a ring buffer to increase speed and reduce memory allocation
RingBuffer buf(8);

void setup()
{
  Serial.begin(115200);   // initialize serial for debugging
  Serial1.begin(9600);    // initialize serial for ESP module
  WiFi.init(&Serial1);    // initialize ESP module

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

  Serial.print("Attempting to start AP ");
  Serial.println(ssid);

  // uncomment these two lines if you want to set the IP address of the AP
  //IPAddress localIp(192, 168, 111, 111);
  //WiFi.configAP(localIp);
 
  // start access point
  status = WiFi.beginAP(ssid, 10, pass, ENC_TYPE_WPA2_PSK);

  Serial.println("Access point started");
  printWifiStatus();
 
  // start the web server on port 80
  server.begin();
  Serial.println("Server started");
}


void loop()
{
  WiFiEspClient client = server.available();  // listen for incoming clients

  if (client) {                               // if you get a client,
    Serial.println("New client");             // print a message out the serial port
    buf.init();                               // initialize the circular buffer
    while (client.connected()) {              // loop while the client's connected
      if (client.available()) {               // if there's bytes to read from the client,
        char c = client.read();               // read a byte, then
        buf.push(c);                          // push it to the ring buffer

        // you got two newline characters in a row
        // that's the end of the HTTP request, so send a response
        if (buf.endsWith("\r\n\r\n")) {
          sendHttpResponse(client);
          break;
        }
      }
    }
   
    // give the web browser time to receive the data
    delay(10);

    // close the connection
    client.stop();
    Serial.println("Client disconnected");
  }
}

void sendHttpResponse(WiFiEspClient client)
{
  client.print(
    "HTTP/1.1 200 OK\r\n"
    "Content-Type: text/html\r\n"
    "Connection: close\r\n"  // the connection will be closed after completion of the response
    "Refresh: 20\r\n"        // refresh the page automatically every 20 sec
    "\r\n");
  client.print("<!DOCTYPE HTML>\r\n");
  client.print("<html>\r\n");
  client.print("<h1>Hello World!</h1>\r\n");
  client.print("Requests received: ");
  client.print(++reqCount);
  client.print("<br>\r\n");
  client.print("Analog input A0: ");
  client.print(analogRead(0));
  client.print("<br>\r\n");
  client.print("</html>\r\n");
}

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

  // print where to go in the browser
  Serial.println();
  Serial.print("To see this page in action, connect to ");
  Serial.print(ssid);
  Serial.print(" and open a browser to http://");
  Serial.println(ip);
  Serial.println();
}


because i have no idea where to put the edited string of code in this do i just remove this:
Code: [Select]

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


or should i leave it because this is driving me nuts and i know these things are for learning, no problem. I just get stuck because i kind of find these things hard to use but its interesting and i got the ethernet shield to work, no problem... but tyhe wifi shield seems to be the hardest out of them all anyway please help.

OfficialEnlightGames

i did some toying around with the wifiesp code and i got this:

[WiFiEsp] Initializing ESP moduleEOUT >>>
[WiFiEsp] Initializing ESP module
AT
[WiFiEsp] Initializing ESP module
AT
AT
AT+RST
ATE0
AT+CWMODE=1
AT+CIPMUX=1
AT+CIPDINFO=1
AT+CWAUTOCONN=0
AT+CWDHCP=1,1
AT+GMR
[WiFiEsp] Initilization successful - 1.3.0
AT+CIPSTATUS
WiFi shield not present


kind of strange...

pert

@OfficialEnlightGames you should really take the time to understand what every line of the sketch does.

Code: [Select]
#ifndef HAVE_HWSERIAL1
#include "SoftwareSerial.h"
SoftwareSerial Serial1(6, 7); // RX, TX
#endif

This checks if the board you're using has a second hardware serial interface available (Serial1). If not it assumes you are going to be using software serial on pins 6 and 7 and names the SoftwareSerial object Serial1 (not to be confused with the hardware serial object of that same name). If a second hardware serial interface is available on the board you're using then it will be used. Since the Uno doesn't have a second hardware serial interface that code will cause the sketch to use software serial. If you have the shield plugged into your Uno then it's connected to Serial, not pin 6 and 7 so this will not work. In that case you need to delete the lines of code shown above, as you guessed, but you also need to make another change.

Code: [Select]
 WiFi.init(&Serial1);    // initialize ESP module
That line passes the serial object to the WiFiEsp library so it can use it to communicate with the ESP8266. Since the ESP8266 is connected to Serial on your Uno, not Serial1 that is wrong. You need to change it to:
Code: [Select]
 WiFi.init(&Serial);    // initialize ESP module

As I said in my previous reply, you also need to edit the library source code to turn off debug output as this is also sent to Serial and will interfere with communication with the ESP8266. Follow these steps:
  • File > Examples > WiFiESP > ConnectWPA
  • Sketch > Show Sketch Folder - this will open the folder {sketchbook}/libraries/WiFiEsp/examples/ConnectWPA
  • Navigate to {sketchbook}/libraries/WiFiEsp/src/utility
  • Open debug.h in a text editor
  • Change line 31 from:

Code: [Select]
#define _ESPLOGLEVEL_ 3
to
Code: [Select]
#define _ESPLOGLEVEL_ 0
  • Save the file


Keep in mind that you can have debug output turned on in the WiFiEsp library when you're using it with your Leonardo so you may want to revert this change if you need to do troubleshooting in that configuration but otherwise I recommend always having debug output turned off as it uses a lot of memory and slows down your Arduino.

nannerbm

It says you use the AT+IPR command to change the baud rate. This is disturbing to me because recent versions of Espressif AT firmware use "AT+UART_CUR" or "AT+UART_DEF" for this, which indicates there are significant differences between the AI-Thinker firmware and the Espressif firmware.

Since you're using SoftwareSerial I don't think that is necessary.
Thanks for your detailed reply.

Using the unstacked arrangement, I tried in setup() with SoftwareSerial to slow down the speed talking to the "AI" firmware ESP8266 from an Arduino by initially connecting at 115200 in setup and then using AT+IPR=9600. Followed by a Serial1.begin(9600). No dice from some time of mucking about and adding delays and such.

I saw that the Espressif "AT+UART_DEF" effect a change save to flash and thought that would be a reasonable approach. Specifically: "AT+UART_DEF=9600,8,1,0,0".

I downloaded the Espressif user1.bin from github and flashed the board with an FTDI beast using details from this forum post:

 https://forum.arduino.cc/index.php?topic=420550.0

In particular, a document "XC4614 flash reprogramming.docx" that was pretty helpful.

There was one obscure step in this description and I relflashed the Espressif user1.bin at address 0x00000000. I was amazed and relieved to see that this worked to the point of blinken-lights across to the ESP-13 board.

Alas, it no longer responds to AT commands. Mmm...

So I am guessing that there is a flash layout that I failed to follow. Another source shows a layout like:

<code>
Bin                           Address
boot_v1.1.bin---------------->0x00000
user1.bin-------------------->0x01000    ---> you can use the newest version or a specific version.
esp_init_data_default.bin---->0x7C000
blank.bin-------------------->0x7E000
</code>

(Jeeze, how do I insert code tags? Mmm...).

So now I've typed this all in, I have convinced myself that I've stuffed up. I'll post it anyway in case it helps some other poor lost soul. :-)


pert

#25
Apr 06, 2017, 09:18 am Last Edit: Apr 25, 2018, 11:40 pm by pert Reason: Update instructions for latest firmware and flash tool versions
Alas, it no longer responds to AT commands. Mmm...
Sorry to hear. I've just updated the following instructions to use the latest Espressif AT firmware version 1.6.0.0, from NONOS SDK V2.2.0. I've also verified the same process works with AT firmware 1.3.0, from NONOS SDK V2.0.0 and AT firmware 1.1.0 from with NONOS V1.5.4, though you may need to make some small adjustments in the filenames with the older versions.

I feel that it's best to use the Espressif AT firmware. This is updated frequently and well documented. Espressif is the manufacturer of the ESP8266. The only benefit I'm aware of for using the AI-Thinker firmware is if you  want to control the ESP8266 GPIO pins via AT commands. I am under the impression that is possible with the AI-Thinker firmware, though I'm not certain of this and I haven't found good documentation for their firmware.

You can find documentation for the Espressif AT firmware in the "Getting Started" section of:
http://espressif.com/en/support/download/documents
"ESP8266 AT Instruction Set" also contains some information on how to flash the AT firmware to your ESP8266

The AT firmware is bundled with the NONOS SDK. You can find the latest version at:
http://espressif.com/en/support/download/sdks-demos

The Flash Download Tool is the application used to flash the ESP8266 with firmware. You can download the latest version at:
http://espressif.com/en/support/download/other-tools

You will need some sort of USB-TTL serial adapter, such as an FTDI FT232 breakout board. It is possible to use an Arduino for this purpose but it's easiest to use an adapter specifically designed for this. They can be purchased very cheaply on Aliexpress or eBay. Ideally you would use one that can provide 3.3 V signals but there is an official statement claiming the ESP8266 is 5 V logic level tolerant so you can probably get away with 5 V signals if that's all you have available.

You will need some jumper cables to make the various connections.

Here are instructions for flashing the DOIT/duinotech shield with the latest Espressif AT firmware version available at this time. In time new versions of the NONOS SDK/AT firmware or "Flash Download Tool" may become available so anyone reading this after some time has passed should check the links above to see if the links below point to the latest versions and if not then adjust the instructions below accordingly:
  • Connect the shield to your Arduino. Only the power and ground pins must be connected, this will ensure that your shield gets a reliable 5 V power supply. It is possible to power the shield directly from the USB-TTL serial adapter but this has not proven to be reliable for me.
  • Turn the two switches on the blue box to the OFF position.
  • If your USB-serial adapter has the option to change to 3.3 V then do so.
  • Use jumper cables to make the following connections:

USB adapter  Shield
RXTX0
TXRX0
GNDany pin marked "G"

  • Connect pin D0 on the shield to any of the pins on the shield marked G.
  • Power the Arduino by plugging the USB cable into your computer or a power supply.
  • Note which COM ports are installed on your computer in either Arduino IDE > Tools > Ports or Device Manager > Ports(COM & LPT)
  • Plug in the USB cable of USB-TTL serial adapter
  • Wait for the USB to serial adapter to finish installing. Install drivers if necessary.
  • Look for the new COM port Arduino IDE > Tools > Ports or Device Manager > Ports(COM & LPT), that is the COM port of the USB serial adapter.
  • Download NONOS SDK V2.2.0: https://github.com/espressif/ESP8266_NONOS_SDK/archive/v2.2.0.zip
  • Unzip the downloaded file.
  • Download Flash Download Tools V3.4.4: https://www.espressif.com/sites/default/files/tools/flash_download_tools_v3.6.4_0.rar.
  • Unrar the downloaded file.
  • Open the unrared folder and run the program ESPFlashDownloadTool_v3.6.4.exe.
  • Click the "ESP8266 Download Tool" button.
  • Click the "SPIDownload" tab.
  • Under the tool's tab bar there is a section of the window which provides columns of input fields where you can enter the paths and addresses of files to be flashed:
  • Click the first 6 checkboxes on the left side.
  • Click the ... button on the first line of the Download Path Config section and select the file ESP8266_NONOS_SDK\bin\blank.bin
  • In the box next to ADDR on that line enter 0x3FB000
  • Click the ... button on the second line of the Download Path Config section and select the file ESP8266_NONOS_SDK\bin\esp_init_data_default_v08.bin
  • In the box next to ADDR on that line enter 0x3fc000
  • Click the ... button on the third line of the Download Path Config section and select the file ESP8266_NONOS_SDK\bin\blank.bin
  • In the box next to ADDR on that line enter 0x7e000
  • Click the ... button on the fourth line of the Download Path Config section and select the file ESP8266_NONOS_SDK\bin\blank.bin
  • In the box next to ADDR on that line enter 0x3fe000
  • Click the ... button on the fifth line and select the file from the unzipped folder from the downloaded NONOS SDK file: ESP8266_NONOS_SDK\bin\boot_v1.7.bin
  • In the box next to ADDR on that line enter 0x00000
  • Click the ... button on the sixth line of the Download Path Config section and select the file ESP8266_NONOS_SDK\bin\at\512+512\user1.1024.new.2.bin
  • In the box next to ADDR on that line enter 0x01000
  • In the SpiFlashConfig section, check the SpiAutoSet checkbox. Because you did this, you don't need to worry about any of the other settings in the SpiFlashConfig section because they will now be automatically detected before the flash process starts.
  • In the "Download Panel 1" section, select the USB serial adapter's COM port from the COM PORT menu.
  • Click the START button. You should see the progress of the flashing in the bar at the bottom of the tool window.
  • Wait until the Download Panel 1 shows a green box that says "FINISH".
  • Close ESP FLASH DOWNLOAD TOOL.
  • Unplug the Arduino's USB cable.
  • Unplug the jumper from D0 to G.
  • Plug in the Arduino's USB cable.
  • Start the Arduino IDE.
  • Select the COM port of the USB-serial adapter from the Tools > Port menu.
  • Tools > Serial Monitor
  • Select 115200 from the baud rate menu at the bottom right corner of the Serial Monitor window.
  • Select "Both NL & CR" from the menu next to the baud rate menu at the bottom right corner of the Serial Monitor window.
  • Click on the text input box at the top of the Serial Monitor window.
  • Type AT+GMR
  • Press Enter.
  • You should now see a listing of the AT firmware version, SDK version, and compile time shown in the Serial Monitor. This indicates that the firmware update process was successful. If so you will be able to use your shield as usual.

pert

#26
Apr 06, 2017, 09:19 am Last Edit: Apr 25, 2018, 11:46 pm by pert Reason: Update instructions for latest firmware version.
The above instructions are specific to the DOIT shield, though they could be easily modified to work for flashing the AT firmware to any ESP8266 module. Here are some general explanations of how I determined the correct file names and addresses to configure the "ESP8266 Download Tool" with:
  • Because the ESP8266 requires a external flash memory there are a number of different ESP8266 modules available that will require different configurations due to using different flash chips. It is very difficult to find specifications for most of these modules and modules of the same name may actually use different flash chips, ESP-01 for example. Luckily the "ESP8266 Download Tool" (not very confidence inspiring that they don't know the correct term is "Upload") can automatically detect the flash configuration of common ESP8266 modules:
  • Connect the RX, TX, GND lines of the USB-serial adapter to the ESP8266. Ground GPIO0. Power the ESP8266.
  • Plug in the USB-serial chip to your computer.
  • Select the correct COM port in the "Flash Download Tool".
  • In the SpiFlashConfig section, check the SpiAutoSet checkbox
  • In the Download Path Config section, make sure all checkboxes on the left side are unchecked
  • Click the START button.
  • After a little while you should see text appear in the "DETECTED INFO" box.
  • Note the selection in the FLASH SIZE radio button menu of the "SpiFlashConfig" section of the "Flash Download Tool" GUI.
  • Download and open the "ESP8266 AT Instruction Set" PDF from the "Getting Started" section of: http://espressif.com/en/support/download/documents
  • In section 1.2 ("Downloading AT firmware into Flash") of that document you will see a table of the files and addresses to use for the FLASH SIZE configuration that was automatically detected by the tool. Configure the "Flash Download Tool" according to that table, using the files found in the NONOS SDK you downloaded from http://espressif.com/en/support/download/sdks-demos. When you get to esp_init_data_default.bin you will have an unpleasant surprise. There is no file named esp_init_data_default.bin included with the NONOS SDK. Instead you will find multiple similarly named files (e.g. esp_init_data_default_v05.bin, esp_init_data_default_v08.bin). I would tend to use the one with the newest version but I really don't know which is best. You will encounter the same frustrating discrepancy between documentation and firmware files with boot.bin.
  • Since you previously ran the auto detection from the tool you will need to reset or power cycle your ESP8266 before you can flash the firmware.

OfficialEnlightGames

jesus so much reading and i couldnt get that firmware to work at all

pert

jesus so much reading and i couldnt get that firmware to work at all
Huh? I provided those instructions for the benefit of nannerbm. There was no need for you to read them unless you wanted to update your firmware, which I would only recommend if you're having issues with the firmware on your shield. I thought we had everything working for you. If you're having a problem please provide a complete description.

nannerbm

Huh? I provided those instructions for the benefit of nannerbm.
Nannerbm appreciates your detailed response. I'll give it a try!

Code: [Select]

And here's a picture...

Go Up