These are chat archives for esp8266/Arduino

13th
Sep 2015
d-anders
@d-anders
Sep 13 2015 12:44
I have files in the fs, which are delivered fine by the webserver. Now I want to serve a zipped index.html. How do i do that using esp8266Webserver?
d-anders
@d-anders
Sep 13 2015 13:02
I guess I must set the encoding, but I don't see how
onkelfunny
@onkelfunny
Sep 13 2015 13:15
hello
i have some troubles with my nodemcu modules

void setup() {
Serial.begin(115200);
// initialize digital pin 13 as an output.
pinMode(BUILTIN_LED, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
Serial.println("TEST");
digitalWrite(BUILTIN_LED, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(BUILTIN_LED, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}

with nodemcu v09 the led blink but the Serial don't work
with nodemcu v2 nothing works (upload to the module works)
with esp-07 (breadboard) the led blinks but the Serial don't work
can someone help me?
d-anders
@d-anders
Sep 13 2015 13:19
code looks ok
what kind of power supply are you using?
onkelfunny
@onkelfunny
Sep 13 2015 13:23
direct over usb from the nodemcu module
d-anders
@d-anders
Sep 13 2015 13:27
are you using the serial monitor in arduino ide or some other program?
onkelfunny
@onkelfunny
Sep 13 2015 13:27
yes the serial monitor from arduino
d-anders
@d-anders
Sep 13 2015 13:28
does it show anything?
usually it prints some strange chars when the esp8266 starts
and then it starts printing what it receives from serial
onkelfunny
@onkelfunny
Sep 13 2015 13:29
sdlܟ<�l�<  �l� c|����r�#�c��gn�dog���c8ćlrd;lp�g��l  c n�|� �c��'o�d��$�ogd�dos���n {�d�g ��#�od� ��'o��lp�n� {����� co�|l��c��'o�d�$�ngl'{���g l x�n� {�����$�� cg�|lć c��'o� d�ogl'{���g �� s��' ��`�ՁMEM CHECK FAIL!!!
d;l�
d-anders
@d-anders
Sep 13 2015 13:29
mem check fail is probably not good, i think i read something about that once
onkelfunny
@onkelfunny
Sep 13 2015 13:30
i searched this message... it is ok on the old nodemcu
d-anders
@d-anders
Sep 13 2015 13:32
aha
your serial monitor is set to 115200?
onkelfunny
@onkelfunny
Sep 13 2015 13:33
yes
d-anders
@d-anders
Sep 13 2015 13:34
strange, never had any problems with the serial, and since you can upload...
onkelfunny
@onkelfunny
Sep 13 2015 13:35
with the new module i receive "0�~?�$�!�Y�_7E��Y�"
d-anders
@d-anders
Sep 13 2015 13:39
i doubt it will help, but have you tried some other program?
Simple webserver for example?
just trying to make sure it is not something code-related
oh, 'HelloServer' it is called
onkelfunny
@onkelfunny
Sep 13 2015 13:42
i uploaded the sketch to a esp-07 module.... this is the output in the console:
n 28780, room 16
tail 12
chksum 0x0b
ho 0 tail 12 room 4
load 0x3ffe8000, len 1332, room 12
tail 8
chksum 0xff
load
blink works... serial "TEST" not
i try it with the HelloServer
d-anders
@d-anders
Sep 13 2015 13:44
hm, maybe it is Serial1 on those boards?
onkelfunny
@onkelfunny
Sep 13 2015 13:45
the HelloServer is uploaded... no luck :(
also no luck with serial1
d-anders
@d-anders
Sep 13 2015 13:48
ok
but does it respond to webrequests?
http
Ivan Grokhotkov
@igrr
Sep 13 2015 13:49
@onkelfunny the output you have posted looks strange, it doesn't look like the output from recent Arduino core builds
there are multiple load messages from the bootloader
perhaps the sketch was not really uploaded?
d-anders
@d-anders
Sep 13 2015 13:50
maybe your upload fails and you are still running some code that was put on the board before you got it?
onkelfunny
@onkelfunny
Sep 13 2015 13:51
i changed the delay time in the code. the led flashing slower... the code is correct
here is the output from the upload:
ck@atelier-klippel.de>
setting board to ck
setting baudrate from 115200 to 115200
setting port from /dev/tty.usbserial to /dev/cu.usbserial-A50285BI
setting address from 0x00000000 to 0x00000000
espcomm_upload_file
stat /var/folders/_n/sy8p0xjs0dlffvp139xmn9qm0000gn/T/build7675939979485799330.tmp/Blink.cpp_00000.bin success
opening port /dev/cu.usbserial-A50285BI at 115200
tcgetattr
tcsetattr
serial open
opening bootloader
resetting board
trying to connect
setting character timeout 0
done
setting character timeout 1
done
espcomm_send_command: sending command header
espcomm_send_command: sending command payload
trying to connect
setting character timeout 0
done
setting character timeout 1
done
espcomm_send_command: sending command header
espcomm_send_command: sending command payload
espcomm_send_command: receiving 2 bytes of data
espcomm_send_command: receiving 2 bytes of data
espcomm_send_command: receiving 2 bytes of data
espcomm_send_command: receiving 2 bytes of data
espcomm_send_command: receiving 2 bytes of data
espcomm_send_command: receiving 2 bytes of data
espcomm_send_command: receiving 2 bytes of data
espcomm_send_command: receiving 2 bytes of data
espcomm_open
Uploading 31760 bytes from /var/folders/_n/sy8p0xjs0dlffvp139xmn9qm0000gn/T/build7675939979485799330.tmp/Blink.cpp_00000.bin to flash at 0x00000000
erasing flash
size: 007c10 address: 000000
first_sector_index: 0
total_sector_count: 8
head_sector_count: 8
adjusted_sector_count: 4
adjusted_size: 004000
espcomm_send_command: sending command header
espcomm_send_command: sending command payload
setting timeout 10000
setting character timeout 100
done
setting timeout 1
setting character timeout 1
done
espcomm_send_command: receiving 2 bytes of data
writing flash
................................
setting address from 0x00000000 to 0x00010000
espcomm_upload_file
stat /var/folders/_n/sy8p0xjs0dlffvp139xmn9qm0000gn/T/build7675939979485799330.tmp/Blink.cpp_10000.bin success
espcomm_open
Uploading 171416 bytes from /var/folders/_n/sy8p0xjs0dlffvp139xmn9qm0000gn/T/build7675939979485799330.tmp/Blink.cpp_10000.bin to flash at 0x00010000
erasing flash
size: 029d98 address: 010000
first_sector_index: 16
total_sector_count: 42
head_sector_count: 16
adjusted_sector_count: 26
adjusted_size: 01a000
espcomm_send_command: sending command header
espcomm_send_command: sending command payload
setting timeout 10000
setting character timeout 100
done
setting timeout 1
setting character timeout 1
done
espcomm_send_command: receiving 2 bytes of data
writing flash
........................................................................................................................................................................
starting app without reboot
espcomm_send_command: sending command header
espcomm_send_command: sending command payload
espcomm_send_command: receiving 2 bytes of data
closing bootloader
Board at /dev/cu.usbserial-A50285BI is not available
Ivan Grokhotkov
@igrr
Sep 13 2015 13:53
separate Blink.cpp_00000.bin and Blink.cpp_10000.bin? is this the stable version from May?
onkelfunny
@onkelfunny
Sep 13 2015 13:53
the stage version
Ivan Grokhotkov
@igrr
Sep 13 2015 13:53
we have moved to single file uploads in July stable release
staging versions have single file uploads for quite some time now... since June i think
onkelfunny
@onkelfunny
Sep 13 2015 13:54
i have installed everything with the board manager
1.6.4-620-gd6b5beb
Ivan Grokhotkov
@igrr
Sep 13 2015 13:56
if you open this link you'll see the version is 1.6.5-1106-g8253b82
so perhaps you did install everything some time ago
onkelfunny
@onkelfunny
Sep 13 2015 13:56
hmm
how i can update the version?
Ivan Grokhotkov
@igrr
Sep 13 2015 13:56
uninstall and then install again
onkelfunny
@onkelfunny
Sep 13 2015 13:57
i did it.. but it will not work.
maybe i have to remove all files in the ~/Library/Arduino directory
Ivan Grokhotkov
@igrr
Sep 13 2015 13:58
~/Library/Arduino15 to be exact
onkelfunny
@onkelfunny
Sep 13 2015 13:58
i try it
Ivan Grokhotkov
@igrr
Sep 13 2015 13:58
@Links2004 regarding doxygen docs, well, they are good for core/library developers with all the call graphs and stuff, but for the end users I would aim at something more readable like the docs at arduino.cc website.
d-anders
@d-anders
Sep 13 2015 13:58
@igrr How do i send gzipped content for the user-agent to upack (html etc). I took a shot and tried
server.sendHeader("Content-Encoding","gzip"); before server.streamFile but no luck
(the actual file on spiffs is gzipped before i put it there)
onkelfunny
@onkelfunny
Sep 13 2015 14:03
now i can't find the repo in the board manager (i added the url in the preferences)
and i receive a message "error downloading .... http://downloads.arduino.cc/packages/package_index.json"
Ivan Grokhotkov
@igrr
Sep 13 2015 14:05
@d-anders i suppose there is an issue with Content-Type not being correct
let me see
@onkelfunny downloads.arduino.cc? that's not us... also the file opens fine here
onkelfunny
@onkelfunny
Sep 13 2015 14:06
ohhh man... my firewall :D
Ivan Grokhotkov
@igrr
Sep 13 2015 14:08
@d-anders right, currently ESP8266WebServer is not smart enough to send the correct content-type for gzipped files
also if you are using server.streamFile it will send content-encoding header for gzipped files automatically
provided that the file name ends with .gz
d-anders
@d-anders
Sep 13 2015 14:10
hm, maybe i got this wrong
d-anders
@d-anders
Sep 13 2015 14:10
first i tried doing that
then i thought the second parameter to streamfile should be text/html
but the content-encoding should be gzip
Ivan Grokhotkov
@igrr
Sep 13 2015 14:11
it should be whatever this file really is (html, png, ...)
d-anders
@d-anders
Sep 13 2015 14:11
yeah
Ivan Grokhotkov
@igrr
Sep 13 2015 14:12
does the file name end with .gz?
d-anders
@d-anders
Sep 13 2015 14:13
i do it like this: filename on flash is index.html.gz. When the client asks for index.html i streamfile index.html.gz
second parameter beeing text/html
Ivan Grokhotkov
@igrr
Sep 13 2015 14:13
yes, this looks right... i'll take a look at why this doesn't work a bit later tonight
onkelfunny
@onkelfunny
Sep 13 2015 14:14
ok. with the nodemcu modules everything works (0.9 and 1.0) but the serial not working with the esp-07
d-anders
@d-anders
Sep 13 2015 14:14
i think the server needs to send Content-Encoding gzip
so i tried doing that
2nd parameter for streamFile is the mime-type, right?
Ivan Grokhotkov
@igrr
Sep 13 2015 14:18
if you take a look at the source of streamFile function, it should set content-encoding header automatically https://github.com/esp8266/Arduino/blob/esp8266/hardware/esp8266com/esp8266/libraries/ESP8266WebServer/src/ESP8266WebServer.h#L99-L108
d-anders
@d-anders
Sep 13 2015 14:21
oh, right. probably i messed something up then. will have a look. i think my browser tried to read the gzip as if it was text
onkelfunny
@onkelfunny
Sep 13 2015 14:42
ok.. some esp-07 modules have hardware problems
onkelfunny
@onkelfunny
Sep 13 2015 15:19
@igrr how i can make a OTA update?
first one shows how to upload sketches from a web page, second one may be used with espota.py script
onkelfunny
@onkelfunny
Sep 13 2015 15:24
ok. in the arduino ide i can choose "Upload Using: OTA" is this function ready?
Ivan Grokhotkov
@igrr
Sep 13 2015 15:29
it works in 1.6.4 and 1.6.5
you do need to flash DNS_SD_Arduino_OTA.ino via serial first
onkelfunny
@onkelfunny
Sep 13 2015 15:30
ok thx
Steve Nelson
@zenmanenergy
Sep 13 2015 15:46
@zenmanenergy
Is there anything special i need to do to get a nodemcu 0.9 to work with the latest version of the arduino ide on a mac? it gives me this error: warning: espcomm_send_command: wrong direction/command: 0x01 0x08, expected 0x01 0x02
i am able to upload a binary to the device via windows using the flasher tool. I made a hello world script via arduino, then copied that file over to windows and flashed it. then cam back to arduino ide opened the serial monitor… and it worked. So the device itself works. just something isn’t allowing me to upload from the mac arduino side.
Ivan Grokhotkov
@igrr
Sep 13 2015 15:50
@zenmanenergy could you please enable verbose upload output in Arduino preferences, and check which board is set? it's the first line of esptool output, looks like setting board to nodemcu
Steve Nelson
@zenmanenergy
Sep 13 2015 15:51
will do.
Holger Lembke
@holgerlembke
Sep 13 2015 15:56
SPIFFS is missing an .exists(String filename)
Steve Nelson
@zenmanenergy
Sep 13 2015 15:58
2014 Ch. Klippel ck@atelier-klippel.de
setting board to ck
setting baudrate from 115200 to 115200
setting port from /dev/tty.usbserial to /dev/cu.wch ch341 USB=>RS232 1410
setting address from 0x00000000 to 0x00000000
espcomm_upload_file
stat /var/folders/rb/svhs1qg52vzfnvl9tkp7_0jh0000gn/T/build3648307092057407294.tmp/helloworld_serial.cpp.bin success
opening port /dev/cu.wch ch341 USB=>RS232 1410 at 115200
tcgetattr
tcsetattr
serial open
opening bootloader
resetting board
trying to connect
setting character timeout 0
done
setting character timeout 1
done
espcomm_send_command: sending command header
espcomm_send_command: sending command payload
trying to connect
setting character timeout 0
done
setting character timeout 1
done
espcomm_send_command: sending command header
espcomm_send_command: sending command payload
trying to connect
setting character timeout 0
done
setting character timeout 1
done
espcomm_send_command: sending command header
espcomm_send_command: sending command payload
espcomm_send_command: receiving 2 bytes of data
espcomm_send_command: receiving 2 bytes of data
espcomm_send_command: receiving 2 bytes of data
espcomm_send_command: receiving 2 bytes of data
espcomm_send_command: receiving 2 bytes of data
espcomm_send_command: receiving 2 bytes of data
espcomm_send_command: receiving 2 bytes of data
espcomm_send_command: receiving 2 bytes of data
espcomm_open
Uploading 211472 bytes from /var/folders/rb/svhs1qg52vzfnvl9tkp7_0jh0000gn/T/build3648307092057407294.tmp/helloworld_serial.cpp.bin to flash at 0x00000000
erasing flash
size: 033a10 address: 000000
first_sector_index: 0
total_sector_count: 52
head_sector_count: 16
adjusted_sector_count: 36
adjusted_size: 024000
espcomm_send_command: sending command header
espcomm_send_command: sending command payload
setting timeout 10000
setting character timeout 100
done
setting timeout 1
setting character timeout 1
done
espcomm_send_command: receiving 2 bytes of data
warning: espcomm_send_command: wrong direction/command: 0x01 0x08, expected 0x01 0x02
warning: espcomm_send_command(FLASH_DOWNLOAD_BEGIN) failed
closing bootloader
Ivan Grokhotkov
@igrr
Sep 13 2015 15:58
setting board to ck
this will not work with nodemcu board
Steve Nelson
@zenmanenergy
Sep 13 2015 15:58
how do i change that?
Ivan Grokhotkov
@igrr
Sep 13 2015 15:59
Screen Shot 2015-09-13 at 18.59.17.png
what do you have selected in the IDE
Steve Nelson
@zenmanenergy
Sep 13 2015 15:59
i have 0.9 selected
the one above
Ivan Grokhotkov
@igrr
Sep 13 2015 16:01
is that with stable or staging version? i think there was an issue with stable version, reset method for nodemcu 0.9 was incorrect
Steve Nelson
@zenmanenergy
Sep 13 2015 16:01
its the stable one.
Ivan Grokhotkov
@igrr
Sep 13 2015 16:01
if you use stable then you can fix that locally by editing boards.txt
Steve Nelson
@zenmanenergy
Sep 13 2015 16:02
is that in arduino15?
Ivan Grokhotkov
@igrr
Sep 13 2015 16:03
~/Library/Arduino15/packages/esp8266/hardware/esp8266/1.6.5-something/boards.txt
change nodemcu.upload.resetmethod=ck to nodemcu.upload.resetmethod=nodemcu
Steve Nelson
@zenmanenergy
Sep 13 2015 16:04
sweet. i’m trying...
hmmm, now it says
(c) 2014 Ch. Klippel ck@atelier-klippel.de
setting board to nodemcu
error: unknown board: nodemcu
known boards are: none ck wifio
setting baudrate from 115200 to 115200
setting port from /dev/tty.usbserial to /dev/cu.wch ch341 USB=>RS232 1410
setting address from 0x00000000 to 0x00000000
espcomm_upload_file
Ivan Grokhotkov
@igrr
Sep 13 2015 16:06
hmm
Steve Nelson
@zenmanenergy
Sep 13 2015 16:06
should i try the staging version? was this worked on in the last update?
Ivan Grokhotkov
@igrr
Sep 13 2015 16:07
ok, then change it back to ck.
Steve Nelson
@zenmanenergy
Sep 13 2015 16:07
could it be a caps lock this?
thing
Ivan Grokhotkov
@igrr
Sep 13 2015 16:07
there was a change related to reset methods when esptool was upgraded to 0.4.6 i think
but apparently the stable version predates that since there is no 'nodemcu' method listed
Steve Nelson
@zenmanenergy
Sep 13 2015 16:08
with the nodemcu i still ground gpio0, right?
Ivan Grokhotkov
@igrr
Sep 13 2015 16:08
no it should be done automatically
that's odd.
Steve Nelson
@zenmanenergy
Sep 13 2015 16:09
i went back to ck and disconnected the ground. does anything look different? lippel ck@atelier-klippel.de
setting board to ck
setting baudrate from 115200 to 115200
setting port from /dev/tty.usbserial to /dev/cu.wch ch341 USB=>RS232 1410
setting address from 0x00000000 to 0x00000000
espcomm_upload_file
stat /var/folders/rb/svhs1qg52vzfnvl9tkp7_0jh0000gn/T/build6693354862617166741.tmp/helloworld_serial.cpp.bin success
opening port /dev/cu.wch ch341 USB=>RS232 1410 at 115200
tcgetattr
tcsetattr
serial open
opening bootloader
resetting board
trying to connect
setting character timeout 0
done
setting character timeout 1
done
espcomm_send_command: sending command header
espcomm_send_command: sending command payload
trying to connect
setting character timeout 0
done
setting character timeout 1
done
espcomm_send_command: sending command header
espcomm_send_command: sending command payload
trying to connect
setting character timeout 0
done
setting character timeout 1
done
espcomm_send_command: sending command header
espcomm_send_command: sending command payload
espcomm_send_command: receiving 2 bytes of data
espcomm_send_command: receiving 2 bytes of data
espcomm_send_command: receiving 2 bytes of data
espcomm_send_command: receiving 2 bytes of data
espcomm_send_command: receiving 2 bytes of data
espcomm_send_command: receiving 2 bytes of data
espcomm_send_command: receiving 2 bytes of data
espcomm_send_command: receiving 2 bytes of data
espcomm_open
Uploading 211472 bytes from /var/folders/rb/svhs1qg52vzfnvl9tkp7_0jh0000gn/T/build6693354862617166741.tmp/helloworld_serial.cpp.bin to flash at 0x00000000
erasing flash
size: 033a10 address: 000000
first_sector_index: 0
total_sector_count: 52
head_sector_count: 16
adjusted_sector_count: 36
adjusted_size: 024000
espcomm_send_command: sending command header
espcomm_send_command: sending command payload
setting timeout 10000
setting character timeout 100
done
setting timeout 1
setting character timeout 1
done
espcomm_send_command: receiving 2 bytes of data
warning: espcomm_send_command: wrong direction/command: 0x01 0x07, expected 0x01 0x02
warning: espcomm_send_command(FLASH_DOWNLOAD_BEGIN) failed
closing bootloader
when i upload, the light flashes a couple times, then stops. seems like it’strying to do a handshake, but not finishing.
I installed the staging version and it gets past the missing nodemcu error.
but, it still has the same ending error… wrong direction.
Ivan Grokhotkov
@igrr
Sep 13 2015 16:14
do you have anything connected to nodemcu pins?
Steve Nelson
@zenmanenergy
Sep 13 2015 16:14
no.
it’s just a Serial.println("hello world”) script too. so nothing fancy
this is one of the older yellow boards the 5/12/2014 version 0.9
Ivan Grokhotkov
@igrr
Sep 13 2015 16:16
this shouldn't depend on the script, but still it's odd. i'm uploading to nodemcu on a daily basis, and it uploads fine most of the time.
and i'm on a mac as well
Steve Nelson
@zenmanenergy
Sep 13 2015 16:17
before i discovered your arduino ide, i was using this board with lua. with the windows flasher tool i can upload to it. i can even compile with the arduino ide, copy the bin file over to my PC virtual machine on my mac and upload it with the flasher. and that works.
i can even disconnect and reconnect it to the mac and see the “hello world” in the serial monitor in the mac arduino ide.
d-anders
@d-anders
Sep 13 2015 16:22
umm @igrr : I think the gzip content-encoding is working now
problem is that i have no idea what i did before
i thought i did exactly the same :)
Ivan Grokhotkov
@igrr
Sep 13 2015 16:23
it happens...
d-anders
@d-anders
Sep 13 2015 16:23
maybe i had double content-encoding in the header and some problem with that, not sure
or maybe i was dreaming
but i tried to "fix it" in various dumb way for quite some time. now im back where i thought i started
Thorsten von Eicken
@tve
Sep 13 2015 17:14
@zenmanenergy to troubleshoot the flashing, one trick is to wire gpio0 to ground and run the flashing. You can even manually touch the reset to ground and then start the flashing. If it succeeds, disconnect gpio0 from ground and reset again to get your sketch running. At least this tells you that the problem has to do with the gpio0&reset diddling...
Steve Nelson
@zenmanenergy
Sep 13 2015 17:52
i’ve tried doing that. it turns on a light when i do it, but i get the same error.
onkelfunny
@onkelfunny
Sep 13 2015 18:27
my esp-07-module stops if i connect with the console. is this issue known?
Markus
@Links2004
Sep 13 2015 19:09
when you mean the Serial console in the arduino IDE then yes
the IDE always puts RTS and DTR low so it can not work.
if you use a terminal where you can control RTS and DTR is its working fine.
onkelfunny
@onkelfunny
Sep 13 2015 19:13
ok thx. what can i do to avoid this?
Markus
@Links2004
Sep 13 2015 19:15
if you need to use the arduino IDE you cut use the reset schematic from nodeMCU,
or you use a terminal Program Hterm or RealTerm where you can control the RTS and DTR of the serial
this gives you also a nice reset button ;)
onkelfunny
@onkelfunny
Sep 13 2015 19:16
ok, thx