When AP is shut down, Stack overflow occurs in the whd_wifi_prepare_join function

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
machoaze
Employee
Employee
First reply posted First question asked Welcome!

Hello,  I have been working on a project that includes both AP and STA mode for PSoC6. 

I successfully achieved to configure WiFi operations by using WCM and WHD libraries. However, when I tested what happens when I shut down the AP, which the PSoC connected, I got a stack overflow exception in debugging. When I trace the error, I found that the PSoC6 tries to reconnect to the AP with JOIN_RETRY_ATTEMPTS number of times. Then, if this number is exceeded, a timer thread is set to some backoff time to start to retry attempts. When this timer is finished, handshake_error_callback function is called second time and it starts retry attempts but in the first attempt, there is a stack overflow.

Device is CYSBSYSKIT-DEV-01. WiFi Connection Manager release v2.3 and WHD release is v2.1.

Thank you.

0 Likes
1 Solution
Qi_Colin
Moderator
Moderator
Moderator
50 likes received 100 solutions authored 5 questions asked

Hi @machoaze :

This is application stack overflow, and you can find the detail description on Stack Overflow Protection.

You can try to modify the configTOTAL_HEAP_SIZE in FreeRTOS.h to improve this problem.

Best Regards,

Colin

 

View solution in original post

0 Likes
4 Replies
Qi_Colin
Moderator
Moderator
Moderator
50 likes received 100 solutions authored 5 questions asked

Hi @machoaze :

Could you share more log information about this issue?

It's hard to find the cause of this issue just from the descriptions.

Best Regards,

Colin

0 Likes
machoaze
Employee
Employee
First reply posted First question asked Welcome!

Hello @Qi_Colin

What do you want as a log? Is there a specific way to get a log file that is embedded in the libraries or do you just want more information about it?

I can just share my code flow with you.
1) I first call cy_wcm_init function to init library.

2) Then I connect to the AP by calling cy_wcm_connect_ap function.

3) Then everything works like a charm.

4) However, I just close the AP manually (e.g. Unplug the power chord of the modem, closing the hotspot of my phone) to see what is the behavior of the library. Unfortunately, it tries to reconnect couple of times but eventually it calls the following function:

#if configCHECK_FOR_STACK_OVERFLOW != 0
__attribute__((weak)) void vApplicationStackOverflowHook( TaskHandle_t xTask, char *pcTaskName )

 

Also, I saw following lines in the UART output:

Function whd_wifi_join failed at line 1744 checkres = 33555456 
Function whd_wifi_join failed at line 1744 checkres = 33555456 
Function whd_wifi_join failed at line 1744 checkres = 33555456 

 Thank you.

0 Likes
Qi_Colin
Moderator
Moderator
Moderator
50 likes received 100 solutions authored 5 questions asked

Hi @machoaze :

This is application stack overflow, and you can find the detail description on Stack Overflow Protection.

You can try to modify the configTOTAL_HEAP_SIZE in FreeRTOS.h to improve this problem.

Best Regards,

Colin

 

0 Likes
machoaze
Employee
Employee
First reply posted First question asked Welcome!

Hello, 
 
Thank you for your reply. The problem was configTIMER_TASK_STACK_DEPTH because it was set to configMINIMAL_STACK_SIZE. I solved the problem when I increased the stack size of the timer task.

Thanks.

0 Likes