Go Down

Topic: ESP 13 wifi shield with DOIT firmware issue (Read 7656 times) previous topic - next topic

pert

One tricky thing you'll encounter is that the AT commands have changed over time so you will need to adjust some commands you find in tutorials to your firmware version. I haven't found official documentation for the aithinker version of the AT firmware but even Espressif doesn't seem to provide their documentation for old versions of the AT firmware so you need to dig it up from somewhere else on the Internet if you are using an old version of their AT firmware for some reason.

agrp87132

#61
Apr 28, 2018, 12:27 am Last Edit: Apr 28, 2018, 12:32 am by agrp87132
AT+CWMODE?

I think only 1 & 3 does AT+CWLAP work

EDIT: If AT+CWMODE? returns a 2
then AT+CWMODE=3

And AT+CIOBAUD? doesn't work for me either

milanbx

#62
Apr 28, 2018, 12:34 am Last Edit: Apr 28, 2018, 12:34 am by milanbx
I have to thank all of you for help!! Thanks very much! I have just tried to connect to our home wifi, and the result seems to me OK:
AT+CWJAP?
+CWJAP:"madrid","74:ea:3a:a5:be:be",4,-51
OK

Last question:
If I am not mistaken, in this hw config, UNO is used only as USB-to-TTL. Which means, I will not develop sketches for UNO, but fur ESP8266 instead. Am I right?
And if I want to use UNO, do I need some wifi-to-UART library and sketch to upload to ESP first?

agrp87132

#63
Apr 28, 2018, 12:45 am Last Edit: Apr 28, 2018, 01:11 am by agrp87132
now that is where you need to read

https://tttapa.github.io/ESP8266/Chap01%20-%20ESP8266.html

or
http://www.martyncurrey.com/esp8266-and-the-arduino-ide/


there are some uses of esp as a dumb serial to wifi bridge for the Uno and the like, but limited

esp as microcontroller you can use more libraries

Edit: to use as a dumb serial to wifi bridge you are good to go!

pert

#64
Apr 28, 2018, 01:02 am Last Edit: Apr 28, 2018, 01:02 am by pert Reason: Link to ESP8266 core
There are multiple ways to use an ESP8266:

WiFi adapter module - In this usage you install a firmware on the ESP8266 such as the AT firmware and then control the ESP8266 from a separate Arduino board such as an Uno, Mega, Leonardo, etc. When using the ESP8266 in this way with the AT firmware I recommend the WiFiEsp library: https://github.com/bportaluri/WiFiEsp. This library provides an interface that is similar to the Arduino Ethernet and WiFi libraries so you can easily use code written for those libraries with minimal modifications.

Directly programming - In this usage you install an ESP8266 hardware package to the Arduino IDE that adds ESP8266 boards to the Arduino IDE. Then you can write sketches and upload them directly to your ESP8266. That sketch is the firmware on your ESP8266 so you won't be using the AT firmware, DOIT firmware, etc. The benefit of this is that the ESP8266 is actually a much more advanced microcontroller than the more outdated microcontroller on your Uno. The downside is that the support for the ESP8266 is not quite so good as the standard Arduino boards that have been around for years and have so many users. You will find that some libraries and sketches don't work on your ESP8266 and you have less pins to work with. The ESP8266 also runs at 3.3 V, which makes it a bit more difficult to interface with some standard Arduino accessories. Supposedly it is tolerant to 5 V logic input. The shield form factor is kind of clunky for this usage, unless you specifically want to interface with a standard Arduino board. Otherwise I would recommend buying a standalone ESP8266 board like the WeMos D1 Mini for this usage.

milanbx

OK, great, thanks. I will start with using ESP thru serial from Arduino. This would be with WiFiEsp library, right?
I have also found another one: https://github.com/ekstrand/ESP8266wifi
Do I understand right, that these libraries "transform" high-level routines to AT commands and send them over serial to ESP?

pert

This would be with WiFiEsp library, right?
That is the library I prefer. There is a problem with that library when you use it with the ESP8266 connected a board that has Serial on pins 0 and 1. The problem is that the WiFiEsp library by default outputs debug information on Serial and expects you to have the ESP8266 connected via Software serial to other pins. The debug output conflict with the AT commands being sent on the same serial port. So you need to edit the library to turn off the debug output, as shown here:
https://github.com/bportaluri/WiFiEsp/pull/46/files
You should also note that the examples that come with WiFiEsp are written for the ESP8266 connected via the SoftwareSerial library but it only needs some very minor changes to make them work with Serial.

You also have the option of connecting the ESP8266 to other pins on your Arduino board and using the SoftwareSerial library to create a serial port on those pins.

Either way, if you want help let me know.

I have also found another one: https://github.com/ekstrand/ESP8266wifi
That is somewhat similar to WiFiEsp except that it does not provide a compatible interface so you can't reuse code that was written for the Ethernet or WiFi libraries and you can't use it with other libraries that are compatible with those libraries.

