How to set VintageNetMobile service_provider.apn from ICCID

This should maybe be two separate questions but they seem related in terms of architecture. Both have to do with wanting to perform actions after VintageNet.configure is kicked off but before PPPD is started.

All this is for a Telit ME310 modem.

Part 1 - How to set VintageNetMobile service_provider.apn from ICCID

I may be crazy but I am trying to figure out if there is good point within the standard VintageNetMobile startup & configuration to inject a service_provider selection based on the SIMs ICCID? Similar to what VintageNetQMI does with ICCIDs and service_provider.

The problem I am running across is it seems the only place to do this is in the Chat script but that’s not dynamic. The chat script doesn’t get and record the SIM ICCID and then allow using it later as a parameter to a function. At least, not that I can see.

So far, the only solution I can see is our existing solution which is to make an independent GenServer solely for the purpose of connecting to the modem, getting the SIM data, then modifying the Configuration chat to use the correct APN, then kicking off the VintageNet.configure. But it still has the problem of ppp kicking off the CGDCONT and sending ATDT before GPRS is really ready.

Part 2 - How to perform a CREG validation before pppd?

We have a modem which seems to be connecting to cells that aren’t really valid (connect but no traffic due to no cell enhancement available. This seems to be because PPPD is attempting ATDT... before AT+CREG? has responded with a valid cell connection of 1 or 5. CREG may be responding that it is still searching but PPPD will be attempting to setup the interface because ATDT responded with a CONNECT but the cell isn’t fully setup.

Again, what I would like to be able to do is break this down into 2 steps.

  1. Configure the modem and wait for the GPRS to be fully running.
  2. Use PPPD to turn the GPRS into an internet pipe.

I can’t see how to do this with PPP Chat attempting to do everything.

I feel like I am missing something really simple. Wouldn’t a CREG response of 2 (not registered but searching) be a normal thing that PPP would need to wait for? Do other modems not respond with CONECT until CREG would show 1 or 5?

On the other hand, these issues may be why we are mostly handling it all in a GenServer that powers the modem, gets the SIM information, generates the config, then kicks off the VintageNet.configure. But it still has the issue with the CG

Ideally I think all would be solved using the existing VintageNet & VintageNetMobile architecture and libraries if there was a way to

  1. Power on and run some commands before setting the APN.
  2. Wait for the CREG to be 1 or 5 before attempting PPP or timing out, or aborting, if the value is 0 (not searching not registered) or 3 (denied)
  3. Now run PPP with ATDT…

This turned out to be sort of easy. The solution was to,

  • Remove the PPPDConfig.add_child_spec from the modem driver add_raw_config/3 definition.
  • Use PowerManager to handle the modem power-on + watchdog.
  • Have the modem driver handle AT commands for modem config, setup, etc.
  • Once the modem driver is happy with a ready modem, it initiates the PPPD child process.

So the change mostly boils down to, move the PPPD child from being a child of VintageNetMobile and at the same level as the modem driver, to a child of the modem driver.

1 Like