network.PPP troubles
Hello,
I finally managed to connect my GSM modem and start PPP link, but when decide to drop the link in order to control modem again prompt/system hangs (froze the promp) for unlimited time, but can be interrupted with control-C and the link is down after interruption.
That happen even without actially connect to internet:
>>> import machine
>>> import network
>>> gsm = machine.UART(1,tx=22, rx=21, timeout=1000, baudrate=9600)
>>> ppp=network.PPP(gsm)
>>> ppp.active(True)
True
>>> ppp.active(False)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
KeyboardInterrupt:
>>>
>>>
Sometimes it reset module when interrupt with ctrl-c. I'm using:
MicroPython v1.10-290-g8402c26cf on 2019-04-20; ESP32 module with ESP32
P.S.
I can add that ppp.status() never return anything to me, connected, disconnected does not matter, it always prompt nothing.
P.S.1
ppp.isconnected() , start show True when it get IP address, but I do a little test, unplug my GSM modem, and let some time passes, so far it is 15 minutes and it still returns True
P.S.2
Noticed that DNS server is not set from ppp.ifconfig()
`>>> ppp.ifconfig()
('10.164.62.94', '192.168.254.254', '255.255.255.255', '0.0.0.0')
ppp.ifconfig("8.8.8.8")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: object 'str' isn't a tuple or list
ppp.ifconfig(dns="8.8.8.8")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: function doesn't take keyword arguments`
Do not know how to set it UP since there is no documentation.
- tested there is no internet on the board, without DNS
ESP32: network.PPP on UART not working, interrupt-issue?
Hello,
I'm trying to use network.PPP with a GSM modem, but it does not work.
My code:
[.... initalization, APN setup etc.]
modem_uart.write('AT+CGDATA="PPP",1\r\n')
time.sleep(1)
print(modem_uart.readline()) => b'\r\n'
print(modem_uart.readline()) => b'CONNECT\r\n'
ppp = network.PPP(modem_uart)
ppp.active(True)
[waiting a few minutes, checking in the meantime
>>> ppp.ifconfig()
('0.0.0.0', '0.0.0.0', '255.255.255.255', '0.0.0.0')
>>> ppp.status()
>>> ppp.isconnected()
False
Then I checked if data is received from the modem, still in the rx buffer:
>>> modem_uart.any()
215
>>> modem_uart.read()
b'~\xff}#\xc0!}!}!} }2}"}&} }*} } }#}$\xc0#}\'}"}(}"U\x83~~\xff}#\xc0!}!}!} }2}"}&} }*} } }#}$\xc0#}\'}"}(}"U\x83~~\xff}#\xc0!}!}!} }2}"}&} }*} } }#}$\xc0#}\'}"}(}"U\x83~~\xff}#\xc0!}!}!} }2}"}&} }*} } }#}$\xc0#}\'}"}(}"U\x83~~\xff}#\xc0!}!}!} }2}"}&} }*} } }#}$\xc0#}\'}"}(}"U\x83~~\xff}#\xc0!}!}!} }2}"}&} }*} } }#}$\xc0#}\'}"}(}"U\x83~~\xff}#\xc0!}!}!} }2}"}&} }*} } }#}$\xc0#}\'}"}(}"U\x83~\r\nNO CARRIER\r\n'
It seems the modem tries to establish connection, sending handshakes every few seconds, but network.PPP does not even pick up data from the UART. How is that supposed to work, I assumed it would be interrupt-driven in the background?
But I'm also not able to figure out how to get interrupts for received data on the UART manually, is it a feature missing on the ESP32, is that maybe causing the PPP issue?
>>> UART.irq
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: type object 'UART' has no attribute 'irq'
>>> modem_uart.irq
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'UART' object has no attribute 'irq'
I'm using esp32-idf4-20210202-v1.14.bin with a SIM800L GPRS modem.
According to https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/uart.html#uart-api-using-interrupts the ESP32 should support interrupts on the UART.
If interrupts are not supported and that is the issue, is there a way to manually feed the received data from the UART into ppp, from my main loop with select()?
Thanks
Sebastian