I am having problem with Cellular_ModuleEnableUrc function in cellular_hl7802.c.
Command AT+COPS has 120 second timeout (according to AirPrime HL78xx AT Commands Interface Guide) but the driver uses _Cellular_AtcmdRequestWithCallback function with 5-second default timeout. I measured that response to this command takes around 9 seconds on my HL7802 development board with 1NCE sim card.
I think that changing the call to
( void ) _Cellular_TimeoutAtcmdRequestWithCallback( pContext, atReqGetNoResult, UINT32_C(120000) );
would fix the problem.
This, however, brings me to a second problem:
When a command times out, the response from HL7802 can still arrive later. Also, when a command times out, other command will be sent after the timeout by the driver. But when the response to the original command then arrives, the driver will take it as a response to the second command. Because a lot of the responses are just plain “OK”, they can get mixed up and it basically creates a lag or off-by-one kind of error until it fails on some command that expects a different response. The problem is with the AT command system itself but that is something we cannot change. The only fix I could come up with is flushing the input buffer before sending command. It helps but I think it would be prone to race conditions on a full-duplex UART line. In the end, I only encountered this problem when the timeout for AT+COPS was the original 5 seconds and I changed it to 120 seconds so I no longer have issues with wrongfully assigned responses but still, this is something that bothers me. I wanted to point this – what I consider a weak point – out.