LwIP pppos (ppp over serial) for modems using FreeRTOS + SAM4E16E?

I am designing a gateway and on my ATSAM4E16E, I have connected the LTE modem(SARA-R412M) using a USART port. I can communicate (and i have activated data mode) with the modem using AT commands.

Now, I would like to use PPPos (PPP over serial) library from LWIP 2.1.2 as tcpip stack with freertos. FreeRTOS has to implement as this project will be running in a threaded environment.

I have essayed to use this example:

Can you please help me how you have tested this pppos_client (used for ESP32) and adapted it to SAM MCU ?

Can you send a sample example that you have test in your sam board please ?

Best regards

Do you have a question specific to how to adapt this to FreeRTOS, or is this more of an lwIP question? If the latter I would recommend asking on the lwIP mailing list.

It’s in the Lwip and freertos question:

  • If we have lwip integrated in freertos we don’t need to adapt our code each time to the type of microcontrollers low level function (such exemple usart_write for sam and other function for other type of mcu).

  • Lwip question because i see that the most pppos example used for specific mcu. (stm32, esp32, …).

As you know i think, already tcpip stack integrated in freertos but it still used for ethernet network interface. For me i need to use lwip point to point protocol over serial in order to use my sara-r21m connected using usart to my board based on sam4e16e. for this reason lwip already lwip has pppos functions implemented , and if you have seen the code that i shared describ an example of using lwip-pppos for esp32 using freertos os tasks.

I’m working in how to use pppos with freertos (threads, tasks), i have to figure out some errors about tcpip_init() and pppos_input_tcpip().
What i’m looking for and need help in, is how to adapt the code to works as part in freertos independent of the microcontrollers and hardware used.

Please don’t hesitate if you can help me specifically and added an other function most needed in freertos.


Here is an example application note of using lwip with SAME54. Please note it does not necessarily use freertos

Thank you for sharing this example for Ethernet as low layer but in my case I have usart as low network layer, (tcpip standard, osi…).

This example is using Ethernet as low level layer (connected to tcpip stack in our case lwip) of OSI Standard, I have already tested it.

My case i have my device based on sam4e16 mcu, this microcontroller connected to my lte modem sara-r413m via USART.

In order to connect my modem to tcpip stack lwip. I need point-to-point protocol over serial that allows to encapsulation ip packets to Serial.

I have dial-up my lte modem as ppp mode, my problem is to make it working using pppos.

There’s some examples for esp32, stm32 but not for SAM MCU

Best regards

The only other application note is UART to Ethernet gateway. Please check this out

Thank you for your response, i have not used usart-ethernet adapter. In my case ( no Ethernet used) sara-412m (sim card to Internet) modem is connected using usart to main microcontroller sam4e16e.
I have implemented those steps as described in this link:

  1. Activate data mode ATD99**1#
  2. tcpip init
  3. pppos session creation
  4. pppos connection (my problem is in this step, i got failed to connect)

If some one has already an example (PPP over serial, such as wired dialup modems or mobile telecommunications LTE modems), i appreciate your help.

Best regards

Hi All.
I have arrived to run ppp protocol over serial (SYS_NO = 0 <=> OS FreeRTOS) via my LTE modem SARA-R412M.
Now i’m looking to use websockets in C
Can anyone have suggestion about supported websockets libraries most used with FreeRTOS ?


I would be great if you could zip up the project that is using websockets and attach it to your post in the forum - that way somebody wanting to do the same thing in the future would be able to use it as a reference.

Thank you for your proposition.
In my last comment i told that LTE modem connected using PPPoS.
I have attached picture of (trace) tcp/ip stack is running in FreerRTOS.
**I have not yet tested websockets, i’m working on it now. **

I still have to figure out the default value of remote IP address:
Why i receive the same remote IP address: defaulting to ?