Arduino icon indicating copy to clipboard operation
Arduino copied to clipboard

Many problems with WiFi libraries

Open odilonafonso opened this issue 10 years ago • 14 comments

I'm used to use ESP modules to the Arduino libraries and AT firmware. Recently I decided to use the WiFi ESP8266 libraries and am having a lot of problems . I have seen many comments about the version 2.1.0.rc1 - I'm using . I can not use DEBUG , can not reconnect to a wifi ... I am a week ago and not evolution. I'd better uninstall it and start over with a previous release ? I noticed that the boards manager of the Arduino IDE also offers me the previous releases of WiFi ESP8266 libraries. I must install them as well ? I just installed the latest release - 2.1.0 - rc1

odilonafonso avatar Jan 18 '16 11:01 odilonafonso

the rc1 uses SDK 1.5.0 which is instabil, try latest git (SDK 1.5.1) it perform much better.

Links2004 avatar Jan 18 '16 17:01 Links2004

Hi Links2004. I don't know how to do this. Where do I get SDK 1.5.1 ? Thank you

odilonafonso avatar Jan 18 '16 17:01 odilonafonso

@igrr will create a rc2 soon (using SDK 1.5.1), check for updates in the next days.

if you want to use the latest git version: https://github.com/esp8266/Arduino#using-git-version-

Links2004 avatar Jan 18 '16 18:01 Links2004

Thank you Markus,

The instructions to use the ESP8266 are:

Instructions

  • Start Arduino and open Preferences window.
  • Enter http://arduino.esp8266.com/stable/package_esp8266com_index.json into Additional Board Manager URLs field. ..... .....

Using git version

This is the suggested installation method for contributors and library developers. Prerequisites

  • Arduino 1.6.5 (or newer, if you know what you are doing) - is this that I have
  • git
  • python 2.7
  • terminal, console, or command prompt (depending on you OS)
  • Internet connection

Instructions .... ....

You should end up with the following directory structure:

Arduino| --- hardware | --- esp8266com | --- esp8266 | --- bootloaders --- cores --- doc --- libraries --- package --- tests --- tools --- variants --- platform.txt --- programmers.txt --- README.md --- boards.txt --- LICENSE

Download binary tools cd esp8266/tools python get.py

Well, i have used the first method,

Now I have three hardware folders:

/opt/arduino-1.6.5-r5/hardware /home/Arduino/hardware (empty) /home/odilon/.arduino15/packages/esp8266

The structure I got when use the Arduino IDE board's manager is completely different from the structure of the git method!!

I have into home/.arduino/packages a esp8266 folder with 2 sub-folders:

hardware and tools

into hardware I found another folder esp8266.... esp8266/2.1.0-rc1 and into 2.1.0-rc1:

boards.txt cores libraries package programmers.txt tests variants bootloaders doc LICENSE platform.txt README.md tools

inside the tools there is the get.py file... is that must I run with python ?

I am completely confused....

What is the binary tools suggested to get with python - get.py

If I change the structure of the ESP8266 files, the Arduino IDE will found the things ? The libraries, includes, source files ?

May be is better I delete all folders and reinstall everything...

Thank you

odilonafonso avatar Jan 18 '16 19:01 odilonafonso

remove all existing ESP stuff. then:

Using git version Linux build status

  • Install Arduino 1.6.7
  • Go to Arduino directory
  • Clone this repository into hardware/esp8266com/esp8266 directory (or clone it elsewhere and create a symlink)
cd hardware
mkdir esp8266com
cd esp8266com
git clone https://github.com/esp8266/Arduino.git esp8266
  • Download binary tools (you need Python 2.7)
cd esp8266/tools
python get.py
  • Restart Arduino

yes you need python, the python script downloads the latest compilers and esptool

Links2004 avatar Jan 18 '16 19:01 Links2004

Ok. Must I remove the .arduino15 folder too ? Can I create the ESP8266 structure into my sketch folder ?

odilonafonso avatar Jan 18 '16 19:01 odilonafonso

Ok, forget the last comment... I install ESP8266 into /opt/arduino-1.6.7 folder Into this folder I make the clone and run python. But now, when I compile the sketch, i got:

Sketch uses 243,396 bytes (56%) of program storage space. Maximum is 434,160 bytes. Global variables use 35,192 bytes (42%) of dynamic memory, leaving 46,728 bytes for local variables. Maximum is 81,920 bytes. /home/odilon/.arduino15/packages/esp8266/hardware/esp8266/2.1.0-rc1/tools/esptool/esptool -vv -cd ck -cb 115200 -cp /dev/ttyUSB1 -ca 0x00000 -cf /tmp/build79ba95d60ea1a04c49bc5589b2922b96.tmp/WiFiAccessPoint.ino.bin java.io.IOException: Cannot run program "/home/odilon/.arduino15/packages/esp8266/hardware/esp8266/2.1.0-rc1/tools/esptool/esptool": error=2, No such file or directory at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048) at java.lang.Runtime.exec(Runtime.java:620) at java.lang.Runtime.exec(Runtime.java:485) at processing.app.helpers.ProcessUtils.exec(ProcessUtils.java:11) at cc.arduino.packages.Uploader.executeUploadCommand(Uploader.java:123) at cc.arduino.packages.uploaders.SerialUploader.uploadUsingPreferences(SerialUploader.java:167) at cc.arduino.UploaderUtils.upload(UploaderUtils.java:78) at processing.app.Sketch.upload(Sketch.java:1178) at processing.app.Sketch.exportApplet(Sketch.java:1152) at processing.app.Sketch.exportApplet(Sketch.java:1124) at processing.app.Editor$DefaultExportHandler.run(Editor.java:2430) at java.lang.Thread.run(Thread.java:745) Caused by: java.io.IOException: error=2, No such file or directory at java.lang.UNIXProcess.forkAndExec(Native Method) at java.lang.UNIXProcess.(UNIXProcess.java:248) at java.lang.ProcessImpl.start(ProcessImpl.java:134) at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029) ... 11 more

