Re: [lwip-users] LWIP+PPPos(GPRS)

2018-04-11 Thread vinimac



*I am designing a gateway and on my ATSAME53N20 (Atmel studio 7 IDE) I have
to connect a 3G modem(Quactel UG95) using a serial port. I can communicate
with the modem using AT commands. Now, I would like to use PPPos (PPP over
serial) library from LWIP 2.03 to enter in PPP mode. FreeRTOS has to
implement as this project will be running in a threaded environment.

Hi. This example helped me a lot:  pppos_client_main.c

 
.

It is working very good, but it is not processed through CHAP negotiation. 



--
Sent from: http://lwip.100.n7.nabble.com/lwip-users-f3.html

___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users


Re: [lwip-users] LWIP+PPPos(GPRS)

2018-03-27 Thread Patrick Klos

On 3/27/2018 3:17 PM, Sylvain Rochet wrote:

Hi,

On Tue, Mar 27, 2018 at 06:52:44AM -0700, bakmurat wrote:

*Modem transmits the following data:
CONNECT 720
~ÿ}#À!}!}!} }8}"}&} } } } }#}$À#}%}}8}0D}'}"}(}"™Ë~...  ...~ÿ}
#À!}!}!} }8}"}&} } } } }#}$À#}%}}8}0D}'}"}(}"™Ë~
NO CARRIER

"NO CARRIER" indicate a failure, are you sure pre-PPP stage actually
work ?


Without timestamps on the data, it's hard to pin down exactly what's 
happening.


It looks like the modems connected, then your device received some 
serial data (which are apparently the PPP packets), followed by a 
disconnect (likely due to not getting answers to the packets the other 
side sent after a reasonable amount of time)?


Can you log the data your device is trying to send over the modem as 
well?  (and dumping the serial data in hex would make decoding the 
packets a lot easier)


Patrick Klos
Klos Technologies, Inc.


___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users


Re: [lwip-users] LWIP+PPPos(GPRS)

2018-03-27 Thread Sylvain Rochet
Hi,

On Tue, Mar 27, 2018 at 06:52:44AM -0700, bakmurat wrote:
> 
> *Modem transmits the following data:
> CONNECT 720   
>   
> ~ÿ}#À!}!}!} }8}"}&} } } } }#}$À#}%}}8}0D}'}"}(}"™Ë~...  ...~ÿ}
> #À!}!}!} }8}"}&} } } } }#}$À#}%}}8}0D}'}"}(}"™Ë~
>   
> NO CARRIER 

"NO CARRIER" indicate a failure, are you sure pre-PPP stage actually 
work ?

Sylvain


signature.asc
Description: Digital signature
___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

[lwip-users] LWIP+PPPos(GPRS)

2018-03-27 Thread bakmurat
*I am designing a gateway and on my ATSAME53N20 (Atmel studio 7 IDE) I have
to connect a 3G modem(Quactel UG95) using a serial port. I can communicate
with the modem using AT commands. Now, I would like to use PPPos (PPP over
serial) library from LWIP 2.03 to enter in PPP mode. FreeRTOS has to
implement as this project will be running in a threaded environment.

*Firstly, I have completed all the necessary AT commands and dialed up
ATD*99***1#. Everything is working as expected. 

* Secondly, I need to proceed with LWIP(PPPos support) in order to get the
IP address. This part is
bit tough. I wrote some APIs such as sio_, sys_jiffies and linkStatusCB
functions and tried to open serial communication but it's not successful.
Link status call back says that there is a "connection lost" error. I
couldn't figure it out. 

*Modem transmits the following data:
CONNECT 720 
~ÿ}#À!}!}!} }8}"}&} } } } }#}$À#}%}}8}0D}'}"}(}"™Ë~...  ...~ÿ}
#À!}!}!} }8}"}&} } } } }#}$À#}%}}8}0D}'}"}(}"™Ë~  
NO CARRIER 

*MCU trasmits the following command and data:
ATD*99***1# 
~ÿ}#À!}!}!} }4}"}&} } } } }%}&[[ì} }'}"}(}"`?~

*my code goes at follows:

static void tcpip_init_done(void *arg)
{
if (arg) {
*((bool *)arg) = 1;
}
}

tcpip_init(tcpip_init_done, ); //tcpip init.
while (!setup) {
sleep(1);
}

io_write(usart, ATppp, sizeof(ATppp)/sizeof(ATppp[0]));//dials ATD*99#
vTaskDelay(1000);
pppos_example_init();

while(connected==0){
io_write(usart1, (uint8_t*)"Cant connect wait\r\n", 21);
vTaskDelay(1000);
}
if (connected)
{
io_write(usart1, (uint8_t*)"Success\r\n", 11);
}

*** My example function
static sio_fd_t ppp_sio;
static ppp_pcb *ppp;
static struct netif pppos_netif;

pppos_example_init(void)
{
  ppp_sio = sio_open(0);

  if(!ppp_sio)
  {
  //perror("PPPOS example: Error opening device");
  return;
  }
  ppp_init();
  ppp = pppos_create(_netif, ppp_output_cb, ppp_link_status_cb, NULL);
  if (!ppp)
  {
 // printf("PPPOS example: Could not create PPP control interface");
  return;
  }

#ifdef LWIP_PPP_CHAP_TEST
  ppp_set_auth(ppp, PPPAUTHTYPE_CHAP, "lwip", "mysecret");
#endif

  ppp_connect(ppp, 0);
  

#if LWIP_NETIF_STATUS_CALLBACK
  netif_set_status_callback(_netif, netif_status_callback);
#endif /* LWIP_NETIF_STATUS_CALLBACK */

  sys_thread_new("pppos_rx_thread", pppos_rx_thread, NULL, 1048, 1);
#endif /* PPP_SUPPORT */
}

***Other functions

ppp_output_cb(ppp_pcb *pcb, u8_t *data, u32_t len, void *ctx)
{
  return sio_write(ppp_sio, data, len);
}


***PPP thread

static void pppos_rx_thread(void *arg)
{
  u32_t len;
  u8_t buffer[128] = {0};
  LWIP_UNUSED_ARG(arg);

while (1) {
len = sio_read(ppp_sio, buffer, sizeof(buffer));
if (len > 0) {
  pppos_input_tcpip(ppp, buffer, len);
}
  }
}




--
Sent from: http://lwip.100.n7.nabble.com/lwip-users-f3.html

___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users