Skip to content
jia200x edited this page May 2, 2016 · 4 revisions

Driver logic and the PPP stack are running in the same thread for efficiency reasons. Because the nature of GSM connection involves a lot of different states and time outs (same for PPP), there are 2 new objects for handling the driver and PPP: GNRC PPP and PPPdev interface, analogue to GNRC's netdev2 and netdev2 interface.

The following pictures shows how this objects interact with SIM900 and RIOT:

GNRC PPP Schema

SIM900 driver

The device has command and data mode. While in command mode AT commands can be sent. In data mode the device only accepts PPP packets.

It operates in 2 phases:

  • Connection establishment phase: In this phase the modem set ups the PDP context for accessing data mode (with different AT commands). In case a command fail (e.g there's no connection to home network) the driver will keep trying to connect every X seconds.
  • Data mode: Once the first phase is done the modem sends a IPC signal to GNRC pppdev, so this module can start PPP negotiation.

In case of a disconnection due to a network problem or shutdown of device, the Link Control Protocol of PPP is in charge of try to setup a new connection. It can trigger back signals to the modem to ask for a wake up of the link. The case of disconnection due to power loss is still not handled.

PPPdev

The pppdev interface is almost the same as the netdev2 interface, but the isr function is replaced with a driver_event function that receives as parameters the ppdev object and an event. This way is easy to send information from and to the PPP stack. The rest of the functions are the same (recv, send, etc)

GNRC PPP

The GNRC PPP stack is composed of a Link Control Protocol, an Authentication protocol (optional) and one or more Network Control Protocols.

All control protocols (LCP and NCP) work with a Finite State Machine (see Option Negotiation Automaton) that handles in a very good way the negotiation. These protocols are stacked, and each protocol starts working only when it's lower protocol is in Opened state (a.k.a up).

The Link Control Protocol establishes and configures the PPP link between RIOT and a peer. After the link is done, authentication is negotiated if requested by LCP (not implemented yet) and then each Network Control Protocol starts the negotiation of the corresponding network layer (IPv4, IPv6, etc). Finally, PPP is ready for transporting network data through network encapsulator for each NCP.

The following image shows how this PPP protocols are stacked.

Schema of PPP stack

Each protocol can send messages to upper and lower layers, so after a layer finishes it automatically triggers the UP event of the next layer. The same in case of connection loss (LCP down event) or network layer not available (NCP down event).

For the moment, only Async Control Character Map and MRU are implemented in LCP, and the only network protocol available is IPCP (for IPv4). Nevertheless, is not hard to extend the number of protocols or configuration options due to the design of GNRC PPP.

Clone this wiki locally