These are chat archives for esp8266/Arduino

20th
Jun 2017
Bert Melis
@bertmelis
Jun 20 2017 08:33
which exception you you have? how are you handling the interrupts? (long ISR or flag + handle in main loop?)
an-erd
@an-erd
Jun 20 2017 09:07
@bertmelis The interrupt is essentially checking millis() against last call time stamp (for rebounce threshold) and then setting a flag to handle in loop(), so it's pretty short.
Bert Melis
@bertmelis
Jun 20 2017 09:09
ok, and what's the exception code you're facing?
an-erd
@an-erd
Jun 20 2017 09:11
I receive an exception (0). Although not measured it seems that WiFiMulti.run() takes to long. Also I found in the stack trace, that some functions like wifi_param_save_protect_with_check(), ESP8266WiFiSTAClass::begin(), ... appear twice, although called only once and are completed before the next call (checked with debug statements).
Please find the stack trace attached:
Decoding 49 results
0x40106402: interrupt_handler at C:\Users\AKAEM\Documents\Arduino\hardware\esp8266com\esp8266\cores\esp8266/core_esp8266_wiring_digital.c line 128
0x401064fa: __digitalRead at C:\Users\AKAEM\Documents\Arduino\hardware\esp8266com\esp8266\cores\esp8266/core_esp8266_wiring_digital.c line 95
0x401063c8: interrupt_handler at C:\Users\AKAEM\Documents\Arduino\hardware\esp8266com\esp8266\cores\esp8266/core_esp8266_wiring_digital.c line 122
0x4024e130: sleep_reset_analog_rtcreg_8266 at ?? line ?
0x401063c8: interrupt_handler at C:\Users\AKAEM\Documents\Arduino\hardware\esp8266com\esp8266\cores\esp8266/core_esp8266_wiring_digital.c line 122
0x401063c8: interrupt_handler at C:\Users\AKAEM\Documents\Arduino\hardware\esp8266com\esp8266\cores\esp8266/core_esp8266_wiring_digital.c line 122
0x402015a0: twi_delay at C:\Users\AKAEM\Documents\Arduino\hardware\esp8266com\esp8266\cores\esp8266/core_esp8266_si2c.c line 81
0x402016ce: twi_write_bit at C:\Users\AKAEM\Documents\Arduino\hardware\esp8266com\esp8266\cores\esp8266/core_esp8266_si2c.c line 81
0x401064fa: __digitalRead at C:\Users\AKAEM\Documents\Arduino\hardware\esp8266com\esp8266\cores\esp8266/core_esp8266_wiring_digital.c line 95
0x401064fa: __digitalRead at C:\Users\AKAEM\Documents\Arduino\hardware\esp8266com\esp8266\cores\esp8266/core_esp8266_wiring_digital.c line 95
0x401064fa: __digitalRead at C:\Users\AKAEM\Documents\Arduino\hardware\esp8266com\esp8266\cores\esp8266/core_esp8266_wiring_digital.c line 95
0x40210466: ROTENC::isrInt0() at C:\Users\AKAEM\AppData\Local\Temp\VMBuilds\spBox\esp8266com_huzzah\Debug/rotenc.cpp line 67
0x40216e03: std::_Function_handler    (ROTENC*)> >::_M_invoke(std::_Any_data const&) at C:\Users\AKAEM\AppData\Local\Temp\VMBuilds\spBox\esp8266com_huzzah\Debug/rotenc.cpp line 67
0x401052a3: flash_gd25q32c_read_status at ?? line ?
0x4024e130: sleep_reset_analog_rtcreg_8266 at ?? line ?
0x40105514: spi_flash_erase_sector at ?? line ?
0x40106788: pvPortZalloc at C:\Users\AKAEM\Documents\Arduino\hardware\esp8266com\esp8266\cores\esp8266/heap.c line 68
0x402411f8: wifi_param_save_protect_with_check at ?? line ?
0x402411e1: wifi_param_save_protect_with_check at ?? line ?
0x402412cb: system_param_save_with_protect at ?? line ?
0x402412ae: system_param_save_with_protect at ?? line ?
0x402415fd: wifi_station_ap_number_set at ?? line ?
0x402415b0: wifi_station_ap_number_set at ?? line ?
0x40207a68: ESP8266WiFiSTAClass::begin(char const*, char const*, int, unsigned char const*, bool) at C:\Users\AKAEM\Documents\Arduino\hardware\esp8266com\esp8266\libraries\ESP8266WiFi\src/ESP8266WiFiSTA.cpp line 516
0x402079a3: ESP8266WiFiSTAClass::begin(char const*, char const*, int, unsigned char const*, bool) at C:\Users\AKAEM\Documents\Arduino\hardware\esp8266com\esp8266\libraries\ESP8266WiFi\src/ESP8266WiFiSTA.cpp line 516
0x4020d7b4: EEPROMClass::commit() at C:\Users\AKAEM\Documents\Arduino\hardware\esp8266com\esp8266\libraries\EEPROM/EEPROM.cpp line 132
0x402172f0: Print::write(unsigned char const*, unsigned int) at C:\Users\AKAEM\Documents\Arduino\hardware\esp8266com\esp8266\cores\esp8266/Print.cpp line 38
0x40214bd9: Print::write(char const*) at C:\Users\AKAEM\Documents\Arduino\hardware\esp8266com\esp8266\cores\esp8266/Print.cpp line 211
0x40240f1a: wifi_get_opmode at ?? line ?
0x4024203b: wifi_station_get_connect_status at ?? line ?
0x40214d8c: Print::println() at C:\Users\AKAEM\Documents\Arduino\hardware\esp8266com\esp8266\cores\esp8266/Print.cpp line 211
0x40103aae: lmacProcessCollision at ?? line ?
0x4021438c: esp_yield at C:\Users\AKAEM\Documents\Arduino\hardware\esp8266com\esp8266\cores\esp8266/core_esp8266_main.cpp line 57
0x40207b08: ESP8266WiFiSTAClass::begin(char*, char*, int, unsigned char const*, bool) at C:\Users\AKAEM\Documents\Arduino\hardware\esp8266com\esp8266\libraries\ESP8266WiFi\src/ESP8266WiFiSTA.cpp line 516
0x4020738f: ESP8266WiFiMulti::run(WifiAPProfile_t) at C:\Users\AKAEM\Documents\Arduino\hardware\esp8266com\esp8266\libraries\ESP8266WiFi\src/ESP8266WiFiMulti.cpp line 124
0x40205e81: LCDMenuLib::doScroll() at C:\Users
an-erd
@an-erd
Jun 20 2017 09:19
Sorry, the last lines were missing, please find the missing part...
0x40205e81: LCDMenuLib::doScroll() at C:\Users\AKAEM\Documents\Arduino\libraries\LCDMenuLib\src/LCDMenuLib.cpp line 479
0x402110d7: SPBOX_COM::enableWlan() at C:\Users\AKAEM\AppData\Local\Temp\VMBuilds\spBox\esp8266com_huzzah\Debug/spbox_com.cpp line 234
0x40211159: SPBOX_COM::checkWlan() at C:\Users\AKAEM\AppData\Local\Temp\VMBuilds\spBox\esp8266com_huzzah\Debug/spbox_com.cpp line 234
0x40205176: loop at C:\Users\AKAEM\AppData\Local\Temp\VMBuilds\spBox\esp8266com_huzzah\Debug/spBox.cpp line 1422
0x402143d8: loop_wrapper at C:\Users\AKAEM\Documents\Arduino\hardware\esp8266com\esp8266\cores\esp8266/core_esp8266_main.cpp line 57
0x4010070c: cont_norm at C:\Users\AKAEM\Documents\Arduino\hardware\esp8266com\esp8266\cores\esp8266/cont.S line 109
Bert Melis
@bertmelis
Jun 20 2017 09:27
maybe try to increase the debounce time as a first try? Or disable interrupts while handling the flag in your loop.
--> What happens if you're handling the ISR-flag and you're having a new interrupt?
exception 0 means you're having an "illigal instruction". But you haven't included the complete error message.
Bert Melis
@bertmelis
Jun 20 2017 09:39
or search for possible "simple errors" link dividing by 0 or like
(which could be caused by float to int conversions)
an-erd
@an-erd
Jun 20 2017 10:23
@bertmelis Beginning of the stack trace:
Exception (0):
epc1=0x40214740 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000

