sending AT comands while modem is in a data state

  • Hi, could you help me on this problem?

    I am working on a project with the GPy and my client needs to have the LTE signal strength sent back to them.

    I keep getting this error when I send the AT command for that. My LTE modem is of course on and connected, and I need to check the signal strength.

    >>>LTE modem is in data state, cannot send AT commands

    Here on the Pycom documentation it states that

    lte.send_at_cmd(cmd, delay=10000)

    "Sends an AT command directly to the modem. Returns the raw response from the modem as a string object. IMPORTANT: If a data session is active (i.e. the modem is connected), sending the AT commands requires to pause and then resume the data session. This is all done automatically, but makes the whole request take around 2.5 seconds."

    I have two issues. It doesn't say on that page as far as I can see, how to manually pause the data-state, and secondly, I keep getting the above mentioned error while doing the following code.

    In my code I created an lte object, connect with the cellular network, do some web requests, and then I try this line.

    # this is the function I'm calling. 
    def lteStrength(self):
            if self.lte.isconnected():
                if self.lte.isattached():
                    return self.lte.send_at_cmd("AT+CSQ", delay=10000) # tried without delay too.
                print("Error. LTE Strength is unknown. LTE is not attached or connected.")

    I get this error every time.

    >>>LTE modem is in data state, cannot send AT commands

  • @rskoniec thank you so much! I will try that out. That's a good thread.

    As far as the firmware, I need to double check, but I believe for both I'm using the most updated stable release version.

  • @mattliddle Check lte.pppsuspend() before lte.send_at_cmd and lte.pppresume() after lte.send_at_cmd. Also check this thread. Btw, which GPy f/w and modem f/w are you running on?

Log in to reply

Pycom on Twitter