These are chat archives for esp8266/Arduino

18th
May 2015
Luke Cyca
@lukecyca
May 18 2015 02:22
@ficeto: I wasn't able to recreate the problem. I made a small example and kept adding things trying to get it to break. Eventually I ended up with my original sketch and it works fine! The only difference is that the original used the Arduino String object, whereas now I just use char * and os_sprintf and friends.
So perhaps some of the String methods are slow and that was causing wdt to reset the chip.
Markus
@Links2004
May 18 2015 14:44
@ficeto yes?
Markus
@Links2004
May 18 2015 14:50
has the xtensa-lx106-elf dir been moved?
Ivan Grokhotkov
@igrr
May 18 2015 14:50
yes the tools have moved into the platform directory
you may need to rebuild/restart the ide
Markus
@Links2004
May 18 2015 14:51
my IDE is eclipse no restarts ;) but i need to move the dir myself be course it is not a part of the git.
ficeto
@ficeto
May 18 2015 15:38
@Links2004 no worries, I got it taken care of :)
Michael Miller
@Makuna
May 18 2015 16:25
I just confirmed that literal strings are not merged by the tool chain when using F() or PSTR() macros.
Ivan Grokhotkov
@igrr
May 18 2015 16:36
@Makuna this might be related: http://stackoverflow.com/a/12394056
Michael Miller
@Makuna
May 18 2015 16:52
@igrr Do you know how much memory is being "set aside" for the ".irom.text" section?
we have different definitions for different flash memory sizes (512K/1M)
meronz
@meronz
May 18 2015 17:09
Hello guys, i'm back working on #166 and i can't seem to get it working. I also tried to generate response once in setup() and then send it.
If i comment out the part in loop() where i send requests, it handles incoming packets just fine. I'm not looking for an immediate solution, just clues on what i can work on! It could be my first serious pull request ;P
ficeto
@ficeto
May 18 2015 17:11
put delay(1) even though you might have not gotten the packet
you need to let the esp handle the network
that is done while you are delaying
Michael Miller
@Makuna
May 18 2015 17:13
@igrr after reading that link, it doesn't exactly match the scenario but does suggest as to the issue. a "static const char[]" is treated differently than a "static const char*", where the latter has the strings pooled and the former doesn't. For the [] the string is not copied as they suggest, but this is due to being a "static const". I have confirmed the address are to the original string in rom.
It seems the Atmel compiler for AVR does pool these strings.
Ivan Grokhotkov
@igrr
May 18 2015 17:13
@anesthetized which version are you using, some recent commit?
i think there was an issue related to Udp.endPacket killing the listening "socket", but it was solved about a week ago.
Ivan Grokhotkov
@igrr
May 18 2015 17:18
@anesthetized there has also been an API change since you wrote this sample
to send multicast, it is not enough just to send to the multicast IP
you need to use
beginPacketMulticast(IPAddress multicastAddress, 
                                   uint16_t port, 
                                   IPAddress interfaceAddress, 
                                   int ttl = 1);
meronz
@meronz
May 18 2015 17:19

@ficeto i delay 10ms after sending the packet and 1sec at the end of every loop()

@igrr I update at least once a day, i'm downloading the *-master.zip from github and copy the libraries directory. I wanted to git clone and recompile but due to slow connection that is not possible.

Ivan Grokhotkov
@igrr
May 18 2015 17:19
where the interfaceAddress will likely be WiFi.localIP()
also if you want to listen on a multicast address, you need to replace begin with beginMulticast
beginMulticast(IPAddress interfaceAddr, IPAddress multicast, uint16_t port);
where interfaceAddr is again what you get from WiFi.localIP()
meronz
@meronz
May 18 2015 17:22
I already have beingMulticast, and i'm going to try beingPacketMulticast now, even if this unlikely is the problem (my pc still sees the request)
Ivan Grokhotkov
@igrr
May 18 2015 17:23
can you post your updated sketch so I can test it locally?
meronz
@meronz
May 18 2015 17:30
'''
'''
#include <ESP8266WiFi.h>
#include <WiFiUdp.h>
#include <Ticker.h>