ctx: cont
sp: 3fff2120 end: 3fff26a0 offset: 01a0
I'll try the other steps you mentioned tonight.
Is the previous post the "complete error message" you mentioned, or do you need something?
Bert Melis
@bertmelis
Jun 20 2017 10:46
this is the missing info yes. See http://www.esp8266.com/viewtopic.php?f=9&t=5472 to find where the fault likely has occured.
But I find it strange to have the sp/end/offset in the 0x3F-range while the stack dump is in the 0x40-range. Or do I miss something?
Bert Melis
@bertmelis
Jun 20 2017 10:54
ah, wait. It's already decoded...
mikekgr
@mikekgr
Jun 20 2017 11:02

I am tring to get routers MAC address from my ESP8266 that is connected as client.
When I do the following:
uint8_t bssid[6];
WiFi.BSSID(bssid);

I got the error:
invalid conversion from 'uint8_t {aka unsigned char}' to 'uint8_t {aka unsigned char}' [-fpermissive]

I tested also using:
byte bssid[6];
unsigned int bssid[6];
without better result. Always the same.
Why?

an-erd
@an-erd
Jun 20 2017 11:31
@bertmelis Thanks for the hints. I now have enough paths to follow up and will give feedback.
an-erd
@an-erd
Jun 20 2017 13:58
@bertmelis , all: Just another quick question - what do the duplicate lines mean, e.g. with the address 0x401064fa. Is the function called multiple times?
Bert Melis
@bertmelis
Jun 20 2017 14:21
do you use delay() in your ISR?
have you marked your ISR with ICACHE_RAM_ATTR?
an-erd
@an-erd
Jun 20 2017 14:49
no, I don't have delay() in my sketches at all. No, ISR is not marked with ICACHE_RAM_ATTR, I'll change and check.
I think that the WiFiMulit.run() takes to long and that this causes the problem at all, but I'm not sure how to best resolve this guess. Is there a way to force a stack trace with code?
Bert Melis
@bertmelis
Jun 20 2017 16:26
you can divide by zero at the point you want a stack dump.
or insert a lot of debug messages.
Bert Melis
@bertmelis
Jun 20 2017 16:33
you can also share your code so everyone van help searching (if it's open source).
an-erd
@an-erd
Jun 20 2017 16:37
Everything works fine incl. commit 5a1528c (on devel tree)
an-erd
@an-erd
Jun 20 2017 16:50
(and changes in https://github.com/an-erd/Arduino for functional callbacks and changes in the call to wifiMulti.run(ANY) / just change to wifiMulti.run(), not commited to Arduino tree yet )
Michael Miller
@Makuna
Jun 20 2017 17:49
@mikekgr I am not sure you have the correct signature for the method BSSID. Check the headers, I believe it returns a pointer to array (strange but that is what it looks like).
brutzler
@brutzler
Jun 20 2017 20:22
a question to SoftwareSerial:
Is this working in a "hardwareloop"? Connecting TX to RX. Can I send something and read the buffer out afterwards? Or is there no buffer like at hardware serial, which is storing the received datas?
Something like this:
SoftwareSerial swSer(14, 12);  // connecting pin 14 to pin 12
void setup() {
  swSer.begin(9600);
 }
void loop() {
swSer.println("test");
while (swSer.available() > 0) {
    Serial.write(swSer.read());
 }
}
Bert Melis
@bertmelis
Jun 20 2017 20:31
I thought you could even specify the buffer size in the constructor.
brutzler
@brutzler
Jun 20 2017 20:33
SoftwareSerial swSer(14, 12, false, 256);
Yes, saw this. Think 256 is the buffer size, but what means "false"?
Somewhere a definition of this?
brutzler
@brutzler
Jun 20 2017 20:39
OK, found it:
SoftwareSerial::SoftwareSerial(int receivePin, int transmitPin, bool inverse_logic, unsigned int buffSize)
But still the question: Is this buffer storing the received data in the background, until I read them out in the "void loop()"?