How can I reproduce "+CWJAP:4"?

yamazaki
Posts: 6
Joined: Mon Nov 14, 2016 4:27 pm

How can I reproduce "+CWJAP:4"?

Postby yamazaki » Tue Apr 25, 2017 10:54 am

I have two questions about error code of "AT+CWJAP_CUR".

As the specification describes, there are 4 error code are defined as the response of "AT+CWJAP_CUR".
I'm trying reproducing all error codes, however only one error code "4:connection failed" cannot be reproduced.
So my questions are are below.
1. How can I reproduce "+CWJAP:4".

2. What should we do if the error code "4" is responded?
Just retry "AT+CWJAP_CUR" or reset the module?

Thanks in advance!
Yamazaki

pratik

Re: How can I reproduce "+CWJAP:4"?

Postby pratik » Wed Apr 26, 2017 1:31 pm

The reason 4 is rather broad - it is difficult to tell what caused it. So the best strategy is to tell the user the connection failed, after trying 3-4 times. The cause may not usually be on the ESP end. If there is MAC authentication enabled on the router, and your ESP is not allowed to connect, this may happen. Or if the AP disappears or crashes when ESP is connecting... code 4 may happen. Also when the AP is not able to connect because it cannot handle more device, code 4 may be returned.
Better to just give up on the AP rather than restarting the ESP.

yamazaki
Posts: 6
Joined: Mon Nov 14, 2016 4:27 pm

Re: How can I reproduce "+CWJAP:4"?

Postby yamazaki » Thu Apr 27, 2017 9:15 am

Hi Pratik-san,

Thank you for your comment. I got it!

Regards,
Yamazaki

Who is online

Users browsing this forum: No registered users and 2 guests