Do I understand right, that these libraries "transform" high-level routines to AT commands and send them over serial to ESP?
That's correct. They hide all the AT commands inside a library and provide you with a much more user friendly API that wraps them.

ieee488

#67
Apr 28, 2018, 01:23 am Last Edit: Apr 28, 2018, 01:54 am by ieee488
Does that library keep pace with Espressif's AT command firmware releases?


Also, instead of disabling debug, can we have the debug go out a different set of pins?


.

agrp87132

#68
Apr 28, 2018, 01:31 am Last Edit: Apr 28, 2018, 02:09 am by agrp87132
Oh yeah, I almost forgot, WiFiESP library uses softwareserial.h which is error prone at 115200 baud rate,
you need to reset it to 9600

Edit: so I guess you're not good to go!

pert

Does that library keep pace with Espressif's AT command firmware releases?
The readme says:
Quote
Supports ESP SDK version 1.1.1 and above (AT version 0.25 and above).
Also, instead of disabling debug, can we have the debug go out a different set of pins?
Yes, you just need to edit this file as necessary:
https://github.com/bportaluri/WiFiEsp/blob/master/src/utility/debug.h
Oh yeah, I almost forgot, WiFiESP library uses softwareserial.h which is error prone at 115200 baud rate,
you need to reset it to 9600
Other than the debug output, the WiFiEsp library doesn't use anything specific. You pass it the Stream object it should use for communication with the ESP8266 via WiFi.init(). The example sketches are written to use SoftwareSerial if a second hardware serial port isn't available but there's nothing in the library that requires that and it's easy enough to change the examples.

I was waiting to see whether milanbx would decide they wanted to use software serial before bringing the issue of the baud rate up to avoid further confusing matters. If they stick with hardware serial, as the shield is wired, then there's no need to change baud rate. If they want to use software serial then likely they will need instructions for modifying the shield connections anyway.

Juraj

just a clarification: AT firmware doesn't configure AP. you had AP at 192.168.4.1 with AT firmware because the DoIt firmware configured it and the AT firmware started it because the configuration was remembered because you didn't erase the flash or write the blank.ino to clear the settings.

the esp8266 SDK is a part of every program (firmware or sketch) that should run on the esp8266. and the SDK reads the settings on flash and starts the STA or AP (unless it has remembered in the settings to not to do it).

milanbx

#71
Apr 28, 2018, 11:27 am Last Edit: Apr 28, 2018, 11:27 am by milanbx
To react on all the given advices and options, which I really appreciate, just let me remind my primarily concern: It is a wifi shield and I want to use it with Arduino! The issue was, that the original DOIT firmware was not saving setup entered on the config page (192.168.4.1). AT firmware was just a workaround. If I would be successful in uploading functional DOIT firmware, this all would be solved!

milanbx

#72
Apr 28, 2018, 09:48 pm Last Edit: Apr 28, 2018, 11:21 pm by milanbx
Juraj, could you advise me, if there is only one BIN file with the DOIT firmware (https://www.auselectronicsdirect.com.au/assets/files/TA0142%20WIFI%20Shield%20Library%20File.zip), can I use the other BINs (like blank.bin) to uplode the firmware properly, so that nothing bad remains in the flash?

Juraj

#73
Apr 29, 2018, 06:58 am Last Edit: Apr 29, 2018, 01:56 pm by Juraj
I would use settings from the AT firmware readme replacing the 'user' file. this are general settings for the esp8266 programs build with the SDK. ESP8266_AT_Bin_V1.6.1/bin/at/README.md

I do not know the flash size of the esp on the shield, but for example a section from the readme file:

Code: [Select]
### Flash size 8Mbit: 512KB+512KB
    boot_v1.2+.bin              0x00000
    user1.1024.new.2.bin        0x01000
    esp_init_data_default.bin   0xfc000 (optional)
    blank.bin                   0x7e000 & 0xfe000


boot_v1.2+.bin  - 2+ means some version greater then 2

note that blank.bin goes to 2 addresses, so it should be twice in fields of the tool

the Flash Download Tool changes a copy of esp_init_data_default.bin with detected settings and flashes the copy to esp8266

btw: arduino builder for esp8266 creates one bin, which is a concatenation of boot.bin, user.bin (sketch) and esp_init_data_default.bin, with zeros (blank.bin) in-between

milanbx

OK, I understand. In the meantime, I have succeeded in uploading the original DOIT firmware a finally setting up the AP/STA+client/server parameters. Everything works fine. Even having the shield on top of UNO. That was my goal, thus: SOLVED :-)

The most important topic to read were these:
1) advices and instructions to flash in pert's topic, mailny for the flash tool, WiFiESP and more other very good explanations - thanks pert
2) DOIT firmware BIN for the DOIT firmware option - thanks ieee488
3) how to flash AT firmware for the AT firmware option - thanks ieee488
4) very good A Beginner's Guide to the ESP8266 - thanks agrp87132
5) and very good explanations of what's behind the scenes - thanks juraj!
And, of course, finding out, when is the right time to pres RST buttung during upload :-)
Thank you all again!

Go Up