Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
an-erd
@an-erd
I experience some issues when moving from using wifi.begin() (with one single fixed SSID/pwd) to wifiMulti.run() with 3 configured WLANs. if I don't touch the rotary encoder (handled by interrupts) it is working, but when using the rotary encoder I get an exception. In the stack trace the top line shows an interrupt_handle in /core_esp8266_wiring_digital.c . I'm not that familiar in reading the stack traces an would like to ask for your support.
Do you have experiences with WiFiMulti and interrupts? Any other hints?
Bert Melis
@bertmelis
which exception you you have? how are you handling the interrupts? (long ISR or flag + handle in main loop?)
an-erd
@an-erd
@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
ok, and what's the exception code you're facing?
an-erd
@an-erd
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
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
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
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
@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
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
ah, wait. It's already decoded...
Mike Kranidis
@mikekgr

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
@bertmelis Thanks for the hints. I now have enough paths to follow up and will give feedback.
an-erd
@an-erd
@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
do you use delay() in your ISR?
have you marked your ISR with ICACHE_RAM_ATTR?
an-erd
@an-erd
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
you can divide by zero at the point you want a stack dump.
or insert a lot of debug messages.
Bert Melis
@bertmelis
you can also share your code so everyone van help searching (if it's open source).
an-erd
@an-erd
Everything works fine incl. commit 5a1528c (on devel tree)
an-erd
@an-erd
(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
@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
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
I thought you could even specify the buffer size in the constructor.
brutzler
@brutzler
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
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()"?
Michael Miller
@Makuna
@brutzler I believe they use an ISR on the receive pin, stores the data in the buffer, then let you read from the loop.
Mike Kranidis
@mikekgr

@Makuna
Thanks Michael for the reply. I changed the way I handled with the bollow and now it is working fine:

uint8_t * mac;
mac = WiFi.BSSID(i);
      Serial.printf(" , MAC: %02X:%02X:%02X:%02X:%02X:%02X\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);

Where i is the under question SSID number like :

int N= WiFi.scanNetworks();
for (int i = 0; i < N; i++)
    {
mac = WiFi.BSSID(i);
      Serial.printf(" , MAC: %02X:%02X:%02X:%02X:%02X:%02X\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
     }
andig
@andig
Hello :) Is there any news or eta on SPIFFS support for esp32?
Tejas H
@CodingCreate101
Hi everyone. I have little problem with NodeMcu V3: While upload my code to esp, I have to press and hold flash button and then press reset button. But I have seen some people uploading code without touching the esp module. What am I missing? Help!
brutzler
@brutzler
what is the "right" lib for SoftwareSerial? This one provided with the actual package (2.3.0)?
Asking because what ever I do, I do not receive any data on the RX-pin...
I use the same hardware for Receive/transmit data on TXD2/RXD2 (Serial.swap) sucessfully, but with Software.Serial it is not working at all. used lot of different pin-pairs.
Bert Melis
@bertmelis
There's a "built in" lib? I've always been using the espsoftwareserial as found on Github.
from @plerup
brutzler
@brutzler
C:\Users\brutzler\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\SoftwareSerial
but looks to be the same....