We are testing WHD with Sterling-LWB5+ (CY4373E) and we have the following issue. In whd_wifi_on() country code setting fails and we get "Could not set Country code" error.
Tracing shows that whd_thread_func() puts the device to sleep (KSO disable) and takes the transceiver semaphore with timeout CY_RTOS_NEVER_TIMEOUT. After this point, the card interrupts are missed and there is no activity on the wifi task.
To test that the issue is with card interrupts when KSO is off, we have tested the following case. We used whd_ensure_wlan_bus_is_up() in the main task loop and set CY_RTOS_NEVER_TIMEOUT to, for example, 10ms so that we are periodically waking up the device. Then, the card interrupts are received and the country code setting succeeds. Also, whd_wifi_on() completes successfully. We have tested with WHD v2.0.0 and v1.94.0.
What could be the root cause for this issue and how could we mitigate it?
"Could not set Country code" implies that the country code that you are trying to set doesn't exist in the .clm_blob that you are using. Could you try with one of the country code which is present in clm_blob and check if the issue gets resolved?
How could I confirm that the country code exists in the clm_blob?
While the error for all of the above country codes is the same, the trace looks different. In case of US, there is 5 seconds (WHD_IOCTL_TIMEOUT_MS) silence before the error message, but for Sweden the error is returned immediately. It seems that even for supported country codes, we get the same error when the card interrupts are missed.