ESP32 with ATSAME(main MCU) create netconn client in ATSAMElwip

1 post / 0 new
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have ATSAME MCU and ESP32. 


I  used ready to use esp-idf examples to create http_request in eclipse with ESP32(standalone).


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. 


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 to process). I want packets to be processed in ATSAMElwip. When I received packets from ESP32 in ATSAME side, I called tcpip_input(p, &TCPIP_STACK_INTERFACE_0_desc) to send it to tcpip_thread to be processed.  


Coming packets from ATSAMElwip were sent to esp using tcpip_output_raw (I created it and called from TCPIP_STACK_INTERFACE_0_stack_init fn) and received in ESP 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)?
*Is it possible to realize whats in my mind?


*********        **********
| ESP32 tx|---->|rx  ATSAME|
|           rx|<----|tx              |
*********        **********