Ticker nameLookup;
char* packet = NULL;
unsigned short int packet_size;

WiFiUDP udp;

void setup() {
  Serial.begin(115200);
  WiFi.begin(ssid, password);

  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }

  generateDnsQuery();

  Serial.println("");
  Serial.println(WiFi.localIP());

  udp.beginMulticast(WiFi.localIP(), IPAddress(224, 0, 0, 251), 5353);

}

void loop() {

  // Send mDNS request
  udp.beginPacketMulticast(IPAddress(224, 0, 0, 251), 5353, WiFi.localIP(),255);
  udp.write(packet, packet_size);
  udp.endPacket();
  delay(1);

  Serial.println("Sent: ");

  int cb = udp.parsePacket();
  if(cb>0){
      Serial.print("got udp packet from ");
      Serial.println(udp.remoteIP());
  }

  delay(1000);

}

void generateDnsQuery(){
    char header[13] = { 0x00, 0x00, // ID
                        0x00, 0x00, // FLAGS
                        0x00, 0x01, // QDCOUNT
                        0x00, 0x00, // ANCOUNT
                        0x00, 0x00, // NSCOUNT
                        0x00, 0x00, // ARCOUNT
                        0x00 };     // hostname length

    char trailer[11] = { 0x05, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x00, //local + null terminator
                         0x00, 0x01,   // QDTYPE
                         0x00, 0x01};  // QCLASS

    unsigned short int hostname_len = strlen(hostname);
    packet_size = 24 + hostname_len;
    packet = new char[packet_size];


  // Forge the request packet
    header[12] = hostname_len;         // Set hostname length byte
    memcpy(packet, header, 13);
    memcpy(packet+13, hostname, hostname_len);
    memcpy(packet+13+hostname_len, trailer, 11);

}
that didn't end well
Markus
@Links2004
May 18 2015 17:31
use ```
meronz
@meronz
May 18 2015 17:35
i tried, nvm using ghostbin: https://ghostbin.com/paste/wkaf52ba
pw: esp8266
and, i just copied *-master.zip/hardware and libraries in my precompiled ide and xtensa-lx106-els-g++ is missing. I'm downloading again (precompiled tar.xz)
Ivan Grokhotkov
@igrr
May 18 2015 17:38
tool paths have changed, the tools now live under the hardware directory
meronz
@meronz
May 18 2015 17:39
i suspected it, that's why i'm downloading it again.
did you try it?
as you can see, i'm not using ticker anymore
meronz
@meronz
May 18 2015 17:49
this version doesn't seem to have beginPacketMulticast(), but i'm sticking with it since copying new libraries break other things (did the sdk change in meanwhile?).
Ivan Grokhotkov
@igrr
May 18 2015 18:08
@anesthetized this seems to work: http://hastebin.com/perituziye.avrasm
i get some reply packets:
192.168.222.166
Sent: 
Sent: 
got udp packet from 192.168.222.100
Sent: 
got udp packet from 192.168.222.100
Sent: 
got udp packet from 192.168.222.136
got udp packet from 192.168.222.100
got udp packet from 192.168.222.100
got udp packet from 192.168.222.100
meronz
@meronz
May 18 2015 18:13
what ide version are you using?
Ivan Grokhotkov
@igrr
May 18 2015 18:13
the latest trunk
meronz
@meronz
May 18 2015 18:14

im getting a lot of:
scandone
no ssid-name found, reconnect after 1s
Sent:
LmacRxBlk:1
reconnect

connection is stable, i have ap at 10 centimeters from esp

Markus
@Links2004
May 18 2015 18:15
no ssid-name found, reconnect after 1s is not stabel infact its lost connection to AP
meronz
@meronz
May 18 2015 18:16
sorry, meant to say: connection is stable for every other device in my house
this could be the power supply but i'm not sure, never had problems like this before
Ivan Grokhotkov
@igrr
May 18 2015 18:18
LmacRxBlk:1
means that unread packets have filled up the receive queue
Markus
@Links2004
May 18 2015 18:18
add while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); } at the top of loop
meronz
@meronz
May 18 2015 18:19
@Links2004 I have it
@igrr i think i should clone the repo and build the ide myself.
Ivan Grokhotkov
@igrr
May 18 2015 18:26
don't pull now, i've broken the platform file...
will fix in a minute
meronz
@meronz
May 18 2015 18:27
ah, so your good broking things too, huh? :D
just joking, your work here is amazing!
Ivan Grokhotkov
@igrr
May 18 2015 19:41
anybody running Windows?
Markus
@Links2004
May 18 2015 19:42
yes
Ivan Grokhotkov
@igrr
May 18 2015 19:42
need to test the board manager package :)
can you please download the 1.6.4 IDE from the arduino.cc website?
Markus
@Links2004
May 18 2015 19:42
k need some time :)
Ivan Grokhotkov
@igrr
May 18 2015 19:42
and add the following URL in the preferences menu:
Linux x64 anyone?
ficeto
@ficeto
May 18 2015 19:44
you havo no parallels
let me fire one up
Markus
@Links2004
May 18 2015 19:52
not running on windows
Arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\1.20.0-26-gb404fb9\bin\xtensa-lx106-elf-g++" (in directory "."): CreateProcess error=2, Das System kann die angegebene Datei nicht finden file not found
Ivan Grokhotkov
@igrr
May 18 2015 19:52
can you check if the path is correct?
Markus
@Links2004
May 18 2015 19:53
yes it is all is there only the "xtensa-lx106-elf-g++" is missing
Ivan Grokhotkov
@igrr
May 18 2015 19:53
xtensa-lx106-elf-g++.exe?
Markus
@Links2004
May 18 2015 19:53
blob
no xtensa-lx106-elf-g++.exe
Ivan Grokhotkov
@igrr
May 18 2015 19:54
okay, got it. wrong toolchain i guess.
ficeto
@ficeto
May 18 2015 19:56
all good on linux
Markus
@Links2004
May 18 2015 20:04
manualy copy the compiler in then its working fine
Ivan Grokhotkov
@igrr
May 18 2015 20:04
that's really weird
[igrokhotkov@igrokhot-mbp /tmp]$ tar -tzf win32-xtensa-lx106-elf.tar.gz | grep g++
xtensa-lx106-elf/xtensa-lx106-elf/bin/g++.exe
downloaded the archive manually and the file is there...
Markus
@Links2004
May 18 2015 20:05
i have 64bit make this a difference?
Ivan Grokhotkov
@igrr
May 18 2015 20:05
wait a sec...
yes, the one in bin is also there
[igrokhotkov@igrokhot-mbp /tmp]$ tar -tzf win32-xtensa-lx106-elf.tar.gz | grep g++
xtensa-lx106-elf/xtensa-lx106-elf/bin/g++.exe
xtensa-lx106-elf/share/man/man1/xtensa-lx106-elf-g++.1
xtensa-lx106-elf/bin/xtensa-lx106-elf-g++.exe
Ivan Grokhotkov
@igrr
May 18 2015 20:06
even if you are on x64, the file should at least show up
yep
Markus
@Links2004
May 18 2015 20:06
k will also check
CRC32: 8EBA6B0F
MD5: 14E6A285A8061B5B96D71B86EA295857
SHA-1: 7EC8F2FFDF65DC51262FCCFA7A68D9AE885C06C2
looking good
may the unpack tool from Arduino IDE has an problem
Ivan Grokhotkov
@igrr
May 18 2015 20:09
perhaps. but why did it drop just this one file?)
Markus
@Links2004
May 18 2015 20:09
it seems that some files are symlinks
blob
the 0byte files
and all of them are missing
blob
there the link is to see
Ivan Grokhotkov
@igrr
May 18 2015 20:17
can you try uninstalling and installing again?
i have updated the toolchain
Markus
@Links2004
May 18 2015 20:18
yes
Ivan Grokhotkov
@igrr
May 18 2015 20:18
now it's 150Mb instead of 122 :)
Markus
@Links2004
May 18 2015 20:18
yes windows has no good filesystem ;)
you need to name the file different or the arduino ide do not download again
Markus
@Links2004
May 18 2015 20:29
ok manually deleted the download temp files from arduino ide to force an redownload now its working fine
but i hate arduino for placing it in user dir in AppData, not my favored storage for that.
Juppit
@Juppit
May 18 2015 20:57
@igrr File windows/dist/win32-xtensa-lx106-elf.tgz failed checksum again in latest commit
Ivan Grokhotkov
@igrr
May 18 2015 20:58
what's the SHA1 sum on your side?
$ sha1sum -b win32-xtensa-lx106-elf.tgz
07b7d398cc0ca9e863073a6558668fa0a510b8cd *win32-xtensa-lx106-elf.tgz
ahh damn
changed the archive names, forgot to rename hashes
Juppit
@Juppit
May 18 2015 21:03
I will replace with 7ec8f2ffdf65dc51262fccfa7a68d9ae885c06c2
Juppit
@Juppit
May 18 2015 21:11
@igrr next: Source resource does not exist: C:\Program Files\Java\jdk1.8.0_45\jre\release
I just had a fresh install to verify, release is in C:\Program Files\Java\jdk1.8.0_45\ I just copy it, now build is ok.
Juppit
@Juppit
May 18 2015 21:31

@igrr now I can build in Arduino-IDE: >Arduino: 1.6.4 (Windows 8.1), Platine: "Generic ESP8266 Module, 80 MHz, 115200, 512K (64K SPIFFS)"

In file included from D:\Users\Peter\Documents\Arduino\hardware\esp8266com\esp8266\libraries\ESP8266WiFi\src\WiFiClient.h:24:0,
from D:\Users\Peter\Documents\Arduino\hardware\esp8266com\esp8266\libraries\ESP8266WiFi\src\ESP8266WiFi.h:32,
from D:\Users\Peter\Documents\Arduino\hardware\esp8266com\esp8266\libraries\ESP8266WiFi\src\ESP8266WiFiMulti.h:30,
from D:\Users\Peter\Documents\Arduino\hardware\esp8266com\esp8266\libraries\ESP8266WiFi\src\ESP8266WiFiMulti.cpp:26:
d:\users\peter\documents\arduino\hardware\esp8266com\esp8266\tools\xtensa-lx106-elf\xtensa-lx106-elf\include\c++\4.8.2\bits\stl_vector.h: In member function 'std::vector<_Tp, _Alloc>::size_type std::vector<_Tp, _Alloc>::_M_check_len(std::vector<_Tp, _Alloc>::size_type, const char*) const':
D:\Users\Peter\Documents\Arduino\hardware\esp8266com\esp8266\cores\esp8266/Arduino.h:217:18: error: expected unqualified-id before '(' token

define max(a,b) ((a)>(b)?(a):(b))

              ^

d:\users\peter\documents\arduino\hardware\esp8266com\esp8266\tools\xtensa-lx106-elf\xtensa-lx106-elf\include\c++\4.8.2\bits\stl_bvector.h: In member function 'std::vector<bool, _Alloc>::size_type std::vector<bool, _Alloc>::_M_check_len(std::vector<bool, _Alloc>::size_type, const char*) const':
D:\Users\Peter\Documents\Arduino\hardware\esp8266com\esp8266\cores\esp8266/Arduino.h:217:18: error: expected unqualified-id before '(' token

define max(a,b) ((a)>(b)?(a):(b))

              ^

Fehler beim Kompilieren.