PPPoS interface disconnection event is not always calling the registered disconnect callback function

User avatar
rajkumar patel
Posts: 29
Joined: Mon Apr 10, 2017 12:43 pm
Location: india

PPPoS interface disconnection event is not always calling the registered disconnect callback function

Postby rajkumar patel » Tue Aug 14, 2018 7:22 am

hi,
in my implementation, i am getting internet connectivity for esp32 from a modem(BM817C-E1) over PPPoS interface. after several hours of faithful communication i am getting the disconnection event for the PPP interface. i am getting this event on uart interface, and this event is passed to the LWIP pppos stake for internal process and then in turn to call the registered disconnection callback function.
so this is the flow.

as soon as i am getting the disconnection event i am starting a state machine to reestablish the ppp connection. but, it is observed that, when i get the disconnection event over uart it gets entered into the lwip(pppos)stake but the registered callback function for disconnection event is not getting called always. and due to this my state machine fails to recover the connectivity.

has anyone faced the same issue? please give your comments. :!:

p.s : i have used v2.1 idf.
Regards,
Rajkumar M. Patel

Ritesh
Posts: 1383
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: PPPoS interface disconnection event is not always calling the registered disconnect callback function

Postby Ritesh » Tue Aug 14, 2018 9:17 am

Hi Loboris,

We have taken below example for our reference purpose regarding PPP component porting and facing some issues while testing with GSM Module which is mentioned above.

https://github.com/loboris/ESP32-PPPOS- ... ents/pppos

so, Would you please check from your side and provide comment or feedback if any regarding that issue
Regards,
Ritesh Prajapati

Ritesh
Posts: 1383
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: PPPoS interface disconnection event is not always calling the registered disconnect callback function

Postby Ritesh » Wed Aug 15, 2018 8:53 am

Hi Loboris and Espressif Developer,

Did you get chance to look above issue which right now we are facing while testing PPP component over GSM module?

Let me know if need any more details regarding issue.
Regards,
Ritesh Prajapati

Ritesh
Posts: 1383
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: PPPoS interface disconnection event is not always calling the registered disconnect callback function

Postby Ritesh » Wed Aug 15, 2018 12:41 pm

Hi Loboris,

Did you face this type of issue at your end?
Regards,
Ritesh Prajapati

mr1000
Posts: 23
Joined: Fri Jan 12, 2018 9:05 am

Re: PPPoS interface disconnection event is not always calling the registered disconnect callback function

Postby mr1000 » Mon Oct 15, 2018 11:08 am

Hi Ritesh, have you found a solution or workaround for this issue?

I have the same problem, for example if ESP is downloading a file via GSM and I remove the SIM card (just to simulate an interruption of the connection) the program gets stuck because PPP callback isn't called...

Do you think is a bug from PPP library?

Can't find anymore information about this on this forum, only this thread

Thanks in advance

Ritesh
Posts: 1383
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: PPPoS interface disconnection event is not always calling the registered disconnect callback function

Postby Ritesh » Mon Oct 15, 2018 1:12 pm

mr1000 wrote:Hi Ritesh, have you found a solution or workaround for this issue?

I have the same problem, for example if ESP is downloading a file via GSM and I remove the SIM card (just to simulate an interruption of the connection) the program gets stuck because PPP callback isn't called...

Do you think is a bug from PPP library?

Can't find anymore information about this on this forum, only this thread

Thanks in advance
Hi,

We have put GSM Module reset state machine into LWIP Library which we have developed for our GSM module

I think you need to add handler or provision regarding PPP callback function into your state machine once you get SIM card removal detection event.

Would you please check it from your PPP application component first which is giving this type functionalities or not?

Also, Would you please provide few more details regarding GSM module which you are using and your end application into brief so that it will be helpful to provide response for same as quickly as possible.
Regards,
Ritesh Prajapati

mr1000
Posts: 23
Joined: Fri Jan 12, 2018 9:05 am

Re: PPPoS interface disconnection event is not always calling the registered disconnect callback function

Postby mr1000 » Tue Oct 16, 2018 6:28 am

Ritesh wrote: Hi,

We have put GSM Module reset state machine into LWIP Library which we have developed for our GSM module

I think you need to add handler or provision regarding PPP callback function into your state machine once you get SIM card removal detection event.

Would you please check it from your PPP application component first which is giving this type functionalities or not?

Also, Would you please provide few more details regarding GSM module which you are using and your end application into brief so that it will be helpful to provide response for same as quickly as possible.
My GSM module don't support SIM card removal detection, but I'm removing it to simulate I lose connection with network.

