These are chat archives for esp8266/Arduino

15th
Aug 2016
Ivan Grokhotkov
@igrr
Aug 15 2016 03:45
@martinayotte compiler is behaving fine there, it finds an overload which can take const char*
there are two overloads, on taking const String & and one taking char*. First one matches, second one doesn't.
It's a) sloppy coding style in library API — taking char* as an argument where const char* is required. this issue is seen in other arduino libraries as well. it seems that library authors try to make strings "less confusing" and use char * instead of const char*.
and b) a bug in implementation of overload which takes const String &filepath. it should do an explicit const_cast<char*>()to match the function being called
Ivan Grokhotkov
@igrr
Aug 15 2016 03:51
@martinayotte @skorokithakis latest git version does link against newlib, there is no longer any libc_replacement.
the issue you have with platformio is likely due to changes to compiler flags not being reflected in platformio
we had a bunch of changes in platform.txt (additional compiler and linker flags) and these changes have to be somehow ported into platformio
if you use Arduino IDE (or espMakeArduino), you shouldn't have issues with sscanf in latest git version
Stavros Korokithakis
@skorokithakis
Aug 15 2016 04:52
Hmm, I'll try that, thanks
@ivankravets have you tested latest staging?
Stavros Korokithakis
@skorokithakis
Aug 15 2016 10:56
@igrr are these changes in master as well, or just the libc branch? i'm wondering whether just sticking the boards manager link in will work
Stavros Korokithakis
@skorokithakis
Aug 15 2016 11:11
@igrr you're right, the feature/libc branch compiled in the arduino ide
Luc
@luc-github
Aug 15 2016 11:14
@martinayotte May I know why you use SD instead of SdFat ? (SdFat support long name and allow to calculate free space), the footprint of SdFat is little bit bigger but has more feature- or it is just more convient to not add an external library - just want to know your experience on it - thanks
Stavros Korokithakis
@skorokithakis
Aug 15 2016 11:19
@igrr am i doing something wrong, or is it a sscanf bug? parsing the top string results into the bottom params, but buffershouldn't parse past the quote mark:
Serial.println(sscanf("+CLCC: 1,1,4,0,0,\"+420XXXXXXXXX\",145\r", "+CLCC: %d,%d,%d,%d,%d,\"%s\",%d\r", &a, &b, &c, &d, &e, buffer, &f));

