cancel
Showing results for 
Search instead for 
Did you mean: 

LwIP (PPP) not work with X-CUBE-CELLULAR

SL61
Associate II

Hello,

I am evaluating PPP with X-CUBE-CELLULAR but it doesn't work on my board.

Test environment

  • SMT32 CubeIDE 1.6.0
  • Customized board (STM32L4A6VG) with the Quectel BG96 on UART interface (no flow control)
  • X-CUBE-CELLULAR V5.2

Purpose:

Using BG96 with PPP and BSD socket to connect to remote server. High level application developer can use socket api and develop on this board.

Problem:

Running Ping_Application, seems PPP is not working properly. Using socket mode is OK

ATD*99#<CR><CR><LF>
    CONNECT<CR><LF>
BG96:MODEM SWITCHES TO DATA MODE
ATCore:<<< DATA MODE SELECTED >>>
AUTOM TASK:  MODEM_PDN_ACTIVATING_STATE - PDP_ACTIVATED_EVENT
UTILS:ppposif_client_config
UTILS:client ppp_notify_phase_cb: PPP_PHASE_DEAD
UTILS:ppposif_client_dead: DC_SERVICE_OFF
 
UTILS:client ppp_notify_phase_cb: PPP_PHASE_INITIALIZE
Ping: Network is down
ComClt: Network is down
-----> New State: CST_PPP_CONFIG_ON_GOING_STATE <-----
AUTOM TASK:  CST_PPP_CONFIG_ON_GOING_STATE - PPP_CLOSED_EVENT
AUTOM TASK:  CST_PPP_CONFIG_ON_GOING_STATE - NO_EVENT
============ CST_cellular_service_task : autom_event = no event
UTILS:ppposif_config_timeout_timer_callback
=== CST_get_autom_event Fail !!! ===
LOG ERROR #1: channel=8 / errorId=1 / gravity=2
Ping: Network is down
ComClt: Network is down
-----> New State: MODEM_RESET_STATE <-----
AUTOM TASK:  MODEM_RESET_STATE - NO_EVENT
============ CST_cellular_service_task : autom_event = no event
AUTOM TASK:  MODEM_RESET_STATE - NO_EVENT
============ CST_cellular_service_task : autom_event = no event
AUTOM TASK:  MODEM_RESET_STATE - MODEM_INIT_EVENT
*********** CST_modem_reset_mngt ********
    UTILS:client ppp_notify_phase_cb: PPP_PHASE_DEAD
UTILS:ppposif_client_dead: DC_SERVICE_OFF

Here is my configuration in plf_features.h

/* ===================================== */
/* BEGIN - Cellular data mode            */
/* ===================================== */
 
/* Possible values for USE_SOCKETS_TYPE */
#define USE_SOCKETS_LWIP   (0)  /* define value affected to LwIP sockets type  */
#define USE_SOCKETS_MODEM  (1)  /* define value affected to Modem sockets type */
 
/* Sockets location */
#if !defined USE_SOCKETS_TYPE
#define USE_SOCKETS_TYPE   (USE_SOCKETS_LWIP)
#endif /* !defined USE_SOCKETS_TYPE */
 
/* ===================================== */
/* END - Cellular data mode              */
/* ===================================== */
 
/* ===================================== */
/* BEGIN - Applications to include       */
/* ===================================== */
#if !defined USE_ECHO_CLIENT
#define USE_ECHO_CLIENT    (0) /* 0: not activated, 1: activated */
#endif /* !defined USE_ECHO_CLIENT */
 
#if !defined USE_HTTP_CLIENT
#define USE_HTTP_CLIENT    (0) /* 0: not activated, 1: activated */
#endif /* !defined USE_HTTP_CLIENT */
 
#if !defined USE_PING_CLIENT
#define USE_PING_CLIENT    (1) /* 0: not activated, 1: activated */
#endif /* !defined USE_PING_CLIENT */
 
#if !defined USE_COM_CLIENT
#define USE_COM_CLIENT     (1) /* 0: not activated, 1: activated */
#endif /* !defined USE_COM_CLIENT */
 
