Chat freely about anything...

User avatar
By mladejat
#11125 Dear espressif team,

There is some strange behavior of esp module. I use module with already set "ssid" and "password" by command AT+CWJAP="ssid","password". After every restart of the host mcu there is check of all settings and when command AT+CWJAP? is sent, module responds with "No AP". After some delay, the module starts to answer correctly - CWJAP:"ssid".
After examining the code of function "at_queryCmdCwjap (uint8_t id)" I came across the following:
at_queryCmdCwjap(uint8_t id)
{
...
wifi_get_ip_info (0x00, & pTempIp);
if (pTempIp.ip.addr == 0)
{
at_backError;
return;
}
...
It turns out that by asking a question about the name of the preset AP, I gets an answer of not set AP, due to the fact that actually currently module still not received IP address ???
Excuse me, but when I ask You what is the temperature, I did not care if you have forgotten your watch and whether you have cousin.
When the source code of your AT commands was still open I commented this part of the code and skipped the problem but now code is not open any more.
Please remove this part of code or explain me the reason why it have to be like that. Thank You.

Best regards,
Peter
User avatar
By mladejat
#11275 But when answer "No AP" is received, what is the reason for that - because "ssid" is not correctly set or because router is temporary switch-off?
Haw can I check settings, if router is switch-off or is out of range.

Logic of my code is following:
After starting of program, host MCU does not know if it is the first time it connecting to the esp_module or if the module is replaced with the new one. For this reason after every restart, host MCU also restarts the esp_module and checks all its parameters (mode, dhcp, AP, MAC, etc). If the value of "ssid" is not correct one, then host MCU submits command AT+CWJAP="ssid","pass".
Currently, the first few seconds until esp_module is still has not obtained the IP address, answer of AT+CWJAP? is "No AP" which misleads the host MCU to send AT+CWJAP="ssid","pass". "ssid" and "pass" are saved into the module's flash so this means that every restart of MCU will rewrite the same information. Sooner or later flash will be damaged. This problem can be overcome through several checks in one second period, but the next question arises:
What happens when AP is correctly configured (ssid and password), but the router is not turned ON or is out of range. The module will not obtain the IP address and will report "No AP" forever. It turns out that host MCU will infinity set the same "ssid" & "password", but module again will answer "No AP".
If I need IP address, there is command "AT+CIFSR", which will give me info about if IP is obtained and its value. But when I need info about settings related to the AP , my expectations are to receive info about it, not about connection state.
Please, do not tell me to use flag named "already_set_ssid_do_not_try_anymore"...
Best Regards,
Peter