My program is similar to Loboris example (https://github.com/loboris/ESP32-PPPOS-EXAMPLE)

I'm using the GSM module to download a 70-100kb file from a server using HTTPS and store it to ESP32

Ritesh
Posts: 1383
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: PPPoS interface disconnection event is not always calling the registered disconnect callback function

Postby Ritesh » Tue Oct 16, 2018 8:21 am

mr1000 wrote:
Ritesh wrote: Hi,

We have put GSM Module reset state machine into LWIP Library which we have developed for our GSM module

I think you need to add handler or provision regarding PPP callback function into your state machine once you get SIM card removal detection event.

Would you please check it from your PPP application component first which is giving this type functionalities or not?

Also, Would you please provide few more details regarding GSM module which you are using and your end application into brief so that it will be helpful to provide response for same as quickly as possible.
My GSM module don't support SIM card removal detection, but I'm removing it to simulate I lose connection with network.

My program is similar to Loboris example (https://github.com/loboris/ESP32-PPPOS-EXAMPLE)

I'm using the GSM module to download a 70-100kb file from a server using HTTPS and store it to ESP32
Ok. Understood.

If you GSM module doen't support SIM Card removal detection then you need to implement which will reset your GSM module based on retried of command response.

After that once GSM module will be reset then you will get initially like SIM Card is not inserted from GSM init process itself.

Hope this will be helpful for your requirement to fulfill it. Still, let me know if any doubt regarding that
Regards,
Ritesh Prajapati

mr1000
Posts: 23
Joined: Fri Jan 12, 2018 9:05 am

Re: PPPoS interface disconnection event is not always calling the registered disconnect callback function

Postby mr1000 » Tue Oct 16, 2018 11:27 am

Ritesh wrote:Ok. Understood.

If you GSM module doen't support SIM Card removal detection then you need to implement which will reset your GSM module based on retried of command response.

After that once GSM module will be reset then you will get initially like SIM Card is not inserted from GSM init process itself.

Hope this will be helpful for your requirement to fulfill it. Still, let me know if any doubt regarding that
Thank you Ritesh.

So in the GSM state machine where I send bytes to tcpip layer, I should check there the data and see if I'm reading some error message from GSM?

Code: Select all

int len = uart_read_bytes(gsm_uartNum, (uint8_t*)gsm_data, GSM_BUF_SIZE, 30 / portTICK_RATE_MS);
if (len > 0)
{
           //do a check for errors of what I read from GSM before calling ppos_input_tcpip?
            err_t err = pppos_input_tcpip(ppp, (u8_t*)gsm_data, len);
            if( err != ERR_OK )
            {
                  #if GSM_DEBUG
                  sprintf( debugBuffer, "GSM: err: %d\n", err);
                  uart_write_bytes( UART_NUM_2, debugBuffer, strlen(debugBuffer) );
                  #endif
            }
            xSemaphoreTake(pppos_mutex, PPPOSMUTEX_TIMEOUT);
            pppos_tx_count += len;
            xSemaphoreGive(pppos_mutex);
}
Cheers

Ritesh
Posts: 1383
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: PPPoS interface disconnection event is not always calling the registered disconnect callback function

Postby Ritesh » Tue Oct 16, 2018 11:53 am

mr1000 wrote:
Ritesh wrote:Ok. Understood.

If you GSM module doen't support SIM Card removal detection then you need to implement which will reset your GSM module based on retried of command response.

After that once GSM module will be reset then you will get initially like SIM Card is not inserted from GSM init process itself.

Hope this will be helpful for your requirement to fulfill it. Still, let me know if any doubt regarding that
Thank you Ritesh.

So in the GSM state machine where I send bytes to tcpip layer, I should check there the data and see if I'm reading some error message from GSM?

Code: Select all

int len = uart_read_bytes(gsm_uartNum, (uint8_t*)gsm_data, GSM_BUF_SIZE, 30 / portTICK_RATE_MS);
if (len > 0)
{
           //do a check for errors of what I read from GSM before calling ppos_input_tcpip?
            err_t err = pppos_input_tcpip(ppp, (u8_t*)gsm_data, len);
            if( err != ERR_OK )
            {
                  #if GSM_DEBUG
                  sprintf( debugBuffer, "GSM: err: %d\n", err);
                  uart_write_bytes( UART_NUM_2, debugBuffer, strlen(debugBuffer) );
                  #endif
            }
            xSemaphoreTake(pppos_mutex, PPPOSMUTEX_TIMEOUT);
            pppos_tx_count += len;
            xSemaphoreGive(pppos_mutex);
}
Cheers
Yeah. something like that you need implement state machine for that
Regards,
Ritesh Prajapati

Who is online

Users browsing this forum: Bing [Bot] and 50 guests