#if !defined USE_MQTT_CLIENT
#define USE_MQTT_CLIENT    (0) /* 0: not activated, 1: activated */
#endif /* !defined USE_MQTT_CLIENT */
 
#if !defined USE_UI_CLIENT
#define USE_UI_CLIENT      (0) /* 0: not activated, 1: activated */
#endif /* !defined USE_UI_CLIENT */
 
/* MEMS Setup BEGIN */
/* USE_DC_MEMS enables MEMS management */
#if !defined USE_DC_MEMS
#define USE_DC_MEMS        (0) /* 0: not activated, 1: activated */
#endif /* !defined USE_DC_MEMS */
 
/* USE_SIMU_MEMS enables MEMS simulation management */
#if !defined USE_SIMU_MEMS
#define USE_SIMU_MEMS      (0) /* 0: not activated, 1: activated */
#endif  /* !defined USE_SIMU_MEMS */
/* MEMS Setup END */
 
/* if USE_DC_MEMS and USE_SIMU_MEMS are both defined, the behaviour of availability of MEMS board:
 if  MEMS board is connected, true values are returned
 if  MEMS board is not connected, simulated values are returned
 Note: USE_DC_MEMS and USE_SIMU_MEMS are independent
*/
 
/* use generic datacache entries */
#if !defined USE_DC_GENERIC
#define USE_DC_GENERIC     (1) /* 0: not activated, 1: activated */
#endif /* !defined USE_DC_GENERIC */
 
 
/* ===================================== */
/* END   - Applications to include       */
/* ===================================== */
 
/* ======================================= */
/* BEGIN -  Miscellaneous functionalities  */
/* ======================================= */
 
/* To activate Network Library */
#if !defined USE_NETWORK_LIBRARY
#if (USE_MQTT_CLIENT == 1)
#define USE_NETWORK_LIBRARY        (1) /* MqttClient use Network Library 1: activated */
#else  /* USE_MQTT_CLIENT == 0 */
#define USE_NETWORK_LIBRARY        (1) /* 0: not activated, 1: activated */
#endif /* USE_MQTT_CLIENT == 1 */
#endif /* !defined USE_NETWORK_LIBRARY */
 
/* If included then MbedTls Library is integrated */
/* USE_MBEDTLS must be included if USE_MQTT_CLIENT is activated */
#if !defined USE_MBEDTLS
#if (USE_MQTT_CLIENT == 1)
#define USE_MBEDTLS                (1) /* MqttClient use MbedTls Library 1: activated */
#else  /* USE_MQTT_CLIENT == 0 */
#define USE_MBEDTLS                (0) /* 0: not activated, 1: activated */
#endif /* USE_MQTT_CLIENT == 1 */
#endif /* !defined USE_MBEDTLS */
 
/* If included then ComPing library is integrated */
/* USE_COM_PING must be included if USE_NETWORK_LIBRARY or USE_PING_CLIENT are included */
#if !defined USE_COM_PING
#if ((USE_NETWORK_LIBRARY == 1) || (USE_PING_CLIENT == 1))
#define USE_COM_PING        (1) /* NetworkLibrary and PingClient use ComPing library 1: included */
#else  /* (USE_NETWORK_LIBRARY == 0) && (USE_PING_CLIENT == 0) */
#define USE_COM_PING        (0) /* 0: not included, 1: included */
#endif /* (USE_NETWORK_LIBRARY == 1) || (USE_PING_CLIENT == 1) */
#endif /* !defined USE_COM_PING */
 
/* If included then ComIcc library is integrated */
#if !defined USE_COM_ICC
#define USE_COM_ICC         (1)  /* 0: not included, 1: included */
#endif /* !defined USE_COM_ICC */
 
/* To include RTC service */
#if !defined USE_RTC
#define USE_RTC        (1) /* 0: not activated, 1: activated */
#endif /* !defined USE_RTC */
 
/* To configure some parameters of the software */
#if !defined USE_CMD_CONSOLE
#define USE_CMD_CONSOLE            (0) /* 0: not activated, 1: activated */
#endif /* !defined USE_CMD_CONSOLE */
 
#if !defined USE_DEFAULT_SETUP
#define USE_DEFAULT_SETUP          (0) /* 0: Use setup menu,
                                          1: Use default parameters, no setup menu */
