Error when stopping wifi and tiT (tcp/ip task) hanging cpu1

CamaradaDimitrov
Posts: 1
Joined: Tue Jun 04, 2019 2:28 pm

Error when stopping wifi and tiT (tcp/ip task) hanging cpu1

Postby CamaradaDimitrov » Tue Jun 04, 2019 2:50 pm

Environment:
Latest idf as of the date of first post.
Using devkit-c v4, with esp32-wroom-32D.

Program description:
The program implements a state machine that loads the last pair of ssid/pass from nvs, if it can connect it sends a request and then turns off. If it can't connect, it stops the station mode, starts a soft ap with an http server for setting the ssid/pass. When that value pair is posted, it saves them to nvs, turns off soft ap, and goes back to the initial state (except nvs load, which is called only once on startup).

What works (debugged through serial monitor):
Trying 2 times to connect to the saved AP. Logged a WIFI_EVENT, with id 3 (sta stop)
After failing this, it creates the server, i connect and enter the values, pass them through a post request, and the values for ssid/pass are right (checked through logging).

Here starts the failing:
I call again for esp_wifi_stop(). Two WIFI_EVENT are logged, 3 and 14 (sta stop and ap sta dissconected).
Then i get this E log:
tcpip_adapter: handle_ap_stop 134 esp_wifi_internal_reg_rxcb ret=0x3014

Then another WIFI_EVENT with id 12 (ap stop).
Then the same E log as before.
After this, the code for connecting to the ap starts again (which works if you give it a valid ssid/pass the first time).
The ssid and pass are fine. I get some i logs from wifi and then the watchdog gets triggered, because IDLE1 did not reset it in time.
CPU1 is running task tiT, which corresponds to the tcp/ip task.

I feel there's some initialization/clearing that i am missing between all this mode switches. Am i complicating myself too much? What's the right burocracy for changing between modes and ssid's?

Who is online

Users browsing this forum: No registered users and 143 guests