How to send AT commands to modem once the connection is established?

7,037

As long as the device is used for ppp traffic, it is not possible to run AT commands at the same time1. For this reason all modern modems will provide more than one serial interfaces, e.g. /dev/ttyUSB0 and /dev/ttyUSB1 (or /dev/ttyACM0 and /dev/ttyACM1 for USB CDC modems on linux).

Back in the days when phones had RS-232 compatible connectors (perhaps with additional IrDA), 3GPP standardized a multiplexing protocol as 07.10 to overcome the physical limitation, although that required special drivers on the PC so it never took off. Today with USB's inherent multiplexing capabilities, there are no excuses for not providing multiple serial interfaces (usually there are only two though).

So as already mentioned in a comment, you should use the other serial device, e.g. /dev/ttyUSB1.


1 In theory it might be possible for the modem to support +++ escaping which would then allow you to run AT commands while the connection was ongoing, although then you would have to in some way modify the dialer program to inject those and extract the response...

Share:
7,037

Related videos on Youtube

Kumar
Author by

Kumar

Updated on September 18, 2022

Comments

  • Kumar
    Kumar almost 2 years

    I have a zte 3g modem. I use carrier provided dialer for connection establishment. Once the ppp connection is active, i would like to send some AT commands(for ex. Query signal strength, AT+CSQ). But the dialer i use locks the /dev/ttyUSB0 port, which is the command port to send AT commands for my modem. So is there any way, to send the commands, once the connection is active?


    Edit: I also tried the additional port /dev/ttyUSB1. But the port is flowing with random data from the modem. A sample is given below.

    T^PREFMODE??                                                                    
    ^PREFMODE:8                                                                     
    
    OK                                                                              
    TC                                                                              
    ^DSDORMANT:1                                                                    
    
    +CSQ:19, 99                                                                     
    
    OK                                                                              
    T^SYSINFO                                                                       
    ^SYSINFO:2,3,0,4,255                                                            
    
    OK                                                                              
    TT^SYSINFO?                                                                     
    ^SYSINFO:2,3,0,4,255  
    

    I tried adding my commands, i even got output. But the response is very poor. Most of the times, my AT commands went unnoticed.

    • wurtel
      wurtel about 9 years
      AFAIK there is also a /dev/ttyUSB1 device that you can use to query such things while the connection is established.
    • Kumar
      Kumar about 9 years
      @wurtel I tried accessing, but the port is flowing with some default data. See my edit.
  • Kumar
    Kumar about 9 years
    I tried /dev/ttyUSB1 as you said. But the port is busy with random data from the modem. I couldn't able to provide AT commands properly. see my edit.
  • Kumar
    Kumar about 9 years
    I changed my dialer to wvdial. Somehow it worked fine. Still i am getting random data, but the response to typed command was 100%. Thank you.