General LTE-M (Cat M1) connection problems thread



  • I cannot get my Gpy to attach. here are the details:

    • Country: Canada
    • Operator: Bell
    • Sim Card: nano LTE
    • APN: mnet.bell.ca.ioe

    can you help me figure out what is wrong with my code. I cannot get the attach() to work. here is the code I am using:

    print("reset modem")
    try:
        #at('AT^RESET')
        lte.reset()
    except:
        print("Exception during reset")
    
    def status():
        print("************")
        print("Status")
        print(lte.send_at_cmd("ATI"))
        print(lte.send_at_cmd('AT!="showphy"'))
        print(lte.send_at_cmd('AT!="fsm"'))
        print("************")
    
    # enable network registration and location information, unsolicited result code
    at('AT+CEREG=2')
    at('AT+CFUN=1')
    time.sleep(1.0)
    at('AT+CGDCONT=1,"IP","mnet.bell.ca.ioe"')
    at('AT+CGDCONT?')
    print("attempt to attach cell modem to base station...")
    at("ATI")
    time.sleep(2.0)
    
    i = 0
    while lte.isattached() == False:
        r = at('AT+CEREG?')
        r = at('AT+CSQ')
        i = i + 5
        print("not attached: {} secs".format(i))
        #status()
        time.sleep(2)
    print('LTE ATTACHED OK!')
    at('AT+CEREG?')
    at('AT+CGCONTRDP=?')
    print("connect: start a data session and obtain an IP address")
    try:
        print('CONNECTING ...')
        lte.connect(cid=1)
    except:
        print('CONNECTING ERROR')
        pass
    i = 0
    while not lte.isconnected():
        print("not connected after : {}".format(i))
        blink(GREEN, 2)
        time.sleep(1.0)
        i = i + 1
    delta = time.time() - t0
    print("connected after %s secs"%delta)```


  • @timh Thanks so much! Your code worked straight off. Thanks again.



  • @prawnhead - this is what I am using to connect. Sometime it takes a while but always seems to work. At least for the last 2 weeks it's been running. (I do also run a WDT).

    A couple of things to note. I found if I lost a connection or explicitly disconnected I had to reset the modem to reconnect reliably.

    Also you see that I wait for quite some time for a attach to succeed. Usually only 2-3 times through the loop but sometime up to 30-40 times.

    Also the result of isconnected once attached is not necessarily happening immediately after an attach, hence the second loop.

    def reset(lte=None):
      if not lte:
        lte = LTE()
      return lte.send_at_cmd('AT^RESET')
    
    def connect(doreset=True):
      if doreset:
        reset()
        time.sleep(1)
    
      lte = LTE()
      lte.send_at_cmd('AT+CGDCONT=1,"IP","telstra.internet"') 
      lte.send_at_cmd("AT!=\"RRC::addscanfreq band=28 dl-earfcn=9410\"")
      lte.send_at_cmd('AT+CFUN=1')
      print("Call attach")
      lte.attach()
      time.sleep(0.5)
      for i in range(100):
              print(lte.send_at_cmd("AT+CEREG?"))
              print (lte.isattached())
              if (lte.isattached()): 
                      lte.connect()
                      break
              time.sleep(1)
      c=0
      while not lte.isconnected():
          print('waiting for connection')    
          time.sleep(0.5)
          c=c+1
          if c > 5:
            break
    
      return lte```


  • Hey People, I too am having trouble getting a GPy to connect to Telstra (Australia) on Cat M1. I've tried every piece of code from documentation and the forum. My best result is below; I can get a response from +COPS intermittently which shows Telstra information. About half the time +COPS gives me a line of numbers with no mention of Telstra.

    GPy: (sysname='GPy', nodename='GPy', release='1.17.5.b5', version='v1.8.6-849-177b724c on 2018-05-12', machine='GPy with ESP32')
    SIM: Telstra nanoSIM from my working iPhone. iPhone reports 3 bars 4G coverage at my location.
    I'm running the GPy on an Expansion Board 2.0 with RTS & CTS jumpers open and the Pycom pad antenna.

    This thread has provided me the most useful information: https://forum.pycom.io/topic/2769/telstra-lte-cat-m-working-on-fipy-just

    Any assistance greatly appreciated! Chris.

    Current Code:

    import time
    import machine
    from network import LTE
    
    wait_time = 1
    
    def wait():
        print("Waiting {}".format(wait_time))
        time.sleep(wait_time)
    
    lte = LTE()
    
    print("Resetting ... ", end='')
    reply = lte.send_at_cmd('AT^RESET')
    print("DONE: {}".format(reply))
    wait()
    
    carrier = 'Telstra Mobile'
    
    def status():
        print("************")
        print("Status")
        print(lte.send_at_cmd("ATI"))
        print(lte.send_at_cmd('AT!="showphy"'))
        print(lte.send_at_cmd('AT!="fsm"'))
        print("************")
    
    def do(command, sleep_time):
        print("Sending: {}.".format(command))
        response = lte.send_at_cmd(command)
        print("Response: {}".format(response))
        wait()
        return response
    
    do('AT+CGDCONT=1,"IP","telstra.m2m"', 1)
    do('AT+CFUN=1', 1)
    do('AT!="addscanfreq band=28 dl-earfcn=9410"', 1) # in place of: lte.attach(band=28)
    
    print("Attaching: {}".format(lte.attach()))    # CMM: Latest test line
    wait()
    
    do('AT+COPS=?', 1)
    result = do('ATI', 1)
    
    if carrier in result:
        print()
        print("******************")
        print("* TELSTRA MOBILE *")
        print("******************")
    else:
        print("FAIL")
        print("Halted")
        while(True):
            machine.idle()
    
    
    # while(True):
    if lte.isattached():
        print("LTE attached")
    else:
        print("LTE not attached")
    
    if lte.isconnected():
        print("LTE connected")
    else:
        print("LTE not connected")
        # time.sleep(10)
    

    Results look like this:

    >>> Resetting ... DONE:
    OK
    
    +SHUTDOWN
    
    Waiting 1
    Sending: AT+CGDCONT=1,"IP","telstra.m2m".
    Response:
    OK
    
    +SYSSTART
    
    Waiting 1
    Sending: AT+CFUN=1.
    Response:
    OK
    
    Waiting 1
    Sending: AT!="addscanfreq band=28 dl-earfcn=9410".
    Response:
    
    OK
    
    Waiting 1
    Attaching: None
    Waiting 1
    Sending: AT+COPS=?.
    Response:
    Waiting 1
    Sending: ATI.
    Response:
    +COPS: (1,"Telstra Mobile","Telstra","50501",7),,(0,1,2,3,4),(0,1,2)
    
    OK
    
    +CEREG: 4
    
    Waiting 1
    
    ******************
    * TELSTRA MOBILE *
    ******************
    LTE not attached
    LTE not connected
    


  • Hi,

    My device keeps failing on the 'attach' call when I try to run the example found here:
    https://docs.pycom.io/chapter/tutorials/lte/cat_m1.html

    if, after attach(), I call:

    send_at_cmd_pretty('AT!="showphy"')
    send_at_cmd_pretty('AT!="fsm"')
    

    I get this:

    DL SYNCHRO STATISTICS
    =====================
        Synchro state                         : IDLE
        PPU SIB1 ACQ watchdog                 : 1
        Frequency Hypothesis RF  (Hz)         : -2000
        RSRP (dBm)                            : -21474836.00
        RSRQ  (dB)                            : 0.00
        Channel estimation state (Cell-spec.) : LOW CINR
        Channel estimation state (UE-spec.)   : LOW CINR
        Channel estimation state (MBSFN)      : LOW CINR
        Channel estimation CINR               : 0.00
        Channel length                        : SHORT
      AGC
        AGC RX gain (dB)                      : 60.31
        RX PSD BO (dBFs)                      : -22.39
        RX PSD (dBm)                          : -85.82
        Noise level RS (dBm)                  : -115.82
        Digital gain (dB)                     : 4.69
        CINR RS (dB)                          : 0.00
      NARROWBANDS
        Last DL NB                            : Central
        Last UL NB                            : 0
      AFC
        Frequency offset RF  (Hz)             : 0
        Frequency offset BB  (Hz)             : 0
      PBCH
        MIB received quantity                 : 91
        MIB timeout quantity                  : 0
    
    OK
    
    
    SYSTEM FSM
    ==========
        +--------------------------+--------------------+
        |            FSM           |        STATE       |
        +--------------------------+--------------------+
        | RRC TOP FSM              |SCANNING            |
        | RRC SEARCH FSM           |WAIT_CELL_ID        |
        | RRC ACTIVE FSM           |NULL                |
        | PMM PLMN FSM             |NORM_WAITCELL       |
        | EMM MAIN FSM             |NULL                |
        | EMM AUTH FSM             |KASME_DEFINED       |
        | EMM CONN FSM             |NULL                |
        | EMM TAU FSM              |NULL                |
        | EMM TEST FSM             |NULL                |
        | ESM BEARER FSM           |BEARER_NULL         |
        | SMS MT FSM               |IDLE                |
        | SMS MO FSM               |IDLE                |
        | HP MAIN FSM              |IDLE                |
        | HP USIM FSM              |READY               |
        | HP SMS MO FSM            |IDLE                |
        | HP SMS MT FSM            |IDLE                |
        | HP CAT FSM               |IDLE                |
        +--------------------------+--------------------+
    
    OK
    

    More details:
    Country = Belgium
    operator = hologram
    SIM card = it's an LTE cat M1 card, not certain what info you need for this?
    APN = hologram (no username, no pwd)

    also, I'm running firmware version 1.12.0.b0, on a gpy

    It's kind of frustrating as we were hoping to use this board in a project for a customer...



  • Getting similar situation here. I suspect my operator/network issues. They are still figuring out if they have Cat M1 at all ;)

    
    +CEREG: 4
    
    DL SYNCHRO STATISTICS
    =====================
        Synchro state                         : FAST SCAN
        PPU SIB1 ACQ watchdog                 : 0
        Frequency Hypothesis RF  (Hz)         : 6000
        RSRP (dBm)                            : -21474836.00
        RSRQ  (dB)                            : 0.00
        Channel estimation state (Cell-spec.) : LOW CINR
        Channel estimation state (UE-spec.)   : LOW CINR
        Channel estimation state (MBSFN)      : LOW CINR
        Channel estimation CINR               : 0.00
        Channel length                        : SHORT
      AGC
        AGC RX gain (dB)                      : 28.66
        RX PSD BO (dBFs)                      : -22.51
        RX PSD (dBm)                          : -85.31
        Noise level RS (dBm)                  : -115.31
        Digital gain (dB)                     : 1.34
        CINR RS (dB)                          : 0.00
      NARROWBANDS
        Last DL NB                            : Central
        Last UL NB                            : 0
      AFC
        Frequency offset RF  (Hz)             : 0
        Frequency offset BB  (Hz)             : 0
      PBCH
        MIB received quantity                 : 0
        MIB timeout quantity                  : 0
    
    OK
    
    SYSTEM FSM
    ==========
        +--------------------------+--------------------+
        |            FSM           |        STATE       |
        +--------------------------+--------------------+
        | RRC TOP FSM              |INITIAL             |
        | RRC SEARCH FSM           |INITIAL             |
        | RRC ACTIVE FSM           |NULL                |
        | PMM PLMN FSM             |PARKING             |
        | EMM MAIN FSM             |NULL                |
        | EMM AUTH FSM             |NULL                |
        | EMM CONN FSM             |NULL                |
        | EMM TAU FSM              |NULL                |
        | EMM TEST FSM             |NULL                |
        | ESM BEARER FSM           |BEARER_NULL         |
        | SMS MT FSM               |IDLE                |
        | SMS MO FSM               |IDLE                |
        | HP MAIN FSM              |IDLE                |
        | HP USIM FSM              |READY               |
        | HP SMS MO FSM            |IDLE                |
        | HP SMS MT FSM            |IDLE                |
        | HP CAT FSM               |IDLE                |
        +--------------------------+--------------------+
    
    
    +CEREG: 2,4
    
    OK
    
    


Pycom on Twitter