I got the modem talking to the network, and I am trying to write a simple python code to send AT commands.
import sys
import time
import socket
import machine
UART_BAUD = 115200
# defaule use SIM800L_IP5306_VERSION_20190610
MODEM_POWER_PIN = 23
MODEM_RST = 5
MODEM_PWRKEY_PIN = 4
MODEM_TX = 27
MODEM_RX = 26
LED_PIN = 13
# Power on the GSM module
GSM_POWER = machine.Pin(MODEM_POWER_PIN, machine.Pin.OUT)
GSM_POWER.value(1)
LED = machine.Pin(LED_PIN, machine.Pin.OUT)
LED.value(1)
GSM_PWR = machine.Pin(MODEM_PWRKEY_PIN, machine.Pin.OUT)
GSM_PWR.value(1)
time.sleep_ms(200)
GSM_PWR.value(0)
time.sleep_ms(1000)
GSM_PWR.value(1)
modem = machine.UART(1, 115200, tx=MODEM_RX, rx=MODEM_TX)
def send_at(command):
"""
Send an AT command to the modem
:param command: str: the at command to send
:return:
"""
command = command + '\r'
modem.write(bytes(command, 'utf-8'))
def reader():
while True:
if modem.any():
try:
line = modem.readline()
except Exception as e:
log("Error reading uart {}".format(str(e)))
continue
log(f'"{line}"')
break
if __name__ == "__main__":
send_at('ati')
reader()
I don't see any returning from the uart. I also tried the c version of the UART test and I don't see any response.
I got the modem talking to the network, and I am trying to write a simple python code to send AT commands.
I don't see any returning from the uart. I also tried the c version of the UART test and I don't see any response.