Trying to connect to LTE-M1



  • I am trying to connect to the local KPN network. I found two networks in my area on band 20. KPN and Vodafone. I have a KPN-sim, so i tried to set the code to KPN with AT+COPS:2 etc. But when i try lte.isattach() it constantly give False. I tried to force register to a network with 'AT+COPS=1,2,"20408"' but this gives an error. Also the forced network disappears from the found networks in the erea. As far as i know KPN network is supported, it is also listed in 'AT+COPN'. The output can be find in the comments. I have tried waiting for 5-10 min with a while loop after the attach, but still no attaching happening.

    Who could help me out, to connect?

    from network import LTE
    import pycom
    import time
    
    lte = LTE()
    
    def send_at_cmd_pretty(cmd):
        response = lte.send_at_cmd(cmd).split('\r\n')
        for line in response:
            print(line)
    
    
    print("LTE-M1 procedure")
    #print("NB-IoT procedure")
    #send_at_cmd_pretty('ATZ') # Reset to default config
    #send_at_cmd_pretty('AT&F') # Reset to factory config
    #time.sleep(5)
    
    print("Resetting to factory config...", end='')
    send_at_cmd_pretty('AT^RESET') # Hard reset
    time.sleep(5)
    
    print("FSM status 1 ", end='')
    send_at_cmd_pretty('AT!="fsm"') # OK
    time.sleep(5)
    
    print('Status 1:')
    send_at_cmd_pretty('AT!="showphy"') # OK
    time.sleep(5)
    
    print("RF off mode / Low power... ", end='')
    send_at_cmd_pretty('AT+CFUN=0') # OK
    time.sleep(5)
    
    print("Clear scan configuration...", end='')
    send_at_cmd_pretty('AT!="clearscanconfig"') # OK
    time.sleep(5)
    
    print("Add band 20 to scan...", end='')
    send_at_cmd_pretty('AT!="addscanband band=20"') # OK
    time.sleep(5)
    
    print("Disable log 1....", end='')
    send_at_cmd_pretty('AT!="disablelog 1"') # OK
    time.sleep(5)
    
    print("Config of the LTE APN...", end='')
    send_at_cmd_pretty('AT+CGDCONT=1,"IP","item.internet.m2m"') # OK 
    #send_at_cmd_pretty('AT+CGDCONT=1,"IP","Item.webtrail.m2m"')  
    #send_at_cmd_pretty('AT+CGDCONT=1,"IP","Internet.m2m"') 
    #send_at_cmd_pretty('AT+CGDCONT=1,"IP","M2MC.WEBTRAIL"') 
    time.sleep(5)
    
    #print("Instellen van NB-IoT APN...", end='')
    #send_at_cmd_pretty('AT+CGDCONT=1,"IP","c.dpiot.t-mobile.nl"')
    #time.sleep(5)
    
    print("Add scanfreq band en dl-earfcn...", end='')
    send_at_cmd_pretty('AT!="RRC::addscanfreq band=20 dl-earfcn=6300"') # scan band 20/6240 of band 8/3650 of band 28/9410
    time.sleep(5)
    
    print("Turn module to full functionality...", end='')
    send_at_cmd_pretty('AT+CFUN=1') # OK
    print("wait 30 sec")
    time.sleep(5)
    print("wait 25 sec")
    time.sleep(5)
    print("wait 20 sec")
    time.sleep(5)
    print("wait 15 sec")
    time.sleep(5)
    print("wait 10 sec")
    time.sleep(5)
    print("wait  5 sec")
    time.sleep(5)
    
    print("FSM status 2 ", end='')
    send_at_cmd_pretty('AT!="fsm"') # OK
    time.sleep(5)
    
    print("Show list with networks...", end='')
    send_at_cmd_pretty('AT+COPS=?') # +COPS: (2,"NL KPN","NL KPN","20408",7)(1,"vodafone NL","voda NL","20404",7),,(0,1,2,3,4),(0,1,2)
    print("wait 30 sec")
    time.sleep(5)
    print("wait 25 sec")
    time.sleep(5)
    print("wait 20 sec")
    time.sleep(5)
    print("wait 15 sec")
    time.sleep(5)
    print("wait 10 sec")
    time.sleep(5)
    print("wait  5 sec")
    time.sleep(5)
    
    print("Current network...", end='') 
    send_at_cmd_pretty('AT+COPS?') #  +COPS: 1 
    time.sleep(5)
    
    print("Config to network 2: KPN", end='') # i want +COPS: 2 KPN
    send_at_cmd_pretty('AT+COPS=2') 
    time.sleep(5)
    
    print("Current network...", end='')
    send_at_cmd_pretty('AT+COPS?') #  +COPS: 2
    time.sleep(5)
    
    print("LTE attach functie... ", end='')
    lte.attach(band=20) # poging tot verbinden, soms nodig, doet iets intern, beetje vaag
    print("OK")
    print("wait 30 sec")
    time.sleep(5)
    print("wait 25 sec")
    time.sleep(5)
    print("wait 20 sec")
    time.sleep(5)
    print("wait 15 sec")
    time.sleep(5)
    print("wait 10 sec")
    time.sleep(5)
    print("wait  5 sec")
    time.sleep(5)
    
    print("Error report...", end='')
    send_at_cmd_pretty('AT+CEER') # +CEER: lastEmmCause: NO CAUSE RECEIVED, lastEsmCause: NO CAUSE RECEIVED
    time.sleep(5)
    
    print('Status 2:')
    send_at_cmd_pretty('AT!="showphy"') # OK
    time.sleep(5)
    
    print("FSM status 3 ", end='')
    send_at_cmd_pretty('AT!="fsm"') # OK
    time.sleep(5)
    
    print("Force register to network...", end='') # ERROR, also the forced network disappears from list
    #send_at_cmd_pretty('AT+COPS=1,2,"20408"') # force select and register network, connect with KPN
    #send_at_cmd_pretty('AT+COPS=1,2,"20416"') # force select and register network, connect with T-Mobile
    print("wacht 30 sec")
    time.sleep(5)
    print("wacht 25 sec")
    time.sleep(5)
    print("wacht 20 sec")
    time.sleep(5)
    print("wacht 15 sec")
    time.sleep(5)
    print("wacht 10 sec")
    time.sleep(5)
    print("wacht  5 sec")
    time.sleep(5)
    
    print("FSM status 4 ", end='')
    send_at_cmd_pretty('AT!="fsm"') # OK
    time.sleep(5)
    
    print("Check signal strength...", end='')
    send_at_cmd_pretty('AT+CSQ') # +CSQ: 24,99 OK
    time.sleep(5)
    
    print("Connected?...", end='') # +CGATT: 0
    send_at_cmd_pretty('AT+CGATT?')
    time.sleep(5)
    
    print("Show IP adres:...", end='') 
    send_at_cmd_pretty('AT+CGPADDR') # +CGPADDR: 1   +CGPADDR: 2
    time.sleep(5)
    
    print('Status 3:')
    send_at_cmd_pretty('AT!="showphy"') # OK
    time.sleep(5)
    
    print("FSM status 5 ", end='')
    send_at_cmd_pretty('AT!="fsm"') # OK
    time.sleep(5)
    
    #lte.deinit()
    print('Finished')
    
    #send_at_cmd_pretty('AT+COPN') # List operators names
    # LTE/NB: +COPN: "20408","NL KPN"
    #               "20416","T-Mobile" 
    
    


  • @robert-hh unfortunately the new software version is not working, but still thank you for the quick reply.



  • This is my output of SHOWPHY:

    DL SYNCHRO STATISTICS
    =====================
        Synchro state                         : DRX_SLEEP
        PPU SIB1 ACQ watchdog                 : 0
        Frequency Hypothesis RF  (Hz)         : 0
        RSRP (dBm)                            : -76.29
        RSRQ  (dB)                            : -7.05
        Channel estimation state (Cell-spec.) : HIGH CINR
        Channel estimation state (UE-spec.)   : LOW CINR
        Channel estimation state (MBSFN)      : LOW CINR
        Channel estimation CINR               : 28.63
        Channel length                        : SHORT
      AGC
        AGC RX gain (dB)                      : 38.58
        RX PSD BO (dBFs)                      : -22.12
        RX PSD (dBm)                          : -80.21
        Noise level RS (dBm)                  : -100.75
        Digital gain (dB)                     : 5.04
        CINR RS (dB)                          : 24.46
      NARROWBANDS
        Last DL NB                            : Central
        Last UL NB                            : 0
      AFC
        Frequency offset RF  (Hz)             : -362
        Frequency offset BB  (Hz)             : 0
      PBCH
        MIB received quantity                 : 91
        MIB timeout quantity                  : 0
    
    OK
    

    And FSM:

    SYSTEM FSM
    ==========
        +--------------------------+--------------------+
        |            FSM           |        STATE       |
        +--------------------------+--------------------+
        | RRC TOP FSM              |CAMPED              |
        | RRC SEARCH FSM           |CAMPED_ANY          |
        | RRC ACTIVE FSM           |IDLE                |
        | PMM PLMN FSM             |ANY_CAMPED          |
        | 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                |
        +--------------------------+--------------------+
    
    OK
    


  • @chielvdiepen There is a problem in the lte.attach() API. @xykon adresses this in a trial firmware build at http://beta.pycom.io/nbiot-xykon/
    Please download and install that (install from file). It may fix you problem.
    See also this thread around https://forum.pycom.io/topic/3549/important-update-regarding-lte-modem-updates/83 and


 

Pycom on Twitter