Search code examples
c++esp32lwippppesp-idf

Not receiving data in LCP(PPPoS) phase over UART(ESP-32 -> Sim7600)


On my ESP32 I am having trouble creating a working PPP interface to my ISP. I am using an ESP-32 Ethernet kit and have it hooked up to a Simcom EVB Kit with a Sim7600G chip. With this hardware I am using ESP-IDF in combination with LWIP to get the PPP connection going. At first I have to send all the corresponding AT commands to make sure it is actually ready for a PPP connection. These AT Commands are the following:

AT+CGDCONT=1,"IP","<APN>"
AT+CGACT=1,1
AT+CREG? <Must be 0,5 -> Registered and Roaming>
ATD*99***1# -> I receive "Connect 152000" and start the PPP phase.

After I received the Connect 152000 as a response, I start the PPP connection.

m_pPpp = pppapi_pppos_create(&netif, pppos_output_cb, ppp_link_status_cb, nullptr);
pppapi_set_default(m_pPpp);
pppapi_set_auth(m_pPpp, PPPAUTHTYPE_PAP, "", "");
err_t err = ppp_connect(m_pPpp, 0);

This is the output of the corresponding code:

ppp phase changed[2]: phase=0
ppp_connect[2]: holdoff=0
ppp phase changed[2]: phase=3
pppos_connect: unit 2: connecting
ppp_start[2]
ppp phase changed[2]: phase=6
pppos_send_config[2]: out_accm=FF FF FF FF
ppp_send_config[2]
pppos_recv_config[2]: in_accm=FF FF FF FF
ppp_recv_config[2]
ppp: auth protocols: PAP=1
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0xcd3e2cad> <pcomp> <accomp>]
I: pppos_output callback called
I: ppp_output_cb() len = 45
W: ip4addr: 0.0.0.0
W: his_ipaddr: 0.0.0.0
W: netmask: 255.255.255.255
pppos_write[2]: len=24
ppp_start[2]: finished

As far as I can see, it goes through a couple of phases regarding the PPP connection.

  • Phase 0(dead, obviously)
  • Phase 3(initialize)
  • Phase 6(Establish).

It will not continue after this. I see the pppos_output callback is being called, which is supposed to happen. As far as I understand this function is so you can write the PPP-data towards your UART device.

Seperately I have a task running in the background to poll my UART device for written data so I can write this to the pppos_input function. I never receive any data... I honestly have no idea where if I am missing something or how to troubleshoot this. Also the LWIP documentation is quite plain and is missing examples, which makes it even harder.

Additional things I have tried:

  • AT+CGDCONT=1,"PPP","APN". <- This will result in the Sim7600 never connecting and remains searching. Should I use these PDP settings or stay with IP?
  • Applied the above AT command and tried starting the PPP phase, hoping it would result in somehow connecting...

Solution

  • I have not found the solution to this problem with the mentioned frameworks. Instead I reverted to another dependency from the ESP-IDF: esp-modem. I managed to get a working solution by following the pppos-client and modem-console examples within my current software.