These are chat archives for esp8266/Arduino

29th
Jul 2015
Harrison Mclean
@h4rm0n1c
Jul 29 2015 04:24
This message was deleted
This message was deleted
The memory patch that's been floating around has been merged? Sweet.
sticilface
@sticilface
Jul 29 2015 08:15
@igrr and others, just wanted to say thanks for all the work! I replaced the flash chips on 3 ESP-01s and now have OTA working for all my projects. It is 2min to deploy new binaries to all of them which is amazing!!!!
d-anders
@d-anders
Jul 29 2015 08:23
do you use it when developing? doesnt ota transfers take quite long time?
Ivan Grokhotkov
@igrr
Jul 29 2015 08:30
In my experience, OTA takes less time than serial upload (although i am constrained to 230400 baud)
d-anders
@d-anders
Jul 29 2015 08:33
oh
i thought max wifi transfer rates were quite low
i should try it on my esp-12 then
Ivan Grokhotkov
@igrr
Jul 29 2015 08:35
transfer rates tend to go up as you increase packet size. if you use something like 1460 bytes (which is the MTU with current libraries), it will be fairly quick.
d-anders
@d-anders
Jul 29 2015 08:44
hm, then i think i have another question
what is the default packet size and where do i set it?
and does calling wificlient.write(*buf,1460) set it?
fmgomes
@fmgomes
Jul 29 2015 08:49
Yesterday I tried the new staging version, and the filesystem test: https://github.com/esp8266/Arduino/tree/esp8266/hardware/esp8266com/esp8266/tests/FSWrapper
It worked well, is this going to be the FS interface in the future?
Ivan Grokhotkov
@igrr
Jul 29 2015 08:52
mostly, yes. File and Dir classes will stay mostly the same (maybe will add some functions, but not remove anything)
FS class, i'm not totally sure, i'm still looking how to do it better
there will be free-standing functions like mount, open, openDir, rename, remove, etc
these will work with all mounted filesystems
e.g. you can have one SPIFFS mounted at /spi and an SD card mounted at /sd
and then do something like File f = open("/spi/config.txt", "r");
instead of File f = SPIFFS.open("/config.txt", "r");
this is useful for WebServer integration when WebServer doesn't know which filesystem it has to get files from
So i'm not sure if i need to keep FS.open, FS.openDir, etc. or just leave freestanding functions to do that
I'm preparing all this for the workshop at Boston Fab Fest which will happen next monday, so I will likely finish this stuff this week.
Ivan Grokhotkov
@igrr
Jul 29 2015 08:58
Suggestions on the API are totally welcome though.
d-anders
@d-anders
Jul 29 2015 09:15
keep it simple
Ivan Grokhotkov
@igrr
Jul 29 2015 09:23
@d-anders regarding packet size
each time you call client.write(), packet is sent. so the size of your data determines the size of the packet.
if you use client.println("foo"), for instance, that will cause two packets to be sent: one will be 3 bytes, containing "foo", another one two bytes, containing "\r\n"
because internally println calls write() two times
if you have char buf[1460] and you do wificlient.write(buf, sizeof(buf));, that will send all the data in one packet.
fmgomes
@fmgomes
Jul 29 2015 10:05
@igrr, thanks! Good work! How is the flash space reserved for the filesystem? Isn't it necessary to reserve space for it?
fmgomes
@fmgomes
Jul 29 2015 11:16
I need to have some space for the filesystem, but also need OTA, is it possible?
Ivan Grokhotkov
@igrr
Jul 29 2015 11:37
the space for filesystem is reserved automatically. in fact, it was reserved for a long time, it's just that we didn't have high-level FS api
for "generic" board, there is a menu which allows you to select flash size, and it lists how much will be for sketch and how much for SPIFFS
with 512k flash, the only option is 64k
with 1M flash, you have several options with different sizes allocated for sketch/SPIFFS
for flash over 1M, all the lower 1M is for sketch, above that is SPIFFS
NodeMCUs have 4M flash so the only layout for them is 1M sketch + 3M SPIFFS
So the only case where you might have a tradeoff between OTA and FS is if you have 1M flash. but these are not very common, usually it's either 512k or 4M.
fmgomes
@fmgomes
Jul 29 2015 11:47
Good old Murphy striking, i am using the Olimex board, it has 2M Flash and no menu for selecting the SPIFFS size, I've just checked changing for the generic board and saw the difference :-)
Ivan Grokhotkov
@igrr
Jul 29 2015 12:01
Yeah, with 2M the only option is 1M + 1M. If you like, you can add something like 512K + 1.5M yourself.
sticilface
@sticilface
Jul 29 2015 12:41
@d-anders. crude timing of my upload, 4M binary, from sending invitation to returned OK, 8 seconds.
using OTA
d-anders
@d-anders
Jul 29 2015 12:44
oooh
speedy!
Harrison Mclean
@h4rm0n1c
Jul 29 2015 12:44
that's... pretty cool.
d-anders
@d-anders
Jul 29 2015 12:47
hm, 500 kB/s, i think i get nowhere near that when serving files using the esp as webserver
Ivan Grokhotkov
@igrr
Jul 29 2015 12:59
4M? are you sure you are uploading that much?
sketches are normally less than 400k
sticilface
@sticilface
Jul 29 2015 13:21
Thats just the selection of the binary in the IDE, the flash size. I thought i noticed it does make the uploads by serial longer when i select 4M vs 512k, so i thought it was relevant. having just checked the size of the binaries, they are the same. <400k
so it is irrelevant
Still takes 8 seconds to perform an upgrade though, which is considerably faster than by serial.
probonopd
@probonopd
Jul 29 2015 14:44
@d-anders these work but are linear, not switching regulators which means they become hot and are less power efficient
d-anders
@d-anders
Jul 29 2015 14:45
yeah, but when im running from mains i dont care too much
sticilface
@sticilface
Jul 29 2015 14:46
I ordered 5 of these, and got 4.2V versions, I double checked and I had ordered 3.3V... so do check that they are correct
d-anders
@d-anders
Jul 29 2015 14:46
shame
did you ask for refund?
my guess is that esp8266 would run nicely on 4.2v even though it is too high
sticilface
@sticilface
Jul 29 2015 14:49
It does work just fine. I didn't bother asking as i only found out by accident several months later!
Harrison Mclean
@h4rm0n1c
Jul 29 2015 14:49
More like let the magic blue smoke out.
d-anders
@d-anders
Jul 29 2015 14:50
early on i had some stability issues with my esp, turned out my cheap benc supply was too noisy
i doubt it would die on 4.2v, i think i have run it on even higher
but it is not to be recommended of course
sticilface
@sticilface
Jul 29 2015 14:56
I've only had blue smoke with one 204V to 5V unit. No idea what happened but the first time i plugged it in, it blew the entire project up, leaving black soot everywhere! luckily the arduino survived!
d-anders
@d-anders
Jul 29 2015 16:03
cool
fmgomes
@fmgomes
Jul 29 2015 16:12
@igrr, how do the OTA and filesystem fit in the flash memory space? As far as I understand the OTA update checks for the end of the sketch to store the new image, do this collide with the filesystem space?
Ivan Grokhotkov
@igrr
Jul 29 2015 16:12
no they don't collide, FS lives above sketch space
you can take a look at Updater class:
it assumes that the top of sketch space is the bottom of FS space
Russ Mathis
@RussMathis
Jul 29 2015 17:19
Has anyone tried the ESP-13 yet? does it work with esp8166/arduino?
fmgomes
@fmgomes
Jul 29 2015 17:28
Hi @igrr, thanks for your feedback, I was looking for the code you refer, so the OTA update is stored between the running sketch code and the filesystem,right?
Ivan Grokhotkov
@igrr
Jul 29 2015 17:41
yes, right
fmgomes
@fmgomes
Jul 29 2015 17:47
@igrr, thanks again! Can you point me a clue how to edit the SPIFFS size for the Olimex board? i don't want a 1MB FS and to limit the sketch size
Ivan Grokhotkov
@igrr
Jul 29 2015 17:50
two places: linker script file (tools/sdk/ld) and boards.txt
fmgomes
@fmgomes
Jul 29 2015 17:51
And use the 'generic' board as an example?
Ivan Grokhotkov
@igrr
Jul 29 2015 17:51
make a new linker script which will define the memory map you like. look at the existing ones for reference
yep
fmgomes
@fmgomes
Jul 29 2015 17:52
Thanks!
Ivan Grokhotkov
@igrr
Jul 29 2015 17:52
note that irom0.text segment size has to be limited at 1Mb
code can not be run above 1Mb
but for the sketch stored during OTA this doesn't matter
so just change SPIFFS_start as you like
fmgomes
@fmgomes
Jul 29 2015 17:58
Ok, thank you @igrr
fmgomes
@fmgomes
Jul 29 2015 18:11
And about SSL / HTTPS support, do you have any plan to have it?
I need to interact with the firebase.com in a project, they only accept https connections, the only turnaround I can make is to create a proxy in a server that stays in the middle and converts the requests between the ESP8266 and the firebase servers, but it is not a clean solution
Ivan Grokhotkov
@igrr
Jul 29 2015 18:18
I did have a plan, and I planned to have it by August, but alas, I didn't have enough time to do it. My primary job took much of my spare time this month so the progress with this project was not what I hoped for.
It's possible to integrate SSL, although with lots of caveats regarding certificate verification
patjazz
@patjazz
Jul 29 2015 18:46
Hi igrr,

