Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    Trying to connect to LTE-M1

    Scheduled Pinned Locked Moved FiPy
    lte-mkpnnot attaching
    17 Posts 8 Posters 3.7k Views 9 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • O Offline
      optionseven @ChielvDiepen
      last edited by optionseven

      @chielvdiepen are you certain the modem firmware running is CATM1-38638.dup?

      Here is my code:

      import socket
      import ssl
      import time
      from network import LTE
      
      def pretty(cmd):
          response = lte.send_at_cmd(cmd).split('\r\n')
          for line in response:
              print(line)
      
      lte = LTE()         # instantiate the LTE object
      
      print("Resetting modem:")
      pretty('AT^RESET')
      pretty('AT!="fsm"')
      time.sleep(5)
      # DL SYNCHRO STATISTICS
      pretty('AT!="showphy"')
      time.sleep(5)
      print("Turning off antenna:")
      pretty('AT+CFUN=0')
      time.sleep(5)
      print("Clearing scanning configuration:")
      pretty('AT!="clearscanconfig"')
      time.sleep(5)
      print("Adding scan frequency for band 20")
      pretty('AT!="RRC::addScanBand band=20"')
      pretty('AT!="disablelog 1"')
      time.sleep(5)
      print("Configure PDP Context 1:")
      pretty('AT+CGDCONT=1,"IP","ltem.webtrial.m2m"')
      time.sleep(5)
      print("Turning on modem")
      pretty('AT+CFUN=1')
      time.sleep(15)
      print("Registering manually to KPN network:")
      pretty('AT+COPS=1,2,"20408"')
      time.sleep(5)
      print("Checking which network the modem is registered to")
      pretty('AT+COPS?')
      time.sleep(5)
      
      # If correctly configured for carrier network, attach() should succeed.
      if not lte.isattached():
          print("Attaching to LTE network ", end='')
          lte.attach()
          while(True):
              if lte.isattached():
                  print(" OK")
                  break
              print('.', end='')
              time.sleep(1)
      
      # Once attached, connect() should succeed.
      if not lte.isconnected():
          print("Connecting on LTE network ", end='')
          lte.connect()
          while(True):
              if lte.isconnected():
                  print(" OK")
                  break
              print('.', end='')
              time.sleep(1)
      
      s = socket.socket()
      s = ssl.wrap_socket(s)
      s.connect(socket.getaddrinfo('www.google.com', 443)[0][-1])
      s.send(b"GET / HTTP/1.0\r\n\r\n")
      print(s.recv(4096))
      s.close()
      
      C 1 Reply Last reply Reply Quote 0
      • C Offline
        ChielvDiepen @optionseven
        last edited by

        @optionseven I tried your code, result below. And yes, i updated tot 1.18.1.R1 (latest) and installed the catm1.dup again. So i started with a fresh install.

        Configure PDP Context 1:
        
        OK
        
        Turning on modem
        
        OK
        
        
        +COPS: (2,"NL KPN","NL KPN","20408",7)(1,"vodafone NL","voda NL","20404",7),,(0,1,2,3,4),(0,1,2)
        
        OK
        
        Registering manually to KPN network:
        
        ERROR
        
        +CEREG: 2
        
        Checking which network the modem is registered to
        
        +COPS: 1
        
        OK
        
        Attaching to LTE network ..............
        

        Version of modem:

        SYSTEM VERSION

        FIRMWARE VERSION
        Bootloader0 : 5.1.1.0 [33080]
        Bootloader1* : 5.1.1.0 [38638]
        Bootloader2 : 5.1.1.0 [38638]
        NV Info : 1.1,0,0
        Software : 5.1.1.0 [38638] by robot-soft at 2018-08-20 09:51:46
        UE : 5.0.0.0d
        COMPONENTS
        ZSP0 : 1.0.99-13604
        ZSP1 : 1.0.99-12341

        1 Reply Last reply Reply Quote 0
        • M Offline
          marmarti
          last edited by marmarti

          Hi,

          After upgrading im no longer able to attach. Im not able to find a solution and also not able to find how to return to stock modem firmware.

          ###CODE
          from network import LTE
          lte = LTE(carrier="at&t")
          lte.attach(band=4)
          def pretty(cmd):
          response = lte.send_at_cmd(cmd).split('\r\n')
          for line in response:
          print(line)

          #Troubleshooting

          ###get the System FSM
          AT!="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              |ABSENT              |
          | HP SMS MO FSM            |IDLE                |
          | HP SMS MT FSM            |IDLE                |
          | HP CAT FSM               |NULL                |
          +--------------------------+--------------------+
          

          ###Fet the PHY status
          AT!="showphy"

          DL SYNCHRO STATISTICS

          Synchro state                         : DRX_SLEEP
          PPU SIB1 ACQ watchdog                 : 0
          Frequency Hypothesis RF  (Hz)         : 0
          RSRP (dBm)                            : -98.70
          RSRQ  (dB)                            : -13.89
          Channel estimation state (Cell-spec.) : LOW CINR
          Channel estimation state (UE-spec.)   : LOW CINR
          Channel estimation state (MBSFN)      : LOW CINR
          Channel estimation CINR               : 1.77
          Channel length                        : SHORT
          

          AGC
          AGC RX gain (dB) : 55.16
          RX PSD BO (dBFs) : -20.15
          RX PSD (dBm) : -101.62
          Noise level RS (dBm) : -101.98
          Digital gain (dB) : 9.87
          CINR RS (dB) : 3.28
          NARROWBANDS
          Last DL NB : Central
          Last UL NB : 0
          AFC
          Frequency offset RF (Hz) : -1323
          Frequency offset BB (Hz) : 0
          PBCH
          MIB received quantity : 14
          MIB timeout quantity : 0

          International Mobile Subscriber Identity

          AT+CIMI=?
          Error

          ###Signal quality
          AT+CSQ
          +CSQ: 15,99

          PDP Context

          AT+CGDCONT?
          +CGDCONT: 1,"IP","web.iusacellgsm.mx",,,,0,0,0,0,0,0

          ###Network Registration
          AT+CREG?
          +CREG: 0,0

          ###Software Version
          ATI1
          UE5.0.0.0d
          LR5.1.1.0-38638

          ###ATC Cell Monitoring
          #Supported values
          AT+SQNMONI=?
          #Report from all cells
          AT+SQNMONI=7
          +SQNMONI: TELCEL Cc:334 Nc:020 RSRP:-1 RSRQ:-1 TAC:23330 Id:235 EARFCN:2050 PWR:-1 PAGING:128
          +SQNMONI: TELCEL Cc:334 Nc:020 RSRP:-1 CINR:-1 RSRQ:-1 TAC:23330 Id:235 EARFCN:2050 PWR:-1 PAGING:128

          ###ICCID (card identification number) on the SIM card.
          AT+SQNCCID
          SQNCCID: "",""

          ###Conformance Test Mode
          AT+SQNCTM?
          +SQNCTM: standard

          1 Reply Last reply Reply Quote 0
          • E Offline
            Elfred
            last edited by

            I'am giving up.Tried everything to get my FiPy to work on the KPN network, but after several late evenings.....
            After upgrading the modem tot 39529 he won't run anything anymore.
            Sounds familiar ?
            Elfred

            W 1 Reply Last reply Reply Quote 0
            • W Offline
              wghirakawa @Elfred
              last edited by

              @elfred don't give up. I just got my FiPy working after a month of waiting. Come to find out it was a simple stupid mistake because of incorrect information in the docks. I was using lte.connect(cid=3), as per documentation when on Verizon's, network. This did not work for me. Until I changed to cid=1 and now it works without a hitch. Not sure why that is. I am currently using Verizon M2M Demo sim cards and have been working for the last several days. With some hiccups every now and then, due to power interruptions and server DNS errors.

              Here is the code I use to connect to verizon now.

              import socket
              import ssl
              import time
              from network import LTE
              import pycom
              pycom.heartbeat(False)
              debug = True
              
              def at(cmd):
                  ("modem command: {}".format(cmd))
                  response = lte.send_at_cmd(cmd).split('\r\n')
                  for line in response:
                      print(line)
              
              if (debug) : print('creating LTE object - carrier verizon')
              # lte = LTE()
              lte = LTE(carrier="verizon")
              pycom.rgbled(0x7f0000) #red to show LTE established
              # lte = LTE(carrier="at&t")         # instantiate the LTE object
              if (debug) : print('resetting modem, may take up to 5 secs...')
              if (debug) : print('attaching...')
              lte.attach()        # attach the cellular modem to a base station
              # lte.attach(band=13)        # attach the cellular modem to a base station
              
              while not lte.isattached():
                  if (debug) : print('waiting for isattached...')
                  time.sleep_ms(1000)
              pycom.rgbled(0x7f7f00) #yellow to show LTE attached
              if (debug) : print('connecting...')
              # lte.connect()       # start a data session and obtain an IP address
              lte.connect(cid=1)    # cid=3 for verizon - start a data session and obtain an IP address
              while not lte.isconnected():
                  if (debug) : print('waiting for isconnected...')
                  time.sleep_ms(500)
              pycom.rgbled(0x00007f) #blue to show LTE attached
              if (debug) : print('create socket')
              s = socket.socket()
              
              if (debug) : print("Connect to: www.ces-web.com")
              sockaddr = socket.getaddrinfo('www.google.com', 80)[0][-1]
              
              #print("Connect to: www.google.com")
              #s = ssl.wrap_socket(s)
              #sockaddr = socket.getaddrinfo('www.google.com', 443)[0][-1]
              
              if (debug) : print("socket address: {}".format(sockaddr))
              
              s.connect(socket.getaddrinfo('www.google.com', 80)[0][-1])
              pycom.rgbled(0x007f00) #green to show LTE attached
              if (debug) : print("send GET request")
              s.send(b"GET / HTTP/1.0\r\n\r\n")
              if (debug) : print("receive response")
              if (debug) : print(s.recv(16))
              s.close()
              if (debug) : print("socket closed")
              pycom.heartbeat(True)
              

              If everyone in the world could do their passion, the world would be an unbelievable place!

              E 1 Reply Last reply Reply Quote 1
              • E Offline
                Elfred @wghirakawa
                last edited by

                @wghirakawa Thanks for the encouragement. After a night sleep I picked it up again. Did a hard reset of the modem, uploaded the latest firmware again (CATM1-39529.dup) and got the equipment running again. But no, no attachment whatsoever. I think I have to dive into the firmware software.

                K 1 Reply Last reply Reply Quote 0
                • K Offline
                  kjm @Elfred
                  last edited by kjm

                  @elfred I had a gpy lte modem die on me. After trying everything I could think of I purchased another gpy and all good again. So weird because wifi, power consumption & all the other functionality still OK. For what it's worth a dead modem fingerprint looks like

                  SYSTEM FSM
                  ==========
                      +--------------------------+--------------------+
                      |            FSM           |        STATE       |
                      +--------------------------+--------------------+
                      | RRC TOP FSM              |STOPPED             |
                      | RRC SEARCH FSM           |NULL                |
                      | RRC ACTIVE FSM           |NULL                |
                      | PMM PLMN FSM             |NULL                |
                      | 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
                  

                  and

                  
                  DL SYNCHRO STATISTICS
                  =====================
                      Synchro state                         : OFF
                      PPU SIB1 ACQ watchdog                 : 0
                      Frequency Hypothesis RF  (Hz)         : 0
                      RSRP (dBm)                            : 0.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)                      : 0.00
                      RX PSD BO (dBFs)                      : 0.00
                      RX PSD (dBm)                          : 0.00
                      Noise level RS (dBm)                  : 0.00
                      Digital gain (dB)                     : 0.00
                      CINR RS (dB)                          : 0.00
                    NARROWBANDS
                      Last DL NB                            : 0
                      Last UL NB                            : 0
                    AFC
                      Frequency offset RF  (Hz)             : 0
                      Frequency offset BB  (Hz)             : 0
                    PBCH
                      MIB received quantity                 : 0
                      MIB timeout quantity                  : 0
                  

                  Have you checked your sim in another device to verify it's OK?

                  P E 2 Replies Last reply Reply Quote 0
                  • P Offline
                    Paul Thornton @kjm
                    last edited by

                    @kjm Sad to see you lost a board. Thanks for the fingerprint. That's actually quite usefull.

                    1 Reply Last reply Reply Quote 0
                    • E Offline
                      Elfred @kjm
                      last edited by Elfred

                      @kjm Thanks for the reply. Funny thing is that sometimes I get the fingerprint you've shown in you're post and the other time I get good result in terms of RSRP, RSRQ etc.
                      I'll check the SIM in an other device. Good thinking.
                      In the Jasper Wireless portal of KPN I can do a diagnostics test. That one failed. I've asked the question to KPN, but no answer yet.

                      Thanks again and lets make IoT really work

                      1 Reply Last reply Reply Quote 0
                      • E Offline
                        Elfred
                        last edited by

                        What I see in the FSM of @kjm is HP USIM FSM : Ready.
                        I See HP USIM FSM: Absent.

                        No wonder it's not working.
                        Can't figure out what's wrong.
                        Going back to KPN

                        1 Reply Last reply Reply Quote 0
                        • E Offline
                          Elfred
                          last edited by

                          Entlich mal. I've got connection. Got finally a new SIM from KPN and it worked immediately . Thanks all for the encouraging words:-)
                          Now I can start my project.
                          Keep you posted.

                          1 Reply Last reply Reply Quote 1

                          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                          With your input, this post could be even better 💗

                          Register Login
                          • 1 / 1
                          • First post
                            Last post

                          Pycom on Twitter

                          Pycom