Proper way to disable AP

axa88*
Posts: 3
Joined: Sun Apr 07, 2019 8:54 am

Proper way to disable AP

Postby axa88* » Sun Apr 07, 2019 9:17 am

This thread on github indicates that i should be able to disable the AP by simply changing the mode to WIFI_MODE_STA

https://github.com/espressif/esp-idf/issues/2433

Only when i try doing that i get the error below, and my board reboots.

Code: Select all

WiFi.mode(WIFI_MODE_STA);
In fact, doing any of these things seems to give me the error and reboot my board:

Code: Select all

WiFi.mode(WIFI_MODE_STA);
WiFi.enableAP(false);
WiFi.softAPdisconnect();
WiFi.softAPdisconnect(false);

What might i be doing wrong?

Code: Select all

Guru Meditation Error: Core  0 panic'ed (Interrupt wdt timeout on CPU0)
Core 0 register dump:
PC      : 0x4008ff67  PS      : 0x00060a34  A0      : 0x80091101  A1      : 0x3ffb5520  
A2      : 0x3ffbdd14  A3      : 0x0000cdcd  A4      : 0xb33fffff  A5      : 0x00000001  
A6      : 0x00060823  A7      : 0x0000abab  A8      : 0x0000cdcd  A9      : 0x3ffb5660  
A10     : 0x3ffc5548  A11     : 0x00060623  A12     : 0x00060620  A13     : 0x3ffb5708  
A14     : 0x00000009  A15     : 0x3ffc86a4  SAR     : 0x0000001e  EXCCAUSE: 0x00000005  
EXCVADDR: 0x00000000  LBEG    : 0x4000c2e0  LEND    : 0x4000c2f6  LCOUNT  : 0xffffffff  

Backtrace: 0x4008ff67:0x3ffb5520 0x400910fe:0x3ffb5550 0x4008f4ef:0x3ffb5570 0x400864cf:0x3ffb55b0 0x400865a9:0x3ffb55e0 0x400e2197:0x3ffb5600 0x40118a81:0x3ffb5630 0x4012e64d:0x3ffb5660 0x4012e7be:0x3ffb5680 0x40118b90:0x3ffb56a0 0x40118f83:0x3ffb56d0 0x40088768:0x3ffb56f0 0x4008e875:0x3ffb5730

Core 1 register dump:
PC      : 0x40091958  PS      : 0x00060434  A0      : 0x80090ada  A1      : 0x3ffbe6e0  
A2      : 0x3ffb595c  A3      : 0x3ffb8074  A4      : 0x00000001  A5      : 0x00000001  
A6      : 0x00060423  A7      : 0x00000000  A8      : 0x3ffb8074  A9      : 0x3ffb8074  
A10     : 0x00000018  A11     : 0x00000018  A12     : 0x00000001  A13     : 0x00000001  
A14     : 0x00060421  A15     : 0x00000000  SAR     : 0x00000000  EXCCAUSE: 0x00000005  
EXCVADDR: 0x00000000  LBEG    : 0x4000c2e0  LEND    : 0x4000c2f6  LCOUNT  : 0xffffffff  

Backtrace: 0x40091958:0x3ffbe6e0 0x40090ad7:0x3ffbe700 0x4008f58f:0x3ffbe720 0x40083d95:0x3ffbe760 0x40119081:0x3ffbe780 0x4010d088:0x3ffbe7a0 0x400d81e1:0x3ffbe7d0 0x400d3739:0x3ffbe8d0 0x40080f8e:0x3ffbe8f0 0x40081255:0x3ffbe910 0x40081761:0x3ffbe930 0x4000bfed:0x00000000

axa88*
Posts: 3
Joined: Sun Apr 07, 2019 8:54 am

Re: Proper way to disable AP

Postby axa88* » Mon Apr 15, 2019 12:05 am

My falut, i was attempting to change the mode during an ISR.

The ISR was marked with IRAM_ATTR and called a function containing WiFi.mode(STA) which was not marked with IRAM_ATTR.
Apparently any function called from a function marked by IRAM_ATTR also needs to be marked with IRAM_ATTR.
As stated in documentation.

https://docs.espressif.com/projects/esp ... notes.html
Interrupt handlers must be placed into IRAM if ESP_INTR_FLAG_IRAM is used when registering the interrupt handler. In this case, ISR may only call functions placed into IRAM or functions present in ROM. Note 1: all FreeRTOS APIs are currently placed into IRAM, so are safe to call from interrupt handlers. If the ISR is placed into IRAM, all constant data used by the ISR and functions called from ISR (including, but not limited to, const char arrays), must be placed into DRAM using DRAM_ATTR.

Who is online

Users browsing this forum: No registered users and 25 guests