#endif /* !defined USE_DEFAULT_SETUP */
 
/* Begin Stack analysis tools configuration */
#if !defined USE_STACK_ANALYSIS
#define USE_STACK_ANALYSIS         (1) /* 0: Stack analysis is not embedded
                                          1: Stack analysis is available */
#endif /* !defined USE_STACK_ANALYSIS */
 
#if (USE_STACK_ANALYSIS == 1)
#if !defined STACK_ANALYSIS_TIMER
/* Value of the timer to trace automatically the thread stack value
   To do this, stack analysis will create a thread
   unit is ms
   default value 0 : timer = 0U means feature not activated
   usage example :
   for long duration test, activate the timer to detect thread stack overflow.
   value example :
   1min:60000 - 5min: 300000 - 1h: 3600000 ...
*/
#define STACK_ANALYSIS_TIMER       (0U) /* default configuration: no thread stack display every x ms */
#endif /* !defined STACK_ANALYSIS_TIMER */
#endif /* USE_STACK_ANALYSIS == 1 */
/* End Stack analysis tools configuration */
 
#if !defined USE_BUTTONS
#define USE_BUTTONS               (0)  /* 0: not activated, 1: activated */
#endif /* !defined USE_BUTTONS */
 
#if !defined USE_LEDS
#define USE_LEDS                  (0)  /* 0: not activated, 1: activated */
#endif /* !defined USE_LEDS */
 
/* use UART Communication between two boards */
#if !defined USE_LINK_UART
#define USE_LINK_UART              (0) /* 0: not activated, 1: activated */
#endif /* !defined USE_LINK_UART */

What I already did:

  • Since USE_SOCKETS_TYPE  (USE_SOCKETS_LWIP) doesn't work, I try to use USE_SOCKETS_MODEM and it works without problem. Pin connection and SIM card should be OK.
  • I also used Quectel's QNavigator. Its PPP function is OK

​I am not sure if I missed something in configuration, especially software. The attachment is the full log when using LwIP. Thanks for your time.

Best,

Sean

4 REPLIES 4
S.RA
ST Employee

Dear Sean,

Can you please confirm that when you use USE_SOCKETS_MODEM and with QNavigator, it was also using GSM (EDGE)? Indeed, the in the log you have provided, we see that device is registered to GSM. Indeed, the RSSI of GSM is quite low and may be the connection is not stable. Also, the APN

Also, the Modem will regularly try to attach to Cat M or NB-IoT then it may lose time to search NB-IoT.

Can you share the log with USE_SOCKETS_MODEM?

Thanks

Best Regards

Solofo

SL61
Associate II

Dear Solofo,

Thanks for your reply. I attached the log with USE_SOCKETS_MODEM. The APN should be right (no user name and password) and we have checked it with the service provider. Here is a screenshot of QNavigator for your reference.

I also tried to use PAP by uncommenting this code but still not work. Perhaps I need to show the verbose debug log of LwIP but it takes me some time to use LwIP's debug feature with the trace component in X-CUBE-CELLULAR.

ppp_set_auth(ppp_pcb_client, PPPAUTHTYPE_PAP, "", "");

0693W00000ANr1rQAD.png 

I will try with another antenna and see if the result is different. Thanks for your time.

Best,

Sean

S.RA
ST Employee

Dear Sean,

I see that when you use QNAVIGATOR, the context is CMHK (AT+CGDCONT), but when you use X-CUBE-CELLULAR, I see that context is M2M (AT+CGDCONT), so I suspicious that the PDP context activation is rejected by the network.

As you use the X-CUBE-CELLULAR 5.2.0 for your project, you can change the APN using the setup menu (option 1: setup configuration menu. In this menu, you can change the APN to CMHK, once modified, you can store the configuration in the flash memory and restart the device.

Then please double check that before AT*99#, the correct APN is configured.

Best Regards

Solofo

SL61
Associate II

Dear Solofo,

Actually both APNs can be used for the service provider we use. Sorry for the misleading info. I have tried to swap APN settings but no luck.

0693W00000ANyAbQAL.pngI enabled the debug feature of LwIP. Seems the program is stuck at PAP authentication.

Best,

Sean