How to set custom timeout for common AT Command functions?

Hello all,

How do I set custom timeouts for common functions like Cellular_CommonGetModemInfo?
I see that the send functions use PACKET_REQ_TIMEOUT_MS as the default value.
My modem documentation recommends a longer timeout for some of the common AT commands.
Since this define doesn’t have #ifndef block around it there is no way to redefine it without modifying the Cellular Interface Files.
I wanted to ask if setting a custom timeout is possible before asking for a feature request.

Thank you,
Tuna Bicim

Hi Tuna,

Thank you for your interest in FreeRTOS Cellular Interface.

There are APIs that can set the AT command timeout value in cellular common layer APIs. For example, _Cellular_TimeoutAtcmdRequestWithCallback is the timeout version API. These APIs are designed for cellular modem porting. The timeout value for cellular APIs should be set according to modem spec in the modem porting.

Can you elaborate more about this feature? We will discuss this feature and reply in this thread.


I already use the timeout Atcmd function in {modem_name}.api file.
However, for common functionality such as getting modem info, getting network registration etc. I use Common implementation from the 3gpp_api.c file on my {modem_name}_wrapper.c file.
For example Cellular_CommonGetModemInfo function uses _Cellular_AtcmdRequestWithCallback function and that function calls
_Cellular_TimeoutAtcmdRequestWithCallback( pContext, atReq, ( uint32_t ) PACKET_REQ_TIMEOUT_MS );
I am looking for a way to change PACKET_REQ_TIMEOUT_MS so that it is longer since my modem spec recommends a longer timeout than 5000 ms.
Right now there is no way to change this value without modifying library files because it sits at FreeRTOS-Cellular-Interface/source/include/private/cellular_pkthandler_internal.h
If It was set at cellular_config_defaults.h file with #ifndef block around it the user could specify the default timeout value for all the common functions themselves.

Hope that clarifies what I am trying to achieve.

Thank you,
Tuna Bicim

Hi Tuna,

Thank you for your feedback. We will add this config to cellular interface.
Once this change is merged, I will reply in this thread again.

We merged the feature to change the AT command timeout for cellular common APIs in this commit. Thank you for your feedback again.

1 Like