[lwip-users] esp32 and atsame

2018-07-05 Thread bakmurat
I have ATSAME MCU and ESP32. 

I used ready to use esp-idf examples to create tcpip client in eclipse with
ESP32(standalone) and its working great.

Now, I want to make a tcp_client using ESP32 module together with ATSAME53.
ATSAME will be acting as the main MCU and I want to create a client using
netconn APIs in lwip which will be in ATSAME. ESP32 uart pins connected to
uart pins in ATSAME. I want ESP32 to be just bridge and give data from the
router(internet) to ATSAME which will use lwip to process it and create a
netconn client. 

(ESP-->ATSAME)
I changed inside wlanif_input(struct netif *netif, void *buffer, u16_t len,
void* eb) function in ESPlwip and send the buffer(packet) to ATSAME using
uart(instead of tcpip_thread). I want packets to be processed in ATSAMElwip.
When I received packets from ESP32 in ATSAME side, I called tcpip_input(p,
_STACK_INTERFACE_0_desc) to send it to tcpip_thread to be processed. 

(ATSAME-->ESP)
Coming packets from ATSAMElwip were sent to esp32 using netif->output=
etharp_output fn which was modified to send using uart. Received pacets in
ESP were sent to wifimodule using low_level_output function and sent using
esp_wifi_internal_tx(wifi_if, q->payload, q->len);

*But I have problems with creating netif. Shall I have two separate
netifs(one in ESP and one in ATSAME), are two netif equally important?
*Is it possible to realize whats in my mind?



--
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


[lwip-users] how to measure signal str without closing netconn.(LWIP, PPP, netconn, AT commands)

2018-05-16 Thread bakmurat
I created a client(using LWIP, netconn functions) and receiving and sending
back the data I received from the server. Loop is [netconn_recv and
netconn_write]. Netconn client
 

Moreover, I have to measure the signal strength of Module. Currently, I am
using (delay1s)+++(delay1s), AT+CSQ, ATO to go to command mode(without
closing PPP), measure signal strength and, ATO to go back to data mode.

However, the problem is that when I try to measure the signal str. I go to
comm mode, measure sig.str., back to data mode but I cant receive or write
any more. As a result after netconn_rcv in server gives timeout and client
close, delete and connects again, than recv and write data until next
sig.str. measure function.

How can I stop the netconn_recv or netconn_write for a while until I measure
the signal str and resume where it was left over. Is it possible? I don't
want to close, delete and connect again. I want to resume recv and write fn
where it was left.



--
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


[lwip-users] how to measure signal str without closing netconn.(LWIP, PPP, netconn, AT commands)

2018-05-16 Thread bakmurat
I created a client(using LWIP, netconn functions) and receiving and sending
back the data I received from the server. Loop is [netconn_recv and
netconn_write]. Netconn client
 

Moreover, I have to measure the signal strength of Module. Currently, I am
using (delay1s)+++(delay1s), AT+CSQ, ATO to go to command mode(without
closing PPP), measure signal strength and, ATO to go back to data mode.

However, the problem is that when I try to measure the signal str. I go to
comm mode, measure sig.str., back to data mode but I cant receive or write
any more. As a result after netconn_rcv in server gives timeout and client
close, delete and connects again, than recv and write data until next
sig.str. measure function.

How can I stop the netconn_recv or netconn_write for a while until I measure
the signal str and resume where it was left over. Is it possible? I don't
want to close, delete and connect again. I want to resume recv and write fn
where it was left.



--
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


[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