SMS Receiving and Module Restarts

I am new to Open AT platform and I am on Q2501B. I have a strange problem. Briefly, this is what I have in side the application

  1. One Timer that timeout every 20 seconds
  2. One Timer that timeout every 3 minutes
  3. I have subscribed to Flash (Chances for a flash write is once in every 30 mins) and writing is very occasional.
  4. I have Subscribed to 3 GPIOs and state change in the GPIOs are also very occasional.
  5. I have subscribed to SMS.

The problem I have is that randomly the modules resets (OpenAT application crash) when the SMS callback handler is called. Usually it happens on the reception second long SMS. When small SMS are sent, it still happens, but may be on the 3rd SMS.

Following is my code

bool SMSHandler(ascii *SmsTel, ascii SmsTimeOrLength, ascii SmsText)
{
s8 smsSendHnd;
u8
result[22];
u8
dataext[2];

adl_atSendResponse ( ADL_AT_UNS, "\r\nSMS is received...\r\nThe text is below...\r\n" );
adl_atSendResponse ( ADL_AT_UNS, SmsText );
adl_atSendResponse ( ADL_AT_UNS, "\r\n" );




< I do some parsing and some business logic applied here.>


adl_memRelease(result);
adl_memRelease(dataext);
adl_memRelease(SmsText);
return FALSE;

}

I would greatly appreciate the help.

Rgds
Green

Hi,
I can’t see any hint in the documentation about the necessity to release the pointer ‘SmsText’. Try without releasing. This pointer is owned by OpenAt , it will care for this pointer by itself.
If you need to keep the content, copy it, it will become invalid after the call.

cheers
Philipp

Thanks Philipp. I have tried it without the release for SMSText and still it happens.

Rgds
Green

Hi Green,

how do you use the variables result and dataext in your program? You defined an array of pointers, and I guess that’s not what you intended to do… If you use them as unsigned character arrays on the stack, you do not need to do a memget and certainaly you should not release them with adl_memRelease(result); and
adl_memRelease(dataext);

Best Regards,
Jan

Hi Jan,

I will try removing it.

Here is what I do. I use the array of pointers to split the string based on a delimiter. This is basically used to send a command to the unit to perform an operation.

Like an SMS “,,,_;”

So, what I do is

u32 length;

length = split( SmsText, “,”, result );




if ( is something)
{
split( result[3], “;”, dataext );
wm_strcpy( strval1, dataext[0] );
wm_strcpy( strval2, dataext[1] );
}


Now, I will remove it and try it. Kindly give me your thoughts about the above steps.

Rgds
Green

Hi Green,

OK, so you really use an array of pointers… In that case you must get memory for each of the pointers of course before you can use them, and you should release the memory of each of them again… (I don’t know the split function, but you certainly can not release memory with adl_memRelease(result); I guess that should rather be adl_memRelease(result[0]); adl_memRelease(result[1]); adl_memRelease(result[2]); …)

Best Regards,
Jan

Hello Green,

If you are using OS 6.55 or greater you should get an ADL_ERR_MEM_RELEASE error, if the memory release failed.
You can use the Errors managment api to handle these events. Or at least you can put a trace, so you can see what caused the exception.
See the section 3.9 in the ADL guide.

These “known bugs” i know :slight_smile: about SMS related resets:

  1. OS older 6.55 may reset if an sms with empty string received if ADL sms api is used.

  2. OS 6.60 may reset if external appli sends AT commands during the phase of receiving SMS

In your case these problems are probably not the cause. (especially the 2. )

Best Regards,

tom

Hi Guys,

Thanks everyone for the help.

Getting rid of some pointer arrays have solved the problem to a greater extend, though not fully. Memory management is little bit complicated and also bit hard to understand.

I greatly appreciate the support from the forum.

Rgds
Green