Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

End of response to an AT command

How to be sure what is end of an AT command send to GSM module?

I need some character or string that represent end of AT command for every case due to finding when whole response is received.

I guess it have something with "\r\n" sequence but, this sequence could be at the beginning of AT command response?

like image 553
viktor.radovic Avatar asked Oct 29 '25 08:10

viktor.radovic


2 Answers

Like you suppose it's \r\n.
This defines the end of a line.

And it makes only sense to process complete lines.

Some commands respond only with OK\r\n, others with some data.
So you should first build a parser that can recognize complete lines, so that they can be processed by a function that can handle the responses.
Sometimes you can get even responses you don't request, like change events net login or the sim status #QSS: 2\r\n.

So you need to know what answer you expect and wait until you get this

like image 53
jeb Avatar answered Oct 31 '25 00:10

jeb


Depending on mode and command I.e.

<CR> or <CR><LF>

http://www.3gpp.org/ftp/Specs/html-info/27007.htm

like image 43
Morpfh Avatar answered Oct 31 '25 00:10

Morpfh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!