← index #6541Issue #8728
Related · medium · value 1.000
QUERY · ISSUE

ESP32: persistent PPP needed

openby emardopened 2020-10-11updated 2025-10-03
port-esp32

Currently PPP tries to connect during some time, around 10 seconds
and then it gives up. After the timeout, PPP's serial traffic which looks
like !}!}!} }4}"}&} } } } }%}&y is no longer active at serial line and other
end (pppd linux) can't establish connection after timeout.

In application I would need PPP to continuously be active
because if I restart PPP by deleting its instance and creating again
after ESP32 has connected to WiFi, then PPP will spoil WiFi routing
and I don't want this to happen.

Additionaly - is this bug? This won't manually restart PPP after timeout:

ppp.active(False)
ppp.active(True)

Does nothing, while I think it should reactivate PPP traffic to
attempt connection on serial line, the chars !}!}!} }4}"}&} } } } }%}&y
should appear again

CANDIDATE · ISSUE

ESP32 and PPP not working

openby LordGuillyopened 2022-06-05updated 2023-04-13
bug

I am trying to raise a PPP connection with a modem (two different ones actually, an EG91 and a BG95)
Once the modem is registered into the network, I start the data call with AT commands, and after the "CONNECT" string is received, do the following code in MicroPython:

my_log.info("Starting Data Call", fn="main")
modem.startDataCall()
my_log.info("Creating PPP object", fn="main")
sleep(5)
ppp = network.PPP(modem.getSerialPort())
ppp.active(True)
ppp.connect(authmode=ppp.AUTH_CHAP,username ="", password="")

I am monitoring the PPP frames in the serial line, and I can see the following:

  • the ESP32 sends the first ConfRequest
  • the moddem replies with the ACK and its own ConfRequest
  • but the ESP32 does not reply anything for about 6 seconds, and in the meantime the modem sends new ConfRequests
  • after 6 seconds, the ESP32 seems to process all the requests and ACK them, but this causes abnormal transitions from the PPP FSM.
  • The modem replies the ConfRequest, but again nothing happens for another 6 seconds.
  • The modem times out every second, and sends a new ConfRequest that causes the same problem again and again, until one or both of the parts give up

I enabled LWIP and PPP logs. It seems to me the problem is the UART object is not passing the data received in the serial port to the PPP object straight away, but only after a timeout. I played a bit with some of the hardcoded values (like FSMTIMEOUT), that seems to confirm the guess.
Unfortunately I am unable to find what mechanism will pass the data from the UART object ot the PPP object - all I can see is there is a task created that waits to be notified, but cannot find what's sending such notification.

I am using latest micropython version (master branch, commit 2111ca0b8fdcbef6177a8d37fde53085de2a798a) , and building with ESP-IDF 4.4

any help would be appreciated, I can supply the logs (or enable more segments and capture more if it helps)

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied