sbcshop / Pico-4G-Expansion

The Raspberry Pi Pico 4G Expansion is a Quectel EG25-G module-based 4G Expansion board that includes an LTE category 4 module, built-in WiFi, multi-constellation GNSS, USB 2.0 High-Speed Interface.
MIT License
3 stars 1 forks source link

Stuck in a startup loop. #1

Open Kashutu opened 2 years ago

Kashutu commented 2 years ago

I have programmed the pico with the given code and input my number and a test text. When I start it up it gets stuck in a startup loop. I can see that the sim is making a connection to the network before it restarts. I have made a few changes to the code in picture 1, to provide the device longer to see if that would help make it out of the loop Et9zCD8IaZ .

Kashutu commented 2 years ago

Here is the picture showing it is making a connection to the network chrome_J1eJ0Xl80J .

sbcshop1 commented 2 years ago

Hello, Can you send the complete Output of the code, actually we know what you say but for confirmation, we need the output of the code. and when we run the code on our side code is not stuck

Kashutu commented 2 years ago

thonny_TeWleJA1Cq

This is all I get.

Is there any documentation for the board?

sbcshop1 commented 2 years ago

OK, means you don't get the AT command response. Might be your 4G module is not 'ON' , when you run the code 4G module is automatic 'ON' . first of all check 4G module is ON condition, there is one NET LIGHT led in the board. If the 4G module is working in On condition the NET LIGHT blink continuously, and the device will give you AT response in the thonny terminal.There is another way to turn on Module by hardware. you can press the onboard power button for 4-6 sec, then release see the NET LIGHT led is blinking or not, NET LIGHT is not blinking then there is a fault in the board, if there is a fault in the board we replace the board

sbcshop1 commented 2 years ago

OK, means you don't get the AT command response. Might be your 4G module is not 'ON' , when you run the code 4G module is automatic 'ON'. first of all check 4G module is ON condition, there is one NET LIGHT led in the board. If the 4G module is working in On condition the NET LIGHT blink continuously, and the device will give you AT response in the thonny terminal. There is another way to turn on Module by hardware. you can press the onboard power button for 4-6 sec, then release see the NET LIGHT led is blinking or not, NET LIGHT is not blinking then there is a fault in the board, if there is a fault in the board we replace the board

On Wed, Mar 16, 2022 at 2:34 AM Kashutu @.***> wrote:

[image: thonny_TeWleJA1Cq] https://user-images.githubusercontent.com/91392289/158472108-a40f6186-0fb3-463f-a3c8-c80855ad8775.png

This is all I git.

Is there any documentation for the board?

— Reply to this email directly, view it on GitHub https://github.com/sbcshop/Pico-4G-Expansion/issues/1#issuecomment-1068471549, or unsubscribe https://github.com/notifications/unsubscribe-auth/AW6TACRBRXZKR3FT3MPPBE3VAD3NBANCNFSM5QEBZ6ZQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>

-- Thanks and Regards

NIRAJ KUMAR https://sb-components.co.uk/ Sr. Embedded Engineer +44 (0) 20 351 409 14 33 Cavendish Square, London, @. @.> United Kingdom https://shop.sb-components.co.uk https://sb-components.co.uk W1G 0PW

https://www.facebook.com/sbcomponentsltd/ https://twitter.com/sb_ltd/ https://www.youtube.com/channel/UC-HPa0xV9LtjqT79aajhGfQ https://www.linkedin.com/in/sb-components-6b3740155/

This electronic transmission is strictly confidential and intended solely for the addressee. It may contain information which is covered by legal, professional or another privilege. If you are not the intended addressee, you must not disclose, copy or take any action in reliance on this transmission. If you have received this transmission in error, please delete it and notify us as soon as possible. The Internet cannot guarantee the integrity of this message, SB Components Ltd will not, therefore, be liable for the message if modified.

Kashutu commented 2 years ago

I can confirm there is a blinking blue NETLIGHT.

