Struggle with Pycom LTE

  • Hello, i´m having some problems with Pycom Gpy in LTE and wondering if someone can gimme tip or something (From Brazil here):

    I´m trying to Attach and Connect to LTE network using the following code:
    (tutorial from core-electronics)

    The problem is this lines down:

    print("Configuring LTE ", end='')
    print(".", end='')
    lte.send_at_cmd('AT!="RRC::addscanfreq band=28 dl-earfcn=9410"')
    print(".", end='')
    print(" OK")

    I understand that the telstra.internet refeers to the Nano SIM Card. I used to use an moden for my Raspberry pi 3b and used to send this AT-commands:

    • ATZ
    • ATQ0 V1 E1 S0=0 &C1 $D2 +FCLASS=0
    • AT+CGDCONT=1,"IP",""
    • AT+CFUN =1,0

    And didn´t work.

    Vivo refeers to my Nano SIM Card, but i really dont know much about the AT-commands in a moldem.

    By the way, i have updated the firmware from my Gpy, the board to the Pymakr and the modem with internal commands in Atom.

    Has anyone has an idea to help me?

  • I changed my code to this:

    import socket
    import ssl
    import time
    from network import LTE
    import pycom


    lte = LTE(carrier="verizon") # instantiate the LTE object
    lte.attach(band=13) # attach the cellular modem to a base station, initially it was lte.attach()
    print( " While loop1") # print stmt to check on terminal
    time.sleep(5) # added 5 seconds wait
    pycom.rgbled(0x0000ff) # BLUE LED




    mood=lte.send_at_cmd('at+cpin?').split('\r\n')[1]; print('modem', mood)

    while not lte.isattached():
    print('Status:%s '%lte.send_at_cmd('AT+CEER'))
    time.sleep(5) # originally 0.25 changed to 5.0
    lte.connect(cid=3) # start a data session and obtain an IP address
    print( " While loop2")
    pycom.rgbled(0x00ff00) # GREEN LED
    while not lte.isconnected():

    s = socket.socket()
    s = ssl.wrap_socket(s)
    s.connect(socket.getaddrinfo('', 443)[0][-1])
    s.send(b"GET / HTTP/1.0\r\n\r\n")

    the message that i´m receiving is:

    +CSQ: 22,99



    Has any one has an idea of what that means? '-'

  • @rafaelFerreira You can send AT commands (lte.send_at_cmd("xxx")), and the commands for Username & password should be generic.

  • hey,
    Are there an AT-command to insert Username and Password relative to this Vivo? Like, I note that when i put the AT-commands to use a modem in Raspberry, i send another AT-commands to set Vivo Username and Password.

    Well... there are?

  • Note that if I understand things correctly, Vivo BR is currently deploying Cat-M1 and NB-IoT, so you may not necessarily be covered in your area yet.

    Also, you may need a specific subscription for this, it may not work with a regular LTE subscription (from what I understand at least NB-IoT will have specific billing structure).

    Apparently Vivo uses LTE bands 3, 7 and 28. Don't restrict yourself to a single band, coverage at your place may be available in only some of those bands. The FiPy does not support band 7, though.

    Also make sure you have recent firmware for both the modem and FiPy, and that the modem firmware you use matches the technology you want (Cat-M1 or NB-IoT).

  • @rafaelFerreira Having a good quality lte antenna is very important. Beware the cheap chinese antennas claiming 698-2700MHz range, most of 'em are 850-2700MHz which is important for band 28 (700MHz)

  • @kjm

    Hm, yeah thanks, that´s a good view.
    Just one last question: if i get the LTE antenna, will i get more success results or change the antenna is not that important?

  • @rafaelFerreira How can you be sure the frequency is the same? Do you know the band your Telco is running cat-m1 on? It's best NOT to limit the modem to certain bands. That was Nakovi's problem @ (see his last post)

  • @kjm
    Yep. I tryed this.

    Hm, question: Is it ok to use a LoRa antenna to this Attaching? Or it´s realy required the LTE antenna? The frequency is the same

  • @rafaelFerreira simreg=2 means the modem is trying to attach. Have you tried commenting out the addscanfreq line to see if it's preventing attachment?

  • @kjm
    Yeah, i actually do this reset in code:

    print("Resetting LTE modem ... ", end='')

    and you´re right. I move this commands to my 'attach loop' see:

    print("Configuring LTE ", end='')
    print(".", end='')
    lte.send_at_cmd('AT!="RRC::addscanfreq band=28 dl-earfcn=9410"')
    print(".", end='')
    print(" OK")

    mood=lte.send_at_cmd('at+cpin?').split('\r\n')[1]; print('modem', mood)
    # If correctly configured for carrier network, attach() should succeed.
    if not lte.isattached():
        print("Attaching to LTE network ", end='')
            if lte.isattached():
                print(" OK")
            print('.', end='')
            simreg=lte.send_at_cmd('at+creg?').split(',')[1][:1]; print('sim reg =', simreg, end=' ')
            service=lte.send_at_cmd('AT+cind?').split(': ')[1][2]; print('service =', service)

    and the return now is:
    sim reg = 2 service = 0

    I think the error is in
    lte.send_at_cmd('AT!="RRC::addscanfreq band=28 dl-earfcn=9410"')

    Do you know something to help?

  • @rafaelFerreira simreg & service simply confirm you don't have an attachment. Try the modem reset if you get an error for mood, that's where the problem is.

  • @kjm
    Well, i got something more specific here in this time....
    I applied this line in my code.

    print('modem', mood)
    print('sim reg =', simreg, end=' ')
    service=lte.send_at_cmd('AT+cind?').split(': ')[1][2]
    print('service =', service)

    and this was the answer:

    modem +CPIN: READY
    sim reg = 0 service = 0

    Sorry for my ignorance, but I really don't know much about it.
    Do you know something?

  • @rafaelFerreira between lte=network.LTE() and trying to attach it is worthwhile checking the modem's mood with at+cpin if you get an error then


    attachment only works if the mood is 'ready' or 'sysstart'

  • @kjm
    Yes, i´m sure that i´m using the correct SIM (it´s from Vivo)
    I receive the message 'modem ERROR' when i apply your command in my code

  • So you are using lte.send_at_cmd('AT+CGDCONT=1,"IP",""') with a zap sim & not getting an attachment?

    Is the sim current?

    What response do you get to mood=lte.send_at_cmd('at+cpin?').split('\r\n')[1]; print('modem', mood)

Log in to reply

Pycom on Twitter