1
1
4
0
0
+420XXXXXXXXX",145
-17829890
changing %s to %[^\"] works
but that's the same behaviour as what should be there
Martin Ayotte
@martinayotte
Aug 15 2016 12:23
@luc-github , I'm usually always using SdFat instead of SD, but in the current case, I was debugging issues faced by some people in the forum.
Luc
@luc-github
Aug 15 2016 12:40
@martinayotte thanks
Luc
@luc-github
Aug 15 2016 13:20
@martinayotte may I know which version of SdFat you are using ? I use original one (greiman/SdFat) and have some issue with big files, according Bill it may be an issue in ESP code
Vyvojar123
@Vyvojar123
Aug 15 2016 13:43
hello does anobody need to program an Arduino?
Martin Ayotte
@martinayotte
Aug 15 2016 13:49
@luc-github , I have the original from Greiman. I'm not aware of this issue. What is it exactly ?
Luc
@luc-github
Aug 15 2016 13:51
this one greiman/SdFat#39
Martin Ayotte
@martinayotte
Aug 15 2016 13:53
In this issue, you've placed a undecoded stacktrace. Did you ran it into ExceptionDecoder tool ?
Luc
@luc-github
Aug 15 2016 14:00
Yes but bring me nowhere and replacing ::yield() by delay(0); in library solved the issue
I am reverting now to generate decoded stacktrace
Martin Ayotte
@martinayotte
Aug 15 2016 14:02
Yes, I've just finished reading all the discussion. But about the real issue of yield() vs delay(0) should be known by @igrr and @me-no-dev
Luc
@luc-github
Aug 15 2016 14:04
@martinayotte
blob
Martin Ayotte
@martinayotte
Aug 15 2016 14:08
So, if I understand, the whole issue is the panic() in the __yield(). Let's see what the gurus will say ...
Luc
@luc-github
Aug 15 2016 14:09
I just feel strange to be the only one having issue :worried:
Martin Ayotte
@martinayotte
Aug 15 2016 14:10
Personally, I've never used so huge files
Luc
@luc-github
Aug 15 2016 14:12
well issue happen with 173.70 KB and bigger with small files no problem
and no issue with embedded SD library
Martin Ayotte
@martinayotte
Aug 15 2016 14:17
Ah ! I though you mentioned 5MB files ... I didn't faced the issue with 200KB, maybe I was lucky ...
Luc
@luc-github
Aug 15 2016 14:35
yes changing yield by delay allow me to stream until 10Mb, did not tested more
This message was deleted
This message was deleted
Me No Dev
@me-no-dev
Aug 15 2016 15:04
panic is called when the current context is not found to be switchable
history shows that to give false negatives, so maybe that is the issue you are experiencing
here is how the functions translate:
void yield(){
  if (cont_can_yield(&g_cont)) {
        esp_schedule();
        esp_yield();
    } else {
        panic();//you end up here
    }
}

//no check for cont_can_yield
void delay(0){
  esp_schedule();
  esp_yield();
}
Martin Ayotte
@martinayotte
Aug 15 2016 15:09
Yes, we've look at that. But why cont_can_yield() is returning false in the SdFat context ?
Me No Dev
@me-no-dev
Aug 15 2016 15:10
SdFat should be running in the normal g_cont
why it gives false negative, I can not tell
Martin Ayotte
@martinayotte
Aug 15 2016 15:14
Did you got chance to look at greiman/SdFat#39 ?
Me No Dev
@me-no-dev
Aug 15 2016 15:26
just did
maybe @luc-github is calling some method from sys callback? like ticker or async or pin interrupt
Martin Ayotte
@martinayotte
Aug 15 2016 15:28
So, for some reason cont_can_yield() is returning false, so the workaround is not using this check.
@luc-github , can you show us your code ?
Me No Dev
@me-no-dev
Aug 15 2016 15:29
@martinayotte will panic for sure if called from system callback
Martin Ayotte
@martinayotte
Aug 15 2016 15:30
Ok ! we need to know what Luc is doing. If his code is Ok, than we need to dig further, otherwise it is a non-issue.
Me No Dev
@me-no-dev
Aug 15 2016 15:30
yes
but...
Luc
@luc-github
Aug 15 2016 15:31
File datafile = SD.open((char *)path.c_str());
if (!datafile){
LOG("Cannot open file!\n");
web_interface->WebServer.sendContent_P(NOT_AUTH_NF);
page_not_found = true;
}
if (web_interface->WebServer.streamFile(datafile, contentType) != datafile.size()) {
LOG("Sent less data than expected!\n");
}
else LOG("Stream done\n");
datafile.close();
it is in handle_not_found() function
I can share more but poject is big
Me No Dev
@me-no-dev
Aug 15 2016 15:32
then by all means it should work. the regular web server runs on the loop context
Luc
@luc-github
Aug 15 2016 15:33
as you see I use streamFile
Me No Dev
@me-no-dev
Aug 15 2016 15:33
and in the logs I saw in the issue report, context is recognized wrongly as sys
Luc
@luc-github
Aug 15 2016 15:34
WebServer.onNotFound( handle_not_found);
I only use generic function
anything I can do to help to find the issue ?
Me No Dev
@me-no-dev
Aug 15 2016 15:35
maybe ETS_INTR_WITHINISR is returning false
Luc
@luc-github
Aug 15 2016 15:35
or using delay is the ultimate solution ?
Me No Dev
@me-no-dev
Aug 15 2016 15:36
can you try editing cont_can_yield in cont_util.c and remove ETS_INTR_WITHINISR check
then try with yield again
Luc
@luc-github
Aug 15 2016 15:39
Ok let me check
just put return cont->pc_ret != 0 && cont->pc_yield == 0;
Me No Dev
@me-no-dev
Aug 15 2016 15:41
yes
Luc
@luc-github
Aug 15 2016 15:42
Ok compiling now
same

Panic C:\Users\user\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266\core_esp8266_main.cpp:98 __yield

ctx: sys
sp: 3ffffbc0 end: 3fffffb0 offset: 01b0

Me No Dev
@me-no-dev
Aug 15 2016 15:45
interesting….
Luc
@luc-github
Aug 15 2016 15:45
need decoded stack ?
Me No Dev
@me-no-dev
Aug 15 2016 15:46
sure
Luc
@luc-github
Aug 15 2016 15:46
Decoding 32 results
0x40218453: SdSpi::receive() at I:\Documents\Arduino\libraries\SdFat\src\SdSpiCard/SdSpiESP8266.cpp line 66
0x4021b675: __yield at C:\Users\user\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/core_esp8266_main.cpp line 56
0x40217cc1: SdSpiCard::chipSelectLow() at I:\Documents\Arduino\libraries\SdFat\src\SdSpiCard/SdSpiCard.cpp line 338
0x40217df5: SdSpiCard::cardCommand(unsigned char, unsigned int) at I:\Documents\Arduino\libraries\SdFat\src\SdSpiCard/SdSpiCard.cpp line 338
0x4021848b: SdSpi::send(unsigned char) at I:\Documents\Arduino\libraries\SdFat\src\SdSpiCard/SdSpiESP8266.cpp line 87
0x40217ff5: SdSpiCard::readBlock(unsigned int, unsigned char*) at I:\Documents\Arduino\libraries\SdFat\src\SdSpiCard/SdSpiCard.cpp line 338
0x40252698: inet_chksum_pseudo at /Users/ficeto/Documents/Arduino/hardware/esp8266com/esp8266/tools/sdk/lwip/src/core/ipv4/inet_chksum.c line 275
0x4020802b: SdFatBase::readBlock(unsigned int, unsigned char*) at I:\Documents\Arduino\libraries\SdFat\src/SdFat.h line 252
0x402177e8: FatCache::read(unsigned int, unsigned char) at I:\Documents\Arduino\libraries\SdFat\src\FatLib/FatVolume.cpp line 184
0x40216654: FatVolume::cacheFetchData(unsigned int, unsigned char) at I:\Documents\Arduino\libraries\SdFat\src\FatLib/FatFile.cpp line 125
:  (inlined by) FatFile::read(void*, unsigned int) at I:\Documents\Arduino\libraries\SdFat\src\FatLib/FatFile.cpp line 760
0x40208adc: FatFile::read() at C:\Users\user\AppData\Local\Temp\build8eaa7f121af7ec719c5f1ef0816a6e14.tmp\sketch/webinterface.cpp line 3924
:  (inlined by) File::read() at I:\Documents\Arduino\libraries\SdFat\src/FatLib/ArduinoFiles.h line 198
0x4010068c: free at C:\Users\user\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266\umm_malloc/umm_malloc.c line 1733
0x4021a55f: Stream::timedRead() at C:\Users\user\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/Stream.cpp line 68
0x4021a5a3: Stream::readBytes(char*, unsigned int) at C:\Users\user\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/Stream.cpp line 68
0x40211fb3: BufferedStreamDataSource ::get_buffer(unsigned int) at C:\Users\user\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\ESP8266WiFi\src/WiFiClient.cpp line 149
0x40212163: ClientContext::_write_some() at C:\Users\user\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\ESP8266WiFi\src/WiFiServer.cpp line 91
0x40230000: ieee80211_sta_new_state at ?? line ?
0x40212290: ClientContext::_write_some_from_cb() at C:\Users\user\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\ESP8266WiFi\src/WiFiServer.cpp line 91
0x402122b0: ClientContext::_s_sent(void*, tcp_pcb*, unsigned short) at C:\Users\user\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\ESP8266WiFi\src/WiFiServer.cpp line 91
0x4023b615: tcp_input at /Users/ficeto/Documents/Arduino/hardware/esp8266com/esp8266/tools/sdk/lwip/src/core/tcp_in.c line 370 (discriminator 1)
0x401075f8: pvPortMalloc at C:\Users\user\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/heap.c line 34
0x40240000: ppInstallKey at ?? line ?
0x40239a39: ip_input at /Users/ficeto/Documents/Arduino/hardware/esp8266com/esp8266/tools/sdk/lwip/src/core/ipv4/ip.c line 559
0x40238e35: ethernet_input at /Users/ficeto/Documents/Arduino/hardware/esp8266com/esp8266/tools/sdk/lwip/src/netif/etharp.c line 1379
0x401040f6: lmacTxFrame at ?? line ?
0x40100a9d: ppEnqueueRxq at ?? line ?
0x4010082f: ppProcessTxQ at ?? line ?
0x4010086a: ppProcessTxQ at ?? line ?
0x40241d7b: ets_snprintf at ?? line ?
Me No Dev
@me-no-dev
Aug 15 2016 15:46
can you put it in quotes like code?
Martin Ayotte
@martinayotte
Aug 15 2016 15:46
@luc-github , maybe you can force a Panic directly in your code at the same place of SD.open() to make sure that the context is good there.
Luc
@luc-github
Aug 15 2016 15:48
Sorry how to force a panic ?
Martin Ayotte
@martinayotte
Aug 15 2016 15:48
Simply do panic(); just before your SD.open()
Luc
@luc-github
Aug 15 2016 15:48
:smile: ok
Martin Ayotte
@martinayotte
Aug 15 2016 15:49
It will confirm that the context is good.
Luc
@luc-github
Aug 15 2016 15:56
I got this Panic C:\Users\user\AppData\Local\Temp\build8eaa7f121af7ec719c5f1ef0816a6e14.tmp\sketch\webinterface.cpp:3576 handle_not_found
Decoding 17 results
0x4021a9c4: String::~String() at C:\Users\user\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/WString.cpp line 720
0x4020ffad: handle_not_found() at C:\Users\user\AppData\Local\Temp\build8eaa7f121af7ec719c5f1ef0816a6e14.tmp\sketch/webinterface.cpp line 3595
0x4010068c: free at C:\Users\user\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266\umm_malloc/umm_malloc.c line 1733
0x4021a9c4: String::~String() at C:\Users\user\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/WString.cpp line 720
0x40216285: ESP8266WebServer::_parseRequest(WiFiClient&) at C:\Users\user\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\ESP8266WebServer\src/Parsing.cpp line 256
0x4021c4ae: std::_Function_handler ::_M_invoke(std::_Any_data const&) at c:\users\user\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\1.20.0-26-gb404fb9-2\xtensa-lx106-elf\include\c++\4.8.2/functional line 2073
0x40214cc6: std::function ::operator()() const at C:\Users\user\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\ESP8266WebServer\src\detail/RequestHandlersImpl.h line 53
0x40214da8: ESP8266WebServer::_handleRequest() at C:\Users\user\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\ESP8266WebServer\src\detail/RequestHandlersImpl.h line 53
0x40212000: WiFiClient::~WiFiClient() at C:\Users\user\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\ESP8266WiFi\src/WiFiClient.cpp line 149
0x4021b504: esp_yield at C:\Users\user\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/core_esp8266_main.cpp line 56
0x40214f28: ESP8266WebServer::handleClient() at C:\Users\user\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\ESP8266WebServer\src\detail/RequestHandlersImpl.h line 53
0x40243306: wifi_get_opmode at ?? line ?
0x40210f64: ESP8266WiFiGenericClass::getMode() at C:\Users\user\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\ESP8266WiFi\src/ESP8266WiFiGeneric.cpp line 96
0x40219e41: HardwareSerial::available() at C:\Users\user\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/HardwareSerial.cpp line 177
0x402084c9: loop at I:\GitHub\gitlab\ESP3D\esp3d/esp3d.ino line 217
0x4021b550: loop_wrapper at C:\Users\user\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/core_esp8266_main.cpp line 56
0x40100718: cont_norm at C:\Users\user\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/cont.S line 109
Me No Dev
@me-no-dev
Aug 15 2016 15:59
did it have ctx: sys line?
Luc
@luc-github
Aug 15 2016 16:00

Panic C:\Users\user\AppData\Local\Temp\build8eaa7f121af7ec719c5f1ef0816a6e14.tmp\sketch\webinterface.cpp:3576 handle_not_found

ctx: cont
sp: 3fff1ba0 end: 3fff1f10 offset: 01b0

this ?
ctx:cont
Me No Dev
@me-no-dev
Aug 15 2016 16:01
yes, ctx:cont is good
Th3On3Freeman
@Th3On3Freeman
Aug 15 2016 16:03
Ok so I've been using SoftwareSerial for serial monitor output from the esp and most of the time it works fine (using pins 4 and 5 for rx and tx) but now it's suddenly just not outputting anything at all?
Me No Dev
@me-no-dev
Aug 15 2016 16:03
maybe @igrr will be able to help with why context ir wrongly identified as sys
Luc
@luc-github
Aug 15 2016 16:04
Do you need me to open issue in tracker ?
Me No Dev
@me-no-dev
Aug 15 2016 16:11
yes please
Luc
@luc-github
Aug 15 2016 16:13
ok will do - thank you
Luc
@luc-github
Aug 15 2016 16:26
@me-no-dev I created esp8266/Arduino#2399 - feel free to complete if I missed something - thank you for your help
Stavros Korokithakis
@skorokithakis
Aug 15 2016 17:09
@Th3On3Freeman which softwareserial lib are you using?
Stavros Korokithakis
@skorokithakis
Aug 15 2016 20:54
@igrr do you know when the libc feature will be released formally?
Stavros Korokithakis
@skorokithakis
Aug 15 2016 22:11
does anyone know where softwareserial.readString() is defined? i need the docs for it
as far as i can tell, that's non-blocking, but in my tests it blocks, i can't understand what's going on
Stavros Korokithakis
@skorokithakis
Aug 15 2016 22:35
ah, apparently i needed to setTimeout() to something low, the default wasn't 1 sec
Stavros Korokithakis
@skorokithakis
Aug 15 2016 23:47
yay, my A6 library is looking pretty good!
Mehrdad K
@mkeyno
Aug 15 2016 23:53
@skorokithakis what setTimeout() used for? you mean send AT command and wait for capture respond
Stavros Korokithakis
@skorokithakis
Aug 15 2016 23:53
yes
it would wait too long before
Mehrdad K
@mkeyno
Aug 15 2016 23:54
it will unstable your wifi stack as I had with my GSM module
Stavros Korokithakis
@skorokithakis
Aug 15 2016 23:54
why is that?
Mehrdad K
@mkeyno
Aug 15 2016 23:54
mine let in loop catch the respond
Stavros Korokithakis
@skorokithakis
Aug 15 2016 23:55
did you yield() in the loop?
Mehrdad K
@mkeyno
Aug 15 2016 23:55
honestly I don't know , but something like serial event would be helpful
Stavros Korokithakis
@skorokithakis
Aug 15 2016 23:55
i hope that yield() will give the ESP time to process wifi events and it won't destabilize
it yields at most every 100 ms right now
Mehrdad K
@mkeyno
Aug 15 2016 23:56
not test this much but I also have websocket service which let to disconnected frequently
Stavros Korokithakis
@skorokithakis
Aug 15 2016 23:57
ah hmm
Mehrdad K
@mkeyno
Aug 15 2016 23:58
I hear from Ivan and me-no-dev that they intend to develop function just like the serial event in Arduino
if they do it would be so helpfull