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

    Vodafone SIM in Spain not working [solved, wrong DNS sever]

    Scheduled Pinned Locked Moved Discussion
    13 Posts 3 Posters 146 Views 3 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.
    • C Offline
      claus
      last edited by Gijs

      Hi all,
      I am sorry to bother again, but I am stuck with LTE. I am trying to get going with the Vodafone SIM in my FiPy in Spain. I first activated the SIM in pybytes and then used the provisioning process hoping Pybytes would just start the connection. The process hangs during "attach". I then used the script as found at https://docs.pycom.io/tutorials/networks/lte/ which gives more details about the state and looking at the output of print(lte.send_at_cmd('AT!="fsm"')) I find that RRC_TOP_FSM goes from
      CAMPED ->SCANNING(WAIT_RSSI)->SCANNING(WAIT_CELL_ID)->SYNCING(WAIT_SYNC)->SYNCING(WAIT_SCAN_DELAY)->SYNCING(WAIT_SYNC)->CAMPED
      This happens again and again. The tutorial says "If the system returns multiple times from SYNCING to CAMPED, check the network availability, simcard placement and / or the firmware version". I checked simcard placement and firmware version is the latest (1.20.2.r1). So no network availability? The FAQ about the Vodafone SIM says "ok" for Spain.

      Any help greatly appreciated!

      1 Reply Last reply Reply Quote 0
      • C Offline
        claus
        last edited by

        OK, so I got a few steps further. The FiPy comes with a CAT-M1 LTE firmware and the Vodafone card needs the NB-IoT firmware (see https://docs.pycom.io/updatefirmware/ltemodem/). It would have been nice to include this in the docs for the Vodafone cards (https://docs.pycom.io/cellularservices/vodafone/) it has taken me quite some time to it find out. I now have provisioned pybytes with the new network settings, and LTE connects, but I don't seem to get a pybytes connection:

        Attempting to connect with network lte
        Initialized watchdog for WiFi and LTE connection with timeout 1260000 ms
        LTE init(carrier=None, cid=1)
        LTE attach(band=20, apn=pycom.io, type=IP)
        LTE connect()
        LTE is_connected()
        LTE connection established
        connect_lte with start_mqtt is now removed please call communication_protocol or start_mqtt directly
        MQTT Protocol
        Socket create error: [Errno 202] EAI_FAIL
        This is PybytesProtocol.start_MQTT
        Socket send error [Errno 128] ENOTCONN
        Socket create error: [Errno 202] EAI_FAIL
        Socket create error: [Errno 202] EAI_FAIL
        Socket create error: [Errno 202] EAI_FAIL
        Connected to MQTT mqtt.pybytes.pycom.io
        Pybytes connected successfully (using the built-in pybytes library)
        This is pack_info_message()
        __pack_message: b'310504a00581000000'
        MQTT Protocol
        Socket create error: [Errno 202] EAI_FAIL
        Socket create error: [Errno 202] EAI_FAIL
        Socket create error: [Errno 202] EAI_FAIL
        ...
        

        The last message repeats and repeats. My LTE config is

        'lte': {'apn': 'pycom.io', 'cid': 1, 'reset': False, 'carrier': 'standard', 'band': 20, 'type': 'IP'}
        

        Not sure where to go now....

        1 Reply Last reply Reply Quote 0
        • G Offline
          Gijs
          last edited by

          Are you able to make a manual LTE connection using the LTE module like so:

          from network import LTE
          import time
          import socket
          
          lte = LTE()
          lte.init()
          #some carriers have special requirements, check print(lte.send_at_cmd("AT+SQNCTM=?")) to see if your carrier is listed.
          #when using verizon, use 
          #lte.init(carrier=verizon)
          #when usint AT&T use, 
          #lte.init(carrier=at&t)
          
          #some carriers do not require an APN
          #also, check the band settings with your carrier
          lte.attach(band=20, apn="pycom.io") 
          print("attaching..",end='')
          while not lte.isattached()
              time.delay(0.25)
          
              print('.',end='')
              print(lte.send_at_cmd('AT!="fsm"'))         # get the System FSM
          print("attached!")
          
          lte.connect()
          print("connecting [##",end='')
          while not lte.isconnected():
              time.sleep(0.25)
              print('#',end='')
              #print(lte.send_at_cmd('AT!="showphy"'))
              print(lte.send_at_cmd('AT!="fsm"'))
          print("] connected!")
          
          print(socket.getaddrinfo('pycom.io', 80))  
          lte.deinit()
          #now we can safely machine.deepsleep()
          

          Let me know!
          (btw, I think this topic could be related to the issue you are having: https://forum.pycom.io/topic/6350/error-while-connecting-pybytes-with-lte), we solved it in the end by using:

          >>> lte.connect()
          >>> import socket
          >>> socket.getaddrinfo('www.pycom.io', 80)
          [(2, 1, 0, '', ('18.195.176.111', 80))]
          >>> socket.dnsserver()
          ('172.31.16.100', '172.31.32.100')
          >>> 
          

          Before enabling pybytes

          from _pybytes import Pybytes
          ...
          
          C G 2 Replies Last reply Reply Quote 2
          • C Offline
            claus @Gijs
            last edited by

            GREAT!! Thanks a lot, it is working!

            1 Reply Last reply Reply Quote 0
            • G Offline
              Guillermo del Campo @Gijs
              last edited by

              @Gijs Hello Gijs! I'm having a similar issue and I don't know what else to try.

              I have a Vodafone SIM bought from pycom, but I am not able at all to connect to Pybytes using LTE. If I do it via WiFi, everything works as expected.

              This is mi pybytes_config.json file:

              {"wifi": {"ssid": "", "password": ""}, "wlan_antenna": 0, "dump_ca": false, "server": "mqtt.pybytes.pycom.io", "ssl": false, "lte": {"apn": "pycom.io", "cid": 1, "reset": false, "carrier": "standard", "band": 20, "type": "IP"}, "device_id": "xxxx", "network_preferences": ["lte"], "ota_server": {"port": 443, "domain": "software.pycom.io"}, "pybytes_autostart": false, "username": "xxxx"}
              
              

              When I try to connect, it certainly says:

              >>> pybytes.connect()
              Initialized watchdog for WiFi and LTE connection with timeout 1260000 ms
              LTE connection established
              connect_lte with start_mqtt is now removed please call communication_protocol or start_mqtt directly
              Connected to MQTT mqtt.pybytes.pycom.io
              Pybytes connected successfully (using the built-in pybytes library)
              

              But when I try:

              >>> pybytes.send_ping_message()
              

              it stalls forever... same if I try to send a signal. Moreover, if I try:

              >>> socket.getaddrinfo('www.pycom.io', 80)
              Traceback (most recent call last):
                File "<stdin>", line 1, in <module>
              OSError: [Errno 202] EAI_FAIL
              

              Please, can you, or anyone else, provide any help? I'm going crazy...

              1 Reply Last reply Reply Quote 0
              • G Offline
                Gijs
                last edited by

                Did you try the suggestion above? Let me know what the result is of socket.dnsserver() . As mentioned above, the EAI_FAIL error is related to an issue with the DNS server

                G 1 Reply Last reply Reply Quote 0
                • G Offline
                  Guillermo del Campo @Gijs
                  last edited by

                  @Gijs Yes... I tried with no success. This is the output:

                  >>> socket.dnsserver()
                  ('0.0.0.0', '0.0.0.0')
                  
                  1 Reply Last reply Reply Quote 0
                  • G Offline
                    Gijs
                    last edited by

                    Please try setting the dns servers manually before starting pybytes, as mentioned in the other ticket. This is an issue with Vodafone where the DNS servers do not get set correctly. We talk about it in the other thread: https://forum.pycom.io/topic/6350/error-while-connecting-pybytes-with-lte
                    Like this:

                    from network import LTE
                    import socket
                    lte = LTE()
                    lte.attach()
                    ...
                    lte.connect()
                    ...
                    socket.dnsserver(0, '172.31.32.100')
                    socket.dnsserver(1, '172.31.32.100')
                    # check if get addr info works
                    print(socket.getaddrinfo('www.pycom.io', 80))
                    #make sure to have pybytes loaded, but not autoconnect at boot, if pybytes is not loaded, use this: https://docs.pycom.io/pybytes/api/
                    pybytes.start()
                    

                    Sorry I did not get around to testing the script completely, but you should be able to make it work using a procedure like this
                    Best,
                    Gijs

                    G 1 Reply Last reply Reply Quote 0
                    • G Offline
                      Guillermo del Campo @Gijs
                      last edited by

                      @Gijs I also tried that, as I saw it on other post but it does not work... Here is the output:

                      Not starting Pybytes as auto-start is disabled
                      Pycom MicroPython 1.20.2.r4 [v1.11-ffb0e1c] on 2021-01-12; FiPy with ESP32
                      Pybytes Version: 1.6.1
                      Type "help()" for more information.
                      >>> from network import LTE
                      >>> import socket
                      >>> lte=LTE()
                      >>> lte.attach(band=20, apn="pycom.io")
                      >>> lte.isattached()
                      True
                      >>> lte.connect()
                      >>> lte.isconnected()
                      True
                      >>> socket.dnsserver(0, '172.31.16.100')
                      >>> socket.dnsserver(1, '172.31.32.100')
                      >>> socket.dnsserver()
                      ('172.31.16.100', '172.31.32.100')
                      >>> print(socket.getaddrinfo('www.pycom.io', 80))
                      Traceback (most recent call last):
                        File "<stdin>", line 1, in <module>
                      OSError: [Errno 202] EAI_FAIL
                      
                      1 Reply Last reply Reply Quote 0
                      • G Offline
                        Gijs
                        last edited by

                        Sorry, my mistake. The vodafone simcards do not resolve pycom.io, but should be able to resolve pybytes.pycom.io!
                        Let me know if that works for you

                        G 1 Reply Last reply Reply Quote 0
                        • G Offline
                          Guillermo del Campo @Gijs
                          last edited by

                          @Gijs Oh yes!! Thank you so much :) Now it works and I can send messages!

                          1 Reply Last reply Reply Quote 1
                          • G Offline
                            Gijs
                            last edited by

                            Im looking to add this to the documentation, as it seems an intermittent issue, could you recommend the place where you first looked for this?

                            Let me know

                            G 1 Reply Last reply Reply Quote 0
                            • G Offline
                              Guillermo del Campo @Gijs
                              last edited by

                              @Gijs I think it should be here: https://pycom.io/webshop-2/services/cellular-services/faq-for-vodafone-pycoms-nb-iot-services/ or maybe somewhere around here: https://docs.pycom.io/tutorials/networks/lte/
                              I believe it's also important to highlight that the modem firmware may need to be updated and modified to the NB-IoT version, since I took some to realise that as well... my FiPys come with the LTE-M version installed.

                              1 Reply Last reply Reply Quote 2

                              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