Fipy + Pytrack v1.18.1.r4 + SNQNS Firmware CATM1-39592 - Verizon Socket Connection OSERROR:-1



  • Been trying this for several days, even reset SQNS Modem back to factory settings using at command to make sure that there are no issues. I am able to get ipaddress using the socket.getaddrinfo() function but, as far as connecting to the socket using the return addrinfo, i get an OSERROR:-1. Below is the code I am attempting to execute.

    import socket
    import ssl
    import time
    from network import LTE
    
    print('creating LTE object - carrier verizon')
    # lte = LTE()
    lte = LTE(carrier="verizon")
    # lte = LTE(carrier="at&t")         # instantiate the LTE object
    print('resetting modem, may take up to 5 secs...')
    lte.reset()
    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():
        print('waiting for isattached...')
        time.sleep_ms(1000)
    
    print('connecting...')
    # lte.connect()       # start a data session and obtain an IP address
    lte.connect(cid=3)    # cid=3 for verizon - start a data session and obtain an IP address
    while not lte.isconnected():
        print('waiting for isconnected...')
        time.sleep_ms(500)
    
    print('create socket')
    s = socket.socket()
    
    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]
    
    print("socket address: {}".format(sockaddr))
    
    s.connect(sockaddr)
    print("send GET request")
    s.send(b"GET / HTTP/1.0\r\n\r\n")
    print("receive response")
    print(s.recv(16))
    s.close()
    print("socket closed")
    lte.disconnect()
    print("disconnected")
    lte.dettach()
    print("dettached")
    lte.deinit()
    print("deinit")
    
    

    The response I get when executing s.connect() is as follows.

    Traceback (most recent call last):
      File "<stdin>", line 38, in <module>
    OSError: -1
    

    Need help please! @Xykon & @rskoniec



  • @wghirakawa
    The code seems to be ok. I don't have access to Cat M1 network (only NB-IoT available here) so I cannot test with the same Sequans firmware.

    Are you able to perform communication on the same APN and with the same SIM using different hardware?

    @iwahdan could you please take a look?



  • @danielm r6 pre-release Did not work either. Please see code and output below.

    import socket
    import ssl
    import time
    from network import LTE
    
    print('creating LTE object - carrier verizon')
    # lte = LTE()
    lte = LTE(carrier="verizon")
    # lte = LTE(carrier="at&t")         # instantiate the LTE object
    print('resetting modem, may take up to 5 secs...')
    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():
        print('waiting for isattached...')
        time.sleep_ms(1000)
    
    print('connecting...')
    # lte.connect()       # start a data session and obtain an IP address
    lte.connect(cid=3)    # cid=3 for verizon - start a data session and obtain an IP address
    while not lte.isconnected():
        print('waiting for isconnected...')
        time.sleep_ms(500)
    
    print('create socket')
    s = socket.socket()
    
    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]
    
    print("socket address: {}".format(sockaddr))
    
    s.connect(sockaddr)
    print("send GET request")
    s.send(b"GET / HTTP/1.0\r\n\r\n")
    print("receive response")
    print(s.recv(16))
    s.close()
    print("socket closed")
    lte.disconnect()
    print("disconnected")
    lte.dettach()
    print("dettached")
    lte.deinit()
    print("deinit")
    
    >>> import os
    >>> os.uname
    <function>
    >>> os.uname()
    (sysname='FiPy', nodename='FiPy', release='1.18.1.r6', version='v1.8.6-849-a8966d1 on 2018-11-23', machine='FiPy with ESP32', lorawan='1.0.2', sigfox='1.0.1')
    >>> Running test.py
    
    >>>
    >>>
    creating LTE object - carrier verizon
    resetting modem, may take up to 5 secs...
    attaching...
    waiting for isattached...
    waiting for isattached...
    waiting for isattached...
    waiting for isattached...
    waiting for isattached...
    waiting for isattached...
    waiting for isattached...
    waiting for isattached...
    waiting for isattached...
    waiting for isattached...
    connecting...
    create socket
    Connect to: www.ces-web.com
    socket address: ('172.217.164.100', 80)
    Traceback (most recent call last):
      File "<stdin>", line 39, in <module>
    OSError: -1
    >
    Pycom MicroPython 1.18.1.r6 [v1.8.6-849-a8966d1] on 2018-11-23; FiPy with ESP32
    Type "help()" for more information.
    >>>
    >>> import sqnsupgrade
    >>> sqnsupgrade.
    reconnect_uart  crc             LTE             __name__
    VERSION         UART            uart            detect_error
    info            sqnsupgrade     struct          time
    SD              sys             os              sysname
    run             print_welcome   release         stp
    >>> sqnsupgrade.VERSION
    '1.2.0'
    >>> sqnsupgrade.info()
    <<< Welcome to the SQN3330 firmware updater [1.2.0] >>>
    >>> FiPy with firmware version 1.18.1.r6
    Your modem is in application mode. Here is the current version:
    UE5.0.0.0d
    LR5.1.1.0-39529```


  • @wghirakawa
    It is a pre-release which is available for download here:
    https://github.com/pycom/pycom-micropython-sigfox/releases/tag/v1.18.1.r6



  • @danielm where can I find r6. I tried doing the development version via the pycom firmware updater and it only download b5.



  • Will try with r6. Thanks @danielm



  • Try it with 1.18.1.r6.


 

Pycom on Twitter