# --------------------------------------------------------------- def OnUbloxParsed(msgType, msgItems): print(msgType) print(msgItems) # --------------------------------------------------------------- # GNSS Modules # --------------------------------------------------------------- # Power-on the GNSS subsystem gnss_pwr = Pin('PWR_GNSS', Pin.OUT_OD) gnss_pwr.high() # UART configuration of ZED with application buffer zed1 = UART('ZED1', 115200, rxbuf=0, dma=True) # --------------------------------------------------------------- # XBEE Expansions # --------------------------------------------------------------- # Power-on the XBEE LP subsystem xlp_pwr = Pin('PWR_XBEE_LP', Pin.OUT_PP) xlp_pwr.high() # Re-direct the XBEE LP subsystem to the MCU xlp_dir = Pin('XBEE_LP_DIR', Pin.OUT_PP) xlp_dir.high() # XBEE LP UART configuration xhp_uart = UART('XBEE_HP', 115200, rxbuf=0, dma=True)
# --------------------------------------------------------------- def OnUbloxParsed(msgType, msgItems): print(msgType) print(msgItems) # --------------------------------------------------------------- # GNSS Modules # --------------------------------------------------------------- # Power-on the GNSS subsystem gnss_pwr = Pin('PWR_GNSS', Pin.OUT_OD) gnss_pwr.high() # UART configuration of ZED with application buffer zed1 = UART('ZED1', 115200, rxbuf=0, dma=False) # Parser configurations zed1.parser(UART.ParserNMEA, rxbuf=256, rxcallback=OnNmeaMsg, frcallback=OnNmeaParsed) zed1.parser(UART.ParserUBX, rxbuf=256, rxcallback=OnUbloxMsg, frcallback=OnUbloxParsed) # Main application process def app_proc(): while True:
# GNSS NMEA message parsed callback # --------------------------------------------------------------- def OnParsedMsg(msgType, msgItems): pass # --------------------------------------------------------------- # GNSS Modules # --------------------------------------------------------------- # Power-on the GNSS subsystem gnss_pwr = Pin('PWR_GNSS', Pin.OUT_PP) gnss_pwr.high() # UART configuration of ZEDs with application buffer zed1_uart = UART('ZED1', 115200, rxbuf=1024) # Parser configuration zed1_uart.parser(UART.ParserNMEA, rxbuf=256, rxcallback=OnNmeaMsg, frcallback=OnParsedMsg) # Main application process def app_proc(): while True: # ZED Message processor zed1_uart.process(UART.ParserNMEA)
# XBEE Low Power Direction (XBEE_LP <-> MCU) xbee_lp_dir = Pin('XBEE_LP_DIR', Pin.OUT_PP) xbee_lp_dir.high() # XBEE High Power Direction (XBEE_HP <-> MCU) xbee_hp_dir = Pin('XBEE_HP_DIR', Pin.OUT_PP) xbee_hp_dir.high() # --------------------------------------------------------------- # GSM Module Communication based socket interface (on XBEE-HP) # --------------------------------------------------------------- # Configure the network interface card (GSM) pwr = Pin('PWR_XBEE_HP', Pin.OUT_OD) nic = network.GSM(UART('XBEE_HP', 115200, rxbuf=1024, dma=False), pwr_pin=pwr, info=True) sms = nic.SMS(OnSmsReceived) # --------------------------------------------------------------- # Main application process # --------------------------------------------------------------- def app_proc(): # Start up delay to allow REPL message utime.sleep_ms(1000) # Print info print('GSM connection started...\r\n') # Configure the GSM parameters nic.config(user='******', pwd='gprs', apn='internet', pin='1234')
# XBEE Low Power Direction (XBEE_LP <-> MCU) xbee_lp_dir = Pin('XBEE_LP_DIR', Pin.OUT_PP) xbee_lp_dir.high() # XBEE High Power Direction (XBEE_HP <-> MCU) xbee_hp_dir = Pin('XBEE_HP_DIR', Pin.OUT_PP) xbee_hp_dir.high() # --------------------------------------------------------------- # GSM Module Communication based socket interface (on XBEE-HP) # --------------------------------------------------------------- # Configure the network interface card (GSM) pwr = Pin('PWR_XBEE_HP', Pin.OUT_OD) nic = network.GSM(UART('XBEE_HP', 115200, rxbuf=1024, dma=False), pwr_pin=pwr, info=True) # --------------------------------------------------------------- # Main application process # --------------------------------------------------------------- async def app_proc(url, port): # Print info print('GSM connection started...\r\n') # Configure the GSM parameters nic.config(user='******', pwd='gprs', apn='internet', pin='1234') # Connect to the gsm network
# --------------------------------------------------------------- led1 = sty.LED(1) led2 = sty.LED(2) led3 = sty.LED(3) # --------------------------------------------------------------- # GNSS Modules # --------------------------------------------------------------- # Power-on the GNSS subsystem gnss_pwr = Pin('PWR_GNSS', Pin.OUT_PP) gnss_pwr.high() # UART configuration of ZED zed1_uart = UART('ZED1', 115200, rxbuf=0) # --------------------------------------------------------------- # XBEE Expansions # --------------------------------------------------------------- # Power-on the XBEE LP subsystem xlp_pwr = Pin('PWR_XBEE_LP', Pin.OUT_PP) xlp_pwr.high() # Power-on the XBEE HP subsystem xhp_pwr = Pin('PWR_XBEE_HP', Pin.OUT_PP) xhp_pwr.high() # XBEE LP UART configuration xlp_uart = UART('XBEE_LP', 115200, rxbuf=0)
import _thread from sty import Pin from sty import UART # --------------------------------------------------------------- # GSM Module Communication based socket interface # --------------------------------------------------------------- # Configure the network interface card (GSM) pwr = Pin('PWR_GSM', Pin.OUT_OD) pon = Pin('M2M_PON', Pin.OUT_OD) rst = Pin('M2M_RST', Pin.OUT_OD) mon = Pin('M2M_MON', Pin.IN) nic = network.GSM(UART('GSM', 115200, flow=UART.RTS | UART.CTS, rxbuf=1024, dma=False), pwr_pin=pwr, pon_pin=pon, rst_pin=rst, mon_pin=mon, info=True) # --------------------------------------------------------------- # Main application process # --------------------------------------------------------------- def app_proc(): # Start up delay to allow REPL message
# --------------------------------------------------------------- def OnUbloxParsed(msgType, msgItems): print(msgType) print(msgItems) # --------------------------------------------------------------- # GNSS Modules # --------------------------------------------------------------- # Power-on the GNSS subsystem gnss_pwr = Pin('PWR_GNSS', Pin.OUT_OD) gnss_pwr.high() # UART configuration of ZED with application buffer zed1_uart = UART('ZED1', 115200, rxbuf=0, dma=False) # Parser configurations zed1_uart.parser(UART.ParserUBX, rxbuf=2048, rxcallback=OnUbloxMsg, frcallback=OnUbloxParsed) # Main application process def app_proc(): while True: # Call the UBX framer processor zed1_uart.process(UART.ParserUBX)
# --------------------------------------------------------------- led1 = sty.LED(1) led2 = sty.LED(2) led3 = sty.LED(3) # --------------------------------------------------------------- # GNSS Modules # --------------------------------------------------------------- # Power-on the GNSS subsystem gnss_pwr = Pin('PWR_GNSS', Pin.OUT_PP) gnss_pwr.high() # UART configuration of ZEDs zed1_uart = UART('ZED1', 115200, rxbuf=0, dma=True) zed2_uart = UART('ZED2', 115200, rxbuf=0, dma=True) zed3_uart = UART('ZED3', 115200, rxbuf=0, dma=True) # --------------------------------------------------------------- # XBEE Expansions # --------------------------------------------------------------- # Power-on the XBEE LP subsystem xlp_pwr = Pin('PWR_XBEE_LP', Pin.OUT_PP) xlp_pwr.high() # Re-direct the XBEE LP subsystem to the MCU xlp_dir = Pin('XBEE_LP_DIR', Pin.OUT_PP) xlp_dir.high()
zed1_uart.send(msg) zed2_uart.send(msg) zed3_uart.send(msg) led1.toggle() # --------------------------------------------------------------- # GNSS Modules # --------------------------------------------------------------- # Power-on the GNSS subsystem gnss_pwr = Pin('PWR_GNSS', Pin.OUT_PP) gnss_pwr.high() # UART configuration of ZEDs zed1_uart = UART('ZED1', 115200, rxbuf=0) zed2_uart = UART('ZED2', 115200, rxbuf=0) zed3_uart = UART('ZED3', 115200, rxbuf=0) # --------------------------------------------------------------- # XBEE Expansions # --------------------------------------------------------------- # Power-on the XBEE LP subsystem xlp_pwr = Pin('PWR_XBEE_LP', Pin.OUT_PP) xlp_pwr.high() # Re-direct the XBEE LP subsystem to the MCU xlp_dir = Pin('XBEE_LP_DIR', Pin.OUT_PP) xlp_dir.high()
# --------------------------------------------------------------- led1 = sty.LED(1) led2 = sty.LED(2) led3 = sty.LED(3) # --------------------------------------------------------------- # GNSS Modules # --------------------------------------------------------------- # Power-on the GNSS subsystem gnss_pwr = Pin('PWR_GNSS', Pin.OUT_OD) gnss_pwr.high() # UART configuration of ZEDs zed1_uart = UART('ZED1', 115200, rxbuf=0, dma=True) zed2_uart = UART('ZED2', 115200, rxbuf=0, dma=True) zed3_uart = UART('ZED3', 115200, rxbuf=0, dma=True) # --------------------------------------------------------------- # RTCM message received callback # --------------------------------------------------------------- def OnRtcmMsg(uart, rtcmMsg): zed1_uart.send(rtcmMsg) zed2_uart.send(rtcmMsg) zed3_uart.send(rtcmMsg) while zed3_uart.istxbusy() == True: pass
xbee_lp_dir.high() # XBEE High Power Direction (XBEE_HP <-> MCU) xbee_hp_dir = Pin('XBEE_HP_DIR', Pin.OUT_PP) xbee_hp_dir.high() # --------------------------------------------------------------- # GNSS Modules # --------------------------------------------------------------- # Power-on the GNSS subsystem gnss_pwr = Pin('PWR_GNSS', Pin.OUT_OD) gnss_pwr.high() # UART configuration of ZEDs with application buffer zed1 = UART('ZED1', 115200, rxbuf=0, dma=True) # Parser configurations zed1.parser(UART.ParserUBX, rxbuf=2048, rxcallback=OnUbloxMsg, frcallback=OnUbloxParsed) # --------------------------------------------------------------- # GSM Module Communication based socket interface (on XBEE-HP) # --------------------------------------------------------------- # Configure the network interface card (GSM) pwr = Pin('PWR_XBEE_HP', Pin.OUT_OD) nic = network.GSM(UART('XBEE_HP', 115200, rxbuf=1024, dma=False), pwr_pin=pwr,
fext2 = 0 # Create the test files fp1 = open('nmea_log1.000', 'w') fp2 = open('nmea_log2.000', 'w') # --------------------------------------------------------------- # GNSS Modules # --------------------------------------------------------------- # Power-on the GNSS subsystem gnss_pwr = Pin('PWR_GNSS', Pin.OUT_PP) gnss_pwr.high() # UART configuration of ZEDs without application buffer zed1_uart = UART('ZED1', 115200, rxbuf=0, dma=True) zed2_uart = UART('ZED2', 115200, rxbuf=0, dma=True) # --------------------------------------------------------------- # ZED1 GNSS NMEA message received callback # --------------------------------------------------------------- def OnNmeaMsg1(uart, nmeaMsg): s = 'ZED1: ' + nmeaMsg.decode('utf-8') print(s) fp1.write(s + '\n') # --------------------------------------------------------------- # ZED1 GNSS NMEA message parsed callback # ---------------------------------------------------------------
import utime import usocket import network import _thread from sty import Pin from sty import UART # --------------------------------------------------------------- # GSM Module Communication based socket interface # --------------------------------------------------------------- # Configure the network interface card (GSM) pwr = Pin('PWR_GSM', Pin.OUT_OD) mon = Pin('GSM_MON', Pin.IN, Pin.PULL_DOWN) nic = network.GSM(UART('GSM', 115200, flow=UART.RTS|UART.CTS, rxbuf=1024, dma=False), pwr_pin=pwr, mon_pin=mon, info=True) # --------------------------------------------------------------- # Main application process # --------------------------------------------------------------- def app_proc(): # Start up delay to allow REPL message utime.sleep_ms(1000) # Print info print('GSM connection started...\r\n') # Configure the GSM parameters nic.config(user='******', pwd='gprs', apn='internet', pin='1234') # Connect to the gsm network