Closed mbruno-xmos closed 4 years ago
We are investigating the exception and trying to reproduce the behavior. In the application, is there anything going-on between the host and the WF200 when the sl_wfx_stop_ap_command()
function is called?
Initially I thought that it could be that the TCP/IP stack in my application was attempting to send out a frame at the same time I was stopping the AP. However, I have ensured that that is not possible and the exception is still happening.
I can reproduce the exception by doing the following:
for (;;) {
sl_wfx_start_ap_command(...);
wait for SL_WFX_START_AP_IND_ID
dhcpd_start() /* starts a DHCP server */
vTaskDelay(pdMS_TO_TICKS(10000)); /* wait for 10 seconds */
dhcpd_stop();
sl_wfx_stop_ap_command();
wait for SL_WFX_STOP_AP_IND_ID /* this is where the exception is sometimes received */
vTaskDelay(pdMS_TO_TICKS(500)); /* wait half a second */
}
During this loop I have two wifi clients connecting, getting IPs from the DHCP server, getting disconnected when sl_wfx_stop_ap_command() is called, and then trying to reconnect. If I let this loop run for several iterations with the two clients connecting and disconnecting, I eventually will hit the exception (it takes a couple minutes). My best guess is that it is a race condition in the WF200 firmware between stopping the AP and handling a client connection.
Also just in case it's not clear, the above is pseudocode. There's a bit more going on, including obtaining and releasing a mutex around starting the AP and waiting for the SL_WFX_START_AP_IND_ID message, as well as around stopping the AP and waiting for the SL_WFX_STOP_AP_IND_ID message. This ensures that frames are not sent during those times.
Thanks for the detailed explanation.
Fixed in FMAC driver 3.0.0.
Sometimes after calling sl_wfx_stop_ap_command() a firmware exception message is received when waiting for the SL_WFX_STOP_AP_IND_ID event. sl_wfx_stop_ap_command() itself returns SL_STATUS_OK so the SL_WFX_STOP_AP_REQ_ID confirmation appears to be received.
I am on driver commit 96e72bf and firmware version 3.3.1.
I am not sure if this is a bug in the firmware or if I am doing something wrong. Here is the output from my application. Before calling sl_wfx_stop_ap_command(), the AP has already been started successfully and clients are connected.
sl_wfx_stop_ap_command() returned 0 Firmware Exception Exception data = 4, 0, 0, 0, CB, 76, 1, 0, C8, B, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, CF, 76, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,