Main.js: `import machine import os import utime import time import Lcd1_14driver import EG25_4G

LCD = Lcd1_14driver.Lcd1_14()#driver of lcd display

def infoDevice(): LCD.fill(LCD.black) LCD.hline(10,10,220,LCD.white) LCD.hline(10,125,220,LCD.white) LCD.vline(10,10,115,LCD.white) LCD.vline(230,10,115,LCD.white)

    LCD.text("SB-COMPONENTS",70,40,LCD.white)
    LCD.text("PICO 4G",70,60,LCD.white)
    LCD.text("EXPANSION",70,80,LCD.white)  
    LCD.lcd_show()
    time.sleep(2)
    LCD.fill(LCD.black)
    LCD.text("WAITING.....",70,40,LCD.white)
    LCD.lcd_show()
    x = 0
    for y in range(0,1):
            x += 4
            LCD.text(".",125+x,40,LCD.white)
            LCD.lcd_show()
            time.sleep(1)

infoDevice() print("Device info: " + str(infoDevice()))

Mobile_number = "" #write your phone number here

Write_message = "" #write message you need to send

Message = EG25_4G.message('Number','TEST') #send the message. I have a real number here.

Call = EG25_4G.call(Mobile_number,60) # uncomment this to make call 60 means duration of call(you can change according to you)

Gps = EG25_4G.gps() #uncomment this to use gps

`

