These are chat archives for esp8266/Arduino

30th
Jul 2015
Dw
@deaware
Jul 30 2015 04:59 UTC
Hi igrr.
I have produced my board using FTDI chip and reset circuit similar to NodeMCU. I've tried to uploading using "ck metod". I found the problem is ESP8266 won't be reset when uploading the code. I've solved using oscilloscope and found that, the falling edge time of RTS pin is slower than CP2102. Now I've tried to patch the code to support FTDI chip with this reset circuit. I've change a little sequence from "ck method" and complete. I would like to pull my source to main repository. Do you have any suggest for me?
Dw
@deaware
Jul 30 2015 05:08 UTC

This is my board and reset circuit.

alt

alt

alt
Ivan Grokhotkov
@igrr
Jul 30 2015 05:38 UTC
@deaware thanks! did you check if this method works for nodemcu (CH340G and cp2102) boards as well? if so, i would prefer to call it "nodemcu". if you haven't tested it yet, i'll do it today.
@sticilface so this happens only if you have multiple esp's on your network listening on the same port?
sticilface
@sticilface
Jul 30 2015 07:15 UTC
@igrr I will isolate
The wifi network and esp to just one and try. But I think it is more that when the esp is publishing the service by mdns and then receives another packet. Amazingly thought when they are all 4 are running my ota binaries I can causes them all to reboot at the same time. With one multicast udp packet.
I commented out that line last night and on all four I've not had a single reboot from any of them whereas with the line they would reboot once every 5-15min.
Ivan Grokhotkov
@igrr
Jul 30 2015 07:23 UTC
well they should be receiving multicast packets all the time in order for OTA to work (I.e. otherwise they would not be discovered by DNS-SD). Perhaps the crash happens when packet is malformed?
oh wait, you're sending to 8266, not mDNS port
so when you do OTA, it doesn't reboot, even though OTA sends a packet to port 8266?
sticilface
@sticilface
Jul 30 2015 07:37 UTC
Correct. Ota works fine.
Dw
@deaware
Jul 30 2015 07:39 UTC
@igrr I have tested only in NodeMCU CP2102 version. It's work. But i haven't tested in CH340 version because i don't have it.
Ivan Grokhotkov
@igrr
Jul 30 2015 07:41 UTC
ok, I'll test it today then. which OS did you test this on?
(so I can test the rest)
sticilface
@sticilface
Jul 30 2015 08:17 UTC

@igrr I was wrong. But you gave me an idea, and I think I've at least found the issue.
It is the OTA.parseInt()....
If you send a packet that doesn't have two spaces in it, i.e. send 123 instead of 1 2 3, the parse int fails and reboots immediately. So if the ESP receives a malformed packet, it reboots. this might be why it is intermittent, and doesn't happen when OTA is working. number size does not matter, i.e. if the numbers are larger than int, but the spaces do. it just hangs waiting for the next int, when there is not one.

would checking size of packet and having a magic byte sequence at the start before parsing the int solve this?

Ivan Grokhotkov
@igrr
Jul 30 2015 08:41 UTC
yeah, this method is certainly not robust, but it was the first thing I happened to do for a quick test... perhaps need to add a checksum, or make it fail cleanly in case of parsing error
Dw
@deaware
Jul 30 2015 08:46 UTC
@igrr I've tested on Windows 8, MacOSX and Ubuntu. It's work for all.
sticilface
@sticilface
Jul 30 2015 08:52 UTC
I think before calling the parseInt, you have to be certain that the packet contains the spaces and therefore 3 ints to parse. If there was a magic 3 bytes to the start, then you could check to see if the packet was bigger than three bytes, read the three bytes, if they match then parse the ints.
Ivan Grokhotkov
@igrr
Jul 30 2015 09:00 UTC
@deaware cool, I've just tried your patch on a Mac and I must say it improves reliability with CP2102 as well! Will test with ch340g and merge today.
fmgomes
@fmgomes
Jul 30 2015 09:18 UTC
@igrr, can I help somehow in the SSL? I'm not an expert in that area, but if you give me some clues I could try to help. My main target is to be able to have rest webservices over https. I have read that in previous sdk releases there was a problem with long signed certificates, don't know if this is still a problem with sdk version 1.2
patjazz
@patjazz
Jul 30 2015 09:53 UTC

