Modem AT commands from C

Home Forums MultiConnect OCG Modem AT commands from C

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #2837
    Jim Hansen
    Participant

    I want to get the result of AT command in a C program.

    I open /dev/ttyUSB3 or 5 (on an H4 radio) and sets the serial port to 230400, 8N1, send an AT command and read a response. I don’t get any errors, but I get no output or “nERRORnn” back.

    Is there another way to get an AT command’s response? Microcom has some issue with stdout, I hear.

    Or, how do I know the port settings to use the port directly?

    #4324
    Bryan Tran
    Moderator

    Hi Jim,

    1. The correct port for the H4 is: /dev/ttyUSB3 and /dev/ttyUSB4.

    http://www.multitech.net/developer/products/multiconnect-ocg/hardware/multiconnect-ocg-d/accessing-hardware-interfaces/

    2. As a test, would you please ssh into the CDP device and issue the following command:

    microcom /dev/ttyUSB3 -s 115200[Enter]

    AT[Enter]

    Do you get any response ?

    *Note: If you do not see what you are typing, try: ATE1[Enter]

    If you do get response on the above command, then it likely there is something in your C program.

    Regards,

    BT

    #4325
    Jim Hansen
    Participant

    I did get a response:

    “ERROR”

    then another AT command and “OK”

    I assume that something’s wrong with the code/port setup. I intermittently get “ERROR” or 0 bytes.

    How do I know the correct settings for this port?

    Is it documented?

    I’m now using 115200 baud.

    #4326
    Bryan Tran
    Moderator

    Hi Jim,

    Would you pls reboot your CDP and then ssh back into your CDP and type the following commands, post your output.

    microcom /dev/ttyUSB3[Enter]

    AT[Enter]

    ATI[Enter]

    AT+CSQ[Enter]

    AT+CREG?[Enter]

    AT+CPIN?[Enter]

    I am not very sure why you would get an “Error” message response after typed in AT[enter].

    The USB port will ignored the serial baud rate settings.

    Regards,

    BT

    #4327
    Jim Hansen
    Participant

    Hi,

    After reboot, get the expected output

    OK

    Manufacturer: Sierra Wireless, Incorporated

    Model: MC8790V

    Revision: K2_0_7_24BAP C:/WS/FW/K2_0_7_24BAP/MSM6290/SRC 2010/02/09 00:19:18

    IMEI: 012376000067082

    IMEI SV: 15

    FSN: C681542057310

    3GPP Release 5

    +GCAP: +CGSM,+DS,+ES

    OK

    +CSQ: 1,99

    OK

    etc.

    After I run my program, I do this again and the first time AT returns ERROR, then its ok.

    If USB doesn’t need baud rate, are there other settings it does or doesn’t need? My code looks a lot like the termios part of

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

    Jim

    #4328
    Bryan Tran
    Moderator

    Hi Jim,

    Take a look at this sms-utils code and may by take out the serial port part http://git.multitech.net/cgi-bin/cgit.cgi.

    Regards,

    BT

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.