Timeout Indication and Recovery#

For every SAPI command response-timeout error, 0xFFFFFFE2 is returned. This error indicates the device exceeded the configured timeout in the SAPI driver.

If a timeout error occurs, the application has to reset the device and driver state as an error recovery mechanism.

Similarly, timeout error indication is added in the driver. For this, a callback needs to be registered. For callback registering, it is necessary to call the rsi_register_wait_timeout_error_callbacks() (Handler) API in the application and callback will have the error value RSI_ERROR_RESPONSE_TIMEOUT and cmd_type(Common,wlan,nwk,socket,tx,rx,BT,PROP_PROTOCOL) as the parameters.

Syntax of callback

void rsi_register_wait_timeout_error_callbacks(void (*callback_handler_ptr)(uint32_t status, uint32_t cmd_type));

Timeouts are configurable in the SAPI driver with multiplication or addition factor in the file rsi_user.h. The configurable default values are provided below for reference:

Mutiplication Factor

#define WIFI_INTERNAL_TIMEOUT_SF 1 #define WIFI_WAIT_TIMEOUT_SF 1 #define WIFI_BLOCKED_TIMEOUT_SF 1

Addition Factor

#define TX_WAIT_TIME 0

Under Multiplication factor, total timers available are divided into three categories. Based on the value configured, the timers are multiplied. i.e in the above mentioned Multiplication factor, if the value configured is changed to 2, all the timers under that category will be doubled.

Under Addition factor, if user wants to increase all the timers then all timers will be increased by configured TX_WAIT_TIME value. For every command issued from SAPI to 9116, will wait for TX_EVENT_WAIT_TIME to receive a response from the device.

Generally, the default TX_EVENT_WAIT_TIME and RX_EVENT_WAIT_TIME are configured with 30 milliseconds.

For example, if we take a rejoin case, every retransmission takes a maximum time of 5 seconds.

rejoin_duration = (scan-to-scan_duration(4sec default, can be configurable in rsi_config.h)) + (active_channels_to_scan * 100ms) + (passive_channels_to_scan * 400ms)

So, in this case, before TX_EVENT_WAIT_TIME out buffer is full will occur if data transfer is there. So, in that case we need to increase the TX_EVENT_WAIT_TIME. This can be increased by configuring TX_WAIT_TIME. That is, if TX_WAIT_TIME is configured to 30000, then TX_EVENT_WAIT_TIME will become 60000 ms i.e. TX_WAIT_TIME + DEFAULT_TX_EVENT_WAIT_TIME.