i have this error with the last update :
Les options de compilation ont été modifiées, tout sera recompilé
/Users/pat/Library/Arduino15/packages/esp8266/hardware/esp8266/1.6.5-981-gbfc6b27/cores/esp8266/core_esp8266_phy.c:265:13: warning: conflicting types for 'run_user_rf_pre_init' [enabled by default]
extern void
runuserrf_pre_init(void) __attribute((weak));
^
/Users/pat/Library/Arduino15/packages/esp8266/hardware/esp8266/1.6.5-981-gbfc6b27/cores/esp8266/core_esp8266_phy.c:250:5: note: previous implicit declaration of 'run_user_rf_pre_init' was here run_user_rf_pre_init();
^

just a warning :-)

Ivan Grokhotkov
@igrr
Jul 29 2015 18:51
ok I'll check
funny that compile tests passed though
sticilface
@sticilface
Jul 29 2015 18:54
I confirm I get this too, I also purged the staging folder, and re-downloaded all the bitsandbobs...
Ivan Grokhotkov
@igrr
Jul 29 2015 18:56
oh, ok, if it's a warning then never mind
will fix
patjazz
@patjazz
Jul 29 2015 19:09
is there some explanations on 'how to use' arduino & OTA ?
Michael Miller
@Makuna
Jul 29 2015 19:38
@igrr so thinking more about noInterrupt and interrupt, maybe the right thing to do is to always have noInterrupt goto level 15 and interrupt goto level 0 and not store any state. While having the xt_ macros for use in interrupts to store and reset state.
sticilface
@sticilface
Jul 29 2015 19:39
There is an OTA demo sketch in the ESP8266mDNA folder, SD_Arduino_OTA. Load it up, enter your wifi details, transfer it to the ESP using serial. You must select a flash size of 1M or more. restart it... hopefully after a few min of waiting it will show up in the ports part of the Arduino IDE, provided you are using the latest version of the IDE. If it is there, select it then select OTA as method... make changes to the sketch and hit upload, and it should work. there are various caveats, you need python, won't work on ESP-01, and probably a few others that i've forgotten. @patjazz
Ivan Grokhotkov
@igrr
Jul 29 2015 19:59
@Makuna good idea!
sticilface
@sticilface
Jul 29 2015 21:10
@igrr ... I've been going absolutely bonkers with this lmac.c crash... and I think I've finally got to the bottom of it.... I can reproduce it at will by sending a UDP packet, to the aport (8266), of the OTA sketch. it doesn't work if i send it to 8267... it crashes ALL my ESPs running OTA if i send it to 224.0.0.251 Can you reproduce this ?
The packet can be empty.. I think having the same port on multicast is causing interference between my ESPs... so something must be up with the UDP implementation. I noticed it as they were all crashing at the same time!
sticilface
@sticilface
Jul 29 2015 21:28
It is definitely the MDNS...
comment out this line
``MDNS.addService("arduino", "tcp", aport);```
and it no longer crashes. Put it back and it does.
Although every time I send this packet I get a proper stack dump, not just the lmac.c 662, but the function that the stack refers to is full of lmac.c references so I'm assuming it is the same error.