EG25_4G: `import machine import os import utime import Lcd1_14driver import time import binascii

pwr_enable = 22 # EG25_4G Power key connected on GP22 uart_port = 0 uart_baud = 115200

Initialize UART0

uart = machine.UART(uart_port, uart_baud) print(os.uname())

LCD = Lcd1_14driver.Lcd1_14()#driver of lcd display

def wait_resp_info(timeout=3000): prvmills = utime.ticks_ms() info = b"" while (utime.ticks_ms()-prvmills) < timeout: if uart.any(): info = b"".join([info, uart.read(1)]) print(info.decode()) return info

def Send_command(cmd, back, timeout=2000): # Send AT command rec_buff = b'' uart.write((cmd+'\r\n').encode()) prvmills = utime.ticks_ms() while (utime.ticks_ms()-prvmills) < timeout: if uart.any(): rec_buff = b"".join([rec_buff, uart.read(1)]) if rec_buff != '': if back not in rec_buff.decode(): print(cmd + ' back:\t' + rec_buff.decode()) return 0 else: print(rec_buff.decode()) return 1 else: print(cmd + ' no responce')

def Send_command_wait_resp(cmd, back, timeout=2000): # Send AT command and return response information rec_buff = b'' uart.write((cmd + '\r\n').encode()) prvmills = utime.ticks_ms() while (utime.ticks_ms() - prvmills) < timeout: if uart.any(): rec_buff = b"".join([rec_buff, uart.read(1)]) if rec_buff != '': if back not in rec_buff.decode(): print(cmd + ' back:\t' + rec_buff.decode()) else: print(rec_buff.decode()) else: print(cmd + ' no responce')

print("Response information is: ", rec_buff)

    return rec_buff

def Check_and_start(): # Initialize SIM Module while True: uart.write(bytearray(b'ATE1\r\n')) utime.sleep(10) uart.write(bytearray(b'AT\r\n')) rec_temp = wait_resp_info() utime.sleep(10) if 'OK' in rec_temp.decode(): print('Pico 4G is ready\r\n' + rec_temp.decode()) LCD.fill(LCD.black) LCD.text("Pico 4G is ready",40,40,LCD.white) LCD.lcd_show() break else: power = machine.Pin(pwr_enable, machine.Pin.OUT) power.value(1) utime.sleep(2) power.value(0) print('Pico 4G is starting up, please wait...\r\n') LCD.fill(LCD.black) LCD.text("Pico 4G is starting up",40,40,LCD.white) LCD.text("Please wait...",40,60,LCD.white) LCD.lcd_show() utime.sleep(10)

def Network_checking():# Network connectivity check for i in range(1, 3): if Send_command("AT+CGREG?", "0,1") == 1: print('EG25-4G is online\r\n') break else: print('EG25-4G is offline, please wait...\r\n') utime.sleep(2) continue

def gps(): Check_and_start() count = 0 print('Start GPS...') Send_command('AT+QGPS=1', 'OK') LCD.fill(LCD.black) LCD.text("GPS POWER ON",40,40,LCD.white) LCD.lcd_show() utime.sleep(2) for i in range(1, 5): uart.write(bytearray(b'AT+QGPSGNMEA="RMC"\r\n'))

        rec_buff = wait_resp_info()

        if ',,,,' in rec_buff.decode():
            print('GPS is not ready')
            LCD.fill(LCD.black) 
            LCD.lcd_show()
            #LCD.text(rec_buff.decode(),40,60,LCD.white) 
            #LCD.lcd_show()
            utime.sleep(5)
            print(rec_buff.decode())

            if i >= 9:
                print('GPS positioning failed, please check the GPS antenna!\r\n')
                Send_command('AT+QGPSEND', 'OK')
                LCD.fill(LCD.black) 
                LCD.lcd_show()

                LCD.text("GPS positioning failed",40,40,LCD.white)
                LCD.text("GPS POWER OFF",40,60,LCD.white) 
                LCD.lcd_show()
                utime.sleep(4)
            else:
                utime.sleep(2)
                continue
        else:
            if count <= 3:
                count += 1
                print('GPS info:')
                print(rec_buff.decode())
                LCD.fill(LCD.black) 
                LCD.text(rec_buff.decode(),40,60,LCD.white) 
                LCD.lcd_show()

            else:
                Send_command('AT+QGPSEND', 'OK')
                LCD.fill(LCD.black) 
                LCD.lcd_show()
                LCD.text("GPS POWER OFF",40,60,LCD.white) 
                LCD.lcd_show()
                utime.sleep(4)
                break

def call(mobile_number,time): Check_and_start() # Initialize SIM Module Network_checking() # Network connectivity check

    Send_command('AT+CHFA=1', 'OK')
    Send_command("ATD"+mobile_number+";", 'OK')
    utime.sleep(time)
    LCD.fill(LCD.black) 
    LCD.text("CALL IS CONNECTED",20,80,LCD.white)  
    LCD.lcd_show()
    Send_command('AT+CHUP;', 'OK')#hangup call
    LCD.text("CALL IS DISCONNECTED",20,80,LCD.white)
    LCD.lcd_show()

def message(phone_num, sms_text): def Hex_str_to_str(hex_str): hex_data = hex_str.encode('utf-8') str_bin = binascii.unhexlify(hex_data) return str_bin.decode('utf-8')

def Str_to_hex_str(string):
    str_bin = string.encode('utf-8')
    return binascii.hexlify(str_bin).decode('utf-8')

# Send SMS function
def send_sms(phone_num, sms_text):
    Send_command('AT+CMGF=1', 'OK')
    if Send_command('AT+CMGS=\"'+phone_num+'\"', '>'):
        uart.write(bytearray(sms_text))
        utime.sleep(0.5)
        uart.write(bytearray(Hex_str_to_str("1A")))
        LCD.fill(LCD.black) 
        LCD.text("SEND MESSAGE SUCESSFULLY",20,80,LCD.white)  
        LCD.lcd_show()

Check_and_start() 
Network_checking() 
send_sms(phone_num, sms_text)

`

Kashutu commented 2 years ago

Is there any documentation for the board?

Kashutu commented 2 years ago

thonny_c7RXYufFmD

Also just ran it in live and got that 4 response. Could that be ITU-T code 4 error?

Kashutu commented 2 years ago

It seems like the Pico is not sending data to the expansion board.

sbcshop1 commented 2 years ago

You saying Pico not sending the command , first you need to check raspberry Pi PICO GP pins all are working or not , by making all Pico Gp pins high

On Fri, 18 Mar 2022, 21:22 Kashutu, @.***> wrote:

It seems like the Pico is not sending data to the expansion board.

— Reply to this email directly, view it on GitHub https://github.com/sbcshop/Pico-4G-Expansion/issues/1#issuecomment-1072542193, or unsubscribe https://github.com/notifications/unsubscribe-auth/AW6TACU6CD6DHTJZF46TAOLVASRCLANCNFSM5QEBZ6ZQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>