ESP32: persistent PPP needed
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
ESP32 Slow flash access when PPP active
When a ppp network link is active on an ESP32 device, writing files to external flash is 40 times slower than when the ppp link is not active.
Tested on ESP32-S3 WROOM modules, ESP32-S3-WROOM-2-N32R8V and ESP32-S3-WROOM-1-N16R8CT
Can be reproduced with the following code.
from utils import timed_function
f = open("test.txt",'wb+')
@timed_function
def file_write_seq_access(blocksize):
chunk = b'\xff'4000
for i in range(blocksize//4000):
f.write(chunk)
file_write_seq_access(512000)
Function file_write_seq_access Time = 9395.923ms
Approximately 9 seconds to run after flash erase and mp install
Initiate pp connection
import network
import time
qw = network.PPP(self.uart)
qw.active(True)
time.sleep(0.5)
qw.connect(authmode=qw.AUTH_PAP, username="", password="")
count = 0
while qw.isconnected == False:
await asyncio.sleep(1)
count += 1
if count > 5:
raise
logger.debug(f'PPP connected')
After ppp link is established perform the same file write test.
from utils import timed_function
f = open("test.txt",'wb+')
@timed_function
def file_write_seq_access(blocksize):
chunk = b'\xff'4000
for i in range(blocksize//4000):
f.write(chunk)
file_write_seq_access(512000)
Function file_write_seq_access Time = 368099.125ms
Flash write now takes 368 seconds.