@sticilface
Thank you for your help...
but now, after compiling and before uploading, arduino ask me for a card's password ??? if i type anything, i got errors :

"processing.app.debug.RunnerException: Unable to connect to 192.168.1.161
at cc.arduino.packages.uploaders.SSHUploader.uploadUsingPreferences(SSHUploader.java:135)
at processing.app.debug.Compiler.upload(Compiler.java:168)
at processing.app.Sketch.upload(Sketch.java:1172)
at processing.app.Sketch.exportApplet(Sketch.java:1146)
at processing.app.Sketch.exportApplet(Sketch.java:1118)
at processing.app.Editor$DefaultExportHandler.run(Editor.java:2424)
at java.lang.Thread.run(Thread.java:745)
Unable to connect to 192.168.1.161"

Ivan Grokhotkov
@igrr
Jul 30 2015 10:24 UTC
@fmgomes you are welcome to try. Take axTLS library source code from sdk 0.9.3 (inside examples/IoT_Demo/ssl), and figure out (using diff) what were the changes relative to axTLS library trunk. Filter out all the changes which are irrelevant (i.e. espconn support). Then create a class derived from WiFiClient, and make all the data go through axTLS. There will be some issues with certificate management, basically we won't have enough RAM to fetch long certificate chains (if we want to store just the root certificate). Need to figure out how to work around this, perhaps by requiring the user to download the certificate manually and put it on the FileSystem somewhere...
Alexey Andreyev
@a-andreyev
Jul 30 2015 11:26 UTC

Hello! :)
Small question about the reference (both stable and staging):

WiFi.localIP() is for STA, WiFi.softAPIP() is for AP.

it should be swapped like that, right?

WiFi.localIP() is for AP, WiFi.softAPIP() is for STA.

Ivan Grokhotkov
@igrr
Jul 30 2015 11:28 UTC
WiFi.localIP() returns ESP's IP if it is in WIFI_STA mode
WiFi.softAPIP() returns ESP's IP if it is in WIFI_AP mode
Alexey Andreyev
@a-andreyev
Jul 30 2015 11:35 UTC
ok, thanks! it's not clear for me yet, should read the docs and sources more
fmgomes
@fmgomes
Jul 30 2015 11:40 UTC
@igrr, to what axTLS library trunk are you refering, to the one at sourceforge?
Ivan Grokhotkov
@igrr
Jul 30 2015 11:45 UTC
yes, there's also a mirror on Github
doesn't matter really, it hasn't been updated since 2013
Alexey Andreyev
@a-andreyev
Jul 30 2015 11:49 UTC
..got it finally! Sorry, I've mixed up STA and AP meanings
sticilface
@sticilface
Jul 30 2015 14:04 UTC

@patjazz I can't really help you any more as I've not seen that error, or any references to SSHUploader before... Are you able to compile and upload the sketch by serial? I guess to if you have an IP... is everything selected correctly in the tools... with upload using OTA, and port selected as the ESP. Even if it fails to connect you should get the command that the IDE is trying to use... mine looks like this

Build options changed, rebuilding all

Sketch uses 359,856 bytes (34%) of program storage space. Maximum is 1,044,464 bytes.
Global variables use 48,828 bytes (59%) of dynamic memory, leaving 33,092 bytes for local variables. Maximum is 81,920 bytes.
python /Users/a/Library/Arduino15/packages/esp8266/hardware/esp8266/1.6.5-988-gfd1d9da/tools/espota.py /dev/cu.usbserial 8266 /var/folders/nv/8j3v5v0s18v7p4249kv8qbz80000gn/T/build4843725901224439436.tmp/aa.cpp.bin 
Starting on 0.0.0.0:48266
Upload size: 364000
Sending invitation to: /dev/cu.usbserial
Traceback (most recent call last):
  File "/Users/a/Library/Arduino15/packages/esp8266/hardware/esp8266/1.6.5-988-gfd1d9da/tools/espota.py", line 95, in <module>
    sys.exit(main(sys.argv))
  File "/Users/a/Library/Arduino15/packages/esp8266/hardware/esp8266/1.6.5-988-gfd1d9da/tools/espota.py", line 90, in main
    return serve(args[1], args[2], args[3])
  File "/Users/a/Library/Arduino15/packages/esp8266/hardware/esp8266/1.6.5-988-gfd1d9da/tools/espota.py", line 32, in serve
    sent = sock2.sendto(message, remote_address)
socket.gaierror: [Errno 8] nodename nor servname provided, or not known

you can then test if it is working manually by taking this bit and running it in the command prompt

python /Users/a/Library/Arduino15/packages/esp8266/hardware/esp8266/1.6.5-988-gfd1d9da/tools/espota.py /dev/cu.usbserial 8266 /var/folders/nv/8j3v5v0s18v7p4249kv8qbz80000gn/T/build4843725901224439436.tmp/aa.cpp.bin

the /dev/cu.usbserial bit should be the IP... then it should work

you might have to enable programmer verbose settings in the arduino prefs...
patjazz
@patjazz
Jul 30 2015 14:54 UTC
Pasted Graphic.tiff
@sticilface I have to say that i am on Arduino 1.6.6 hourly build.... perhaps ? The sketch is the example library, upload and run with serial. I got the esp address and select OTA in arduino. All compile ok, and then ask me for a password for the card !? (arduino window) https://files.gitter.im/esp8266/Arduino/rBPX/Pasted-Graphic.tiff
pfffft ... never used gitter !
sticilface
@sticilface
Jul 30 2015 14:57 UTC
mmm. paste everything in the debug window from the IDE.
patjazz
@patjazz
Jul 30 2015 15:15 UTC

@sticilface last lines of a Very verbose listing without error :

/Users/pat/Library/Arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/1.20.0-26-gb404fb9/bin/xtensa-lx106-elf-gcc -g -Os -nostdlib -Wl,--no-check-sections -u call_user_start -Wl,-static -L/Users/pat/Library/Arduino15/packages/esp8266/hardware/esp8266/1.6.5-988-gfd1d9da/tools/sdk//lib -L/Users/pat/Library/Arduino15/packages/esp8266/hardware/esp8266/1.6.5-988-gfd1d9da/tools/sdk//ld -Teagle.flash.4m.ld -Wl,-wrap,system_restart_local -Wl,-wrap,register_chipv6_phy -o /var/folders/_t/0wgp18117bn6f859p_v6l46w0000gn/T/build415392165538885861.tmp/DNS_SD_Arduino_OTA.cpp.elf -Wl,--start-group /var/folders/_t/0wgp18117bn6f859p_v6l46w0000gn/T/build415392165538885861.tmp/sketch/DNS_SD_Arduino_OTA.cpp.o /var/folders/_t/0wgp18117bn6f859p_v6l46w0000gn/T/build415392165538885861.tmp/libraries/ESP8266WiFi/ESP8266WiFi.cpp.o /var/folders/_t/0wgp18117bn6f859p_v6l46w0000gn/T/build415392165538885861.tmp/libraries/ESP8266WiFi/ESP8266WiFiMulti.cpp.o /var/folders/_t/0wgp18117bn6f859p_v6l46w0000gn/T/build415392165538885861.tmp/libraries/ESP8266WiFi/WiFiClient.cpp.o /var/folders/_t/0wgp18117bn6f859p_v6l46w0000gn/T/build415392165538885861.tmp/libraries/ESP8266WiFi/WiFiServer.cpp.o /var/folders/_t/0wgp18117bn6f859p_v6l46w0000gn/T/build415392165538885861.tmp/libraries/ESP8266WiFi/WiFiUdp.cpp.o /var/folders/_t/0wgp18117bn6f859p_v6l46w0000gn/T/build415392165538885861.tmp/libraries/ESP8266mDNS/ESP8266mDNS.cpp.o /var/folders/_t/0wgp18117bn6f859p_v6l46w0000gn/T/build415392165538885861.tmp/core/core.a -lm -lgcc -lhal -lphy -lnet80211 -llwip -lwpa -lmain -lpp -lsmartconfig -lwps -lcrypto -Wl,--end-group -L/var/folders/_t/0wgp18117bn6f859p_v6l46w0000gn/T/build415392165538885861.tmp
/Users/pat/Library/Arduino15/packages/esp8266/tools/esptool/0.4.5/esptool -eo /Users/pat/Library/Arduino15/packages/esp8266/hardware/esp8266/1.6.5-988-gfd1d9da/bootloaders/eboot/eboot.elf -bo /var/folders/_t/0wgp18117bn6f859p_v6l46w0000gn/T/build415392165538885861.tmp/DNS_SD_Arduino_OTA.cpp.bin -bm qio -bf 80 -bz 4M -bs .text -bp 4096 -ec -eo /var/folders/_t/0wgp18117bn6f859p_v6l46w0000gn/T/build415392165538885861.tmp/DNS_SD_Arduino_OTA.cpp.elf -bs .irom0.text -bs .text -bs .data -bs .rodata -bc -ec