I think I have to change this: Cannot run program "/home/odilon/.arduino15/packages/esp8266/hardware/esp8266/2.1.0-rc1/tools/esptool/esptool": error=2, No such file or directory To another local.

odilonafonso avatar Jan 18 '16 19:01 odilonafonso

remove the rc1. delete /home/odilon/.arduino15/packages/esp8266 and restart the IDE.

Links2004 avatar Jan 18 '16 19:01 Links2004

​OK, now it is burning... but I'm still unable to connect to my wifi. Well, now I am with the 1.6.7 Arduino IDE release and the ESP8266 last version, right ? ​I will return to testing to see if I can some progress Many, many thanks for your help Markus !!​

odilonafonso avatar Jan 18 '16 20:01 odilonafonso

Markus, Do you know WiFiManager ? https://github.com/tzapu/WiFiManager I can connect with the AutoConnect example first time, but only first time...

*WM: *WM: AutoConnect *WM: Reading SSID *WM: SSID: *WM: myssid *WM: Reading Password *WM: Password: mypsk *WM: Connecting as wifi client... *WM: Connection result: *WM: 3 *WM: IP Address: *WM: 192.168.2.103 connected...yeey :)

(hear I do a hardware reset... ESP8266 RST to GND) or CH_PD floating for a while

*WM: AutoConnect *WM: Reading SSID *WM: SSID: *WM: myssid *WM: Reading Password *WM: Password: mypsk *WM: Connecting as wifi client... *WM: Connection result: *WM: 4 *WM: *WM: Configuring access point... *WM: AutoConnectAP *WM: AP IP address: *WM: 192.168.4.1 *WM: HTTP server started

(hear I do another hard reset)

*WM: AutoConnect *WM: Reading SSID *WM: SSID: *WM: myssid *WM: Reading Password *WM: Password: mypsk *WM: Connecting as wifi client... *WM: Connection result: *WM: 0 *WM: *WM: Configuring access point... *WM: AutoConnectAP *WM: AP IP address: *WM: 192.168.4.1 *WM: HTTP server started

And now, always I do hardware reset, it does the same thing. Get connection result 0 (WL_IDLE_STATUS)

I'm receiving this for a week... and I don't know anymore what to do.

I thought that with these changes things would get better

Well, thanks for the help so far

odilonafonso avatar Jan 18 '16 20:01 odilonafonso

I noted two things:

  1. When I use WiFI.mode (WIFI_STA) the occurrence of errors is greater than when I do not use.
  2. When I NOT use WiFi.begin (ssid, psk) and use WiFi.begin () without arguments (using saved credentials) decreases the occurrence of errors. This snippet is working relatively well:
  int wifiMode = WiFi.getMode();
  if ( !(wifiMode == WIFI_STA || wifiMode == WIFI_AP_STA) )
    WiFi.mode(WIFI_STA);
  Serial.print("\nWiFi.getMode():");Serial.println(WiFi.getMode());

  WiFi.printDiag(Serial);

  if ( !(WiFi.SSID().equals("")) ){
    Serial.println("Trying to connect with saved credentials...");
    WiFi.begin();
  }
  else {
    //provide eeprom read credentials...
    Serial.println("Connecting with eeprom credentials..");
    wifiSSID = eepromRead("ssid"); //actually eepromRead = WiFi.SSID();
    wifiPASS = eepromRead("psk");  //actually eepromRead = Wifi.psk();
    Serial.print("ssid ");Serial.println(wifiSSID);
    Serial.print("psk ");Serial.println(wifiPASS);
    Serial.print("Connecting to "); Serial.println(wifiSSID);
    WiFi.begin(wifiSSID.c_str(), wifiPASS.c_str());
  }

odilonafonso avatar Jan 18 '16 23:01 odilonafonso

hello.. I used the git version to add esp8266 to arduino software... but I have a problem with downloading the binary tools with python 2.7... when i run the 'get.py' script with python, this error appear: (Traceback (most recent call last): File "C:\Program Files (x86)\Arduino\hardware\esp8266com\esp8266\tools\get.py", line 114, in mkdir_p(dist_dir) File "C:\Program Files (x86)\Arduino\hardware\esp8266com\esp8266\tools\get.py", line 35, in mkdir_p os.makedirs(path) File "C:\Python27\lib\os.py", line 157, in makedirs mkdir(name, mode) WindowsError: [Error 5] Access is denied: 'dist/')

what does it mean? and what should i do? please help

MrSaeeed avatar May 04 '16 15:05 MrSaeeed

no one can give me a hint?? :-(

MrSaeeed avatar May 05 '16 13:05 MrSaeeed

@MrSaeeed , Run the CMD "As a Administrator", Thanks

rousnay avatar Jan 15 '17 19:01 rousnay