I'm trying to get SIM800L work at PPPos (i.e. to use it just like WIFI connection to internet).
Here is a listing of my code:
Code: Select all
from machine import UART, Pin
import network
def send_command(command):
command = command + '\r\n'
uart.write(command)
line = uart.read(100)
if line:
line = line.decode('utf-8')
print(line.replace('\r\n','\n'))
else:
print('Hmmm...')
uart = UART(1, 9600, timeout=2000, rx=17, tx=16)
send_command('AT+CGATT?')
send_command('AT+CGATT=0')
send_command('AT+CGCLASS?')
send_command('AT+CGDCONT=1,"IP","internet"')
send_command('AT+CGATT?')
send_command('AT+CGACT=1,1')
send_command('AT+CGATT?')
send_command('AT+CGPADDR=1')
ppp = network.PPP(uart)
ppp.active(True)
print(ppp.ifconfig())
ppp.active(False)
Code: Select all
AT+CGATT?
+CGATT: 1
OK
AT+CGATT=0
OK
AT+CGCLASS?
+CGCLASS: "B"
OK
AT+CGDCONT=1,"IP","internet"
OK
AT+CGATT?
+CGATT: 0
OK
AT+CGACT=1,1
OK
AT+CGPADDR=1
+CGPADDR: 1,"100.83.70.16"
OK
('0.0.0.0', '0.0.0.0', '255.255.255.255', '0.0.0.0')
So It receives IP-address but does not transfer it to network.PPP.
Any ideas where I messed up?