Le croquis utilise 302 444 octets (28%) de l'espace de stockage de programmes. Le maximum est de 1 044 464 octets.
Les variables globales utilisent 40 824 octets (49%) de mémoire dynamique, ce qui laisse 41 096 octets pour les variables locales. Le maximum est de 81 920 octets.

HERE ASK FOR PASSWD

processing.app.debug.RunnerException: Unable to connect to 192.168.1.161
at cc.arduino.packages.uploaders.SSHUploader.uploadUsingPreferences(SSHUploader.java:135)
at processing.app.debug.Compiler.upload(Compiler.java:168)
at processing.app.Sketch.upload(Sketch.java:1172)
at processing.app.Sketch.exportApplet(Sketch.java:1146)
at processing.app.Sketch.exportApplet(Sketch.java:1118)
at processing.app.Editor$DefaultExportHandler.run(Editor.java:2424)
at java.lang.Thread.run(Thread.java:745)
Unable to connect to 192.168.1.161

sticilface
@sticilface
Jul 30 2015 15:22 UTC

for what ever reason, your IDE is not getting to the point of running the upload tool... you could maybe try using git clone for the repository, then build the IDE using ant dist (might have to google a bit to get that working) OR find your arduino15 folder for example on mac it is here

/Users/a/Library/Arduino15/packages/esp8266/hardware/esp8266/1.6.5-988-gfd1d9da/tools/espota.py

and find this espota.py file...
then run from the command line...

python pathto/espota.py IP_OF_YOUR_ESP 8266 "location of your bin file"

you can get the path of the file from a verbose serial upload too. At least this way you can see if it is the IDE or your pythonOTA bit that is not working.

