AT parser

Go To Last Post
3 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm developing a software that manages a GSM modem (actually it's a SIM900 from SimCom).

So I need to implement an AT parser. At first it appears a simple thing to do: the host microcontroller sends an AT command and waits for an answer usually ending with OK or something similar (ERROR, NO CARRIER, NO DIALTONE, ...).

The problem arises with unsolicited result codes (URC) that are asyncronous messages transmitted from the modem at any time (such as messages that signals the arrival of an incoming SMS or a RING).
I discovered those messages can be concatenated to the answer of a previous AT command: the first character of the URC could appear immediately after the last character of the answer of a previous AT command.

I know the application layer can break the incoming stream of characters from modem into messages, parsing the content, knowing all the possible expected answers and URC.

Anyway I think this is complicated so I'm thinking of a low-level (driver level) mechanism that is sufficiently generic.

I tried to search for something similar, but without success. Any suggestions?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Finite State Machine works well for that sort of thing.

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

State Machine - absolutely :!:

aka FSM, Finite State Automaton.

Here's a good article on FSMs:

http://www.visualgps.net/WhitePapers/NMEAParser/NMEAParser.html

The specific example is an NMEA parser (for GPS) - but the principles are general.

You should study V.250 - the ITU standard which formalises the so-call "AT Command" structure.

http://www.itu.int/rec/T-REC-V.250/en

http://en.wikipedia.org/wiki/Hayes_command_set#V.250

http://en.wikibooks.org/wiki/Serial_Programming/Modems_and_AT_Commands