Ivan Grokhotkov
@igrr
Jul 30 2015 15:30 UTC
@patjazz Arduino 1.6.6 hourly build? well, i have to say, network uploads have changed significantly in Arduino somewhere between 1.6.5 and 1.6.6.
our approach is not going to work any longer with these changes
basically IDE used to choose between SSH upload and upload using external tool based on a property set in boards description
now they always attempt to use SSH for network uploads
sticilface
@sticilface
Jul 30 2015 15:31 UTC
:(
Ivan Grokhotkov
@igrr
Jul 30 2015 15:32 UTC
So for now you can either roll back to 1.6.5 or use the python tool
and we need to engage @ffissore regarding this...
patjazz
@patjazz
Jul 30 2015 15:35 UTC
@sticilface @igrr i was thinking it was something with arduino .... so SSH explain the password (not too bad for OTA indeed !)
Markus
@Links2004
Jul 30 2015 15:41 UTC
@igrr @fmgomes axTLS last update 2 days ago? http://sourceforge.net/p/axtls/code/HEAD/tree/trunk/
Ivan Grokhotkov
@igrr
Jul 30 2015 15:44 UTC
oh, i though it was dead...
good to know
Markus
@Links2004
Jul 30 2015 15:44 UTC
yes but it still has no tls 1.2 support
Ivan Grokhotkov
@igrr
Jul 30 2015 15:47 UTC
it's hard to find a library that is
  • free
  • not GPL licensed
  • doesn't depend on POSIX
  • fits into ESP8266 RAM
  • has recent protocols support
Markus
@Links2004
Jul 30 2015 15:47 UTC
yes i know, have done some search my self
some ssl/tls is better then no one ;)
d-anders
@d-anders
Jul 30 2015 16:10 UTC
Why no gpl?
Ivan Grokhotkov
@igrr
Jul 30 2015 16:12 UTC
because gpl means no commercial use
patjazz
@patjazz
Jul 30 2015 16:13 UTC
@sticilface I get 'Arduino 1.6.5-r3', and it's OK.... Just i see with it that 'monitor/console' ask for passwd (SSH also i presume)
Thank you for helping me !
sticilface
@sticilface
Jul 30 2015 16:18 UTC
That is right, now it makes sense why the monitor asks for password. No worries, I'm new to all this as well, but try to help when i can
Markus
@Links2004
Jul 30 2015 16:19 UTC
the arduino core is under LGPL so if we want to integrate something in the core we need a compatible license.
if you create a library for the ESP it can use GPL but then you need to use GPL for you one code too.
and using GPL in commercial products is complicated in the most company´s.
d-anders
@d-anders
Jul 30 2015 16:21 UTC
right
Michael Miller
@Makuna
Jul 30 2015 16:27 UTC
Check out boringSSL, this is Google branch of OPENSSL and it semi to be the most up to date and still open.
Ivan Grokhotkov
@igrr
Jul 30 2015 16:28 UTC
boringssl might need OS to run (threads, system calls)
Markus
@Links2004
Jul 30 2015 16:32 UTC
if the size is like openSSL it needs to many flash ~1MB
fmgomes
@fmgomes
Jul 30 2015 16:40 UTC
@igrr, @Links2004 , so now it is better to make the diff with the axtls trunk at sourceforge, right? Can you carify why the diff should be made against the SDK 0.9.3 ssl example? Is this the SDK version used by esp8266/Arduino?
The IoT_Demo from SDK 1.2 doesn't have a ssl folder
Markus
@Links2004
Jul 30 2015 16:58 UTC
what you want too compare with diff?
we use SDK 1.2 in arduino, SDK 1.2 has ssl support from espressif.
but the idea is not using it, but using axtls instead.
Michael Miller
@Makuna
Jul 30 2015 16:59 UTC
@Links2004 they cut out support for unsecured protocols and trimmed the code down greatly. And I don't remember seeing anything with threads at all, but that doesn't mean it might not have functions that still take too long, but there were poll routines. It also supports dtsl while the espresif stuff didnt.
Markus
@Links2004
Jul 30 2015 17:01 UTC
removing support for unsecured protocols make sense :) is the sorce for the ssl blob from espressif on git?
Michael Miller
@Makuna
Jul 30 2015 17:04 UTC
I thought they pulled the ssl source.
fmgomes
@fmgomes
Jul 30 2015 17:18 UTC
@Links2004 igrr has recommend to diff between the ssl folder used in the IoT_Demo from V0.9.3 and the current axtls, this was the reason for me to ask 'why the 0.9.3'?
Markus
@Links2004
Jul 30 2015 17:20 UTC
@fmgomes no idea, is there a full ssl sorce in the SDK 0.9.3 ?
fmgomes
@fmgomes
Jul 30 2015 17:21 UTC
There is a partial axtls lib inside the IoT_Demo example
Markus
@Links2004
Jul 30 2015 17:22 UTC
then the diff make sense, to see what espressif is doing to port the lib to the ESP :)
fmgomes
@fmgomes
Jul 30 2015 17:22 UTC
but not complete, and of course adapted to the ESP (ICACHE_FLASH_ATTR, os_zalloc instead of calloc, etc.)
Markus
@Links2004
Jul 30 2015 17:23 UTC
noting more?
fmgomes
@fmgomes
Jul 30 2015 17:23 UTC
yep, this is what I was doing, but with the axtls from 2013 until you refer a version from 2 days ago :-)
sorry, this were just some quick diffs, not yet a deep analysis
Markus
@Links2004
Jul 30 2015 17:31 UTC
the goal is to find needed changes in the axtls, and then port them to the latest src (2 day ago code) and may improve them.
for the os_zalloc for example i think we shut implement calloc and not rename all the calls,
for the ICACHE_FLASH_ATTR may we can simple change the linker file.
if we need to do less changes we can easier port updates from the axtls trunk.
the most interesting changes (if there one is existing) are not the renaming stuff.
hope this helps to get the idea better.
fmgomes
@fmgomes
Jul 30 2015 17:40 UTC
Ok, but is there any ssl lib already used in ESP8266/Arduino? Or the idea is to start using axtls and calling it from the WiFiClient?
Markus
@Links2004
Jul 30 2015 17:42 UTC
no usage of ssl in ESP8266/Arduino, yes the idea is using axtls ontop of WiFiClient (stream interface of arduino) and create a transparent arduino like api for it.