Communication between two ESP8266 module

parmar7725274
Posts: 21
Joined: Wed Jun 03, 2015 1:20 pm

Re: Communication between two ESP8266 module

Postby parmar7725274 » Tue Jun 23, 2015 1:14 am

Hi Faye,

Please Help me to figure out problem.
Give some solution. I'm waiting for your response.

Thanks & Regards,
Prakash P.
Last edited by parmar7725274 on Thu Jul 20, 2017 4:04 pm, edited 1 time in total.

ESP_Faye
Posts: 1628
Joined: Mon Oct 27, 2014 11:08 am

Re: Communication between two ESP8266 module

Postby ESP_Faye » Mon Jun 29, 2015 5:22 pm

Hi,

Sorry that I can't duplicate your problem, could you please provide your whole test code ?

Or try it with another module, could it be the same problem? http://bbs.espressif.com/viewtopic.php?f=7&t=541&p=2348#p2348

I tried test code below ,and it works fine..

Code: Select all

void ICACHE_FLASH_ATTR
user_init()
{
   uart_init(BIT_RATE_115200, BIT_RATE_115200);

   #ifdef PLATFORM_DEBUG
   ets_uart_printf("ESP8266 platform starting...\r\n");
   #endif
   
   struct softap_config apConfig;
   struct ip_info ipinfo;
   char ssid[32];
   char password[33];
   char macaddress[17];
   char info[150];

   wifi_softap_dhcps_stop();

   if( wifi_get_phy_mode() != PHY_MODE_11N )
   {
      os_printf("*** Setting PHY_MODE ...\r\n");
      wifi_set_phy_mode( PHY_MODE_11N );
   }

   if(wifi_get_opmode() != SOFTAP_MODE)
   {
      #ifdef PLATFORM_DEBUG
      ets_uart_printf("ESP8266 not in SOFTAP mode, restarting in SOFTAP mode...\r\n");
      #endif
      wifi_set_opmode(SOFTAP_MODE);

   }

   IP4_ADDR(&ipinfo.ip, 10, 10, 10, 1);
   IP4_ADDR(&ipinfo.gw, 10, 10, 10, 1);
   IP4_ADDR(&ipinfo.netmask, 255, 255, 255, 0);

   wifi_set_ip_info(SOFTAP_IF, &ipinfo);

   //wifi_get_macaddr(SOFTAP_IF, macaddr);

   wifi_softap_get_config(&apConfig);

   os_memset(apConfig.ssid, 0, sizeof(apConfig.ssid));

   os_sprintf(ssid, "%s", WIFI_APSSID);

   os_memcpy(apConfig.ssid, ssid, os_strlen(ssid));

   if (wifi_get_opmode() == SOFTAP_MODE)
   {
      #if 1 //def WIFI_APWPA
      os_memset(apConfig.password, 0, sizeof(apConfig.password));
      os_sprintf(password, "%s", WIFI_APPASSWORD);
      os_memcpy(apConfig.password, password, os_strlen(password));
      apConfig.authmode = AUTH_WPA_WPA2_PSK;
      #else
      apConfig.authmode = AUTH_OPEN;
      #endif

      apConfig.channel = 1;
      apConfig.max_connection = 4;
      apConfig.ssid_hidden = 0;
     
      apConfig.ssid_len = 0;
      apConfig.beacon_interval = 100;

      wifi_softap_set_config(&apConfig);
     
      os_printf("wifi_softap_set_config %s %s!\r\n",apConfig.ssid, apConfig.password);
   }

   wifi_softap_dhcps_start();

   #if 1 //def PLATFORM_DEBUG
   os_printf("ESP8266 platform started!\r\n");
   #endif
}

parmar7725274
Posts: 21
Joined: Wed Jun 03, 2015 1:20 pm

Re: Communication between two ESP8266 module

Postby parmar7725274 » Tue Jul 07, 2015 2:30 am

Hi Faye,

Thanks for your kind HELP :D Error is solved and now Both ESP are able to connect each other.

But I have noticed that after every approx. 5 min STATION( client ) re-connects with SoftAP( server ).
With reference to post viewtopic.php?f=6&t=133
I have added following code but still it re-connects. Do you have any Idea why ?

Code: Select all

// Disabling Power saving mode
wifi_set_sleep_type( NONE_SLEEP_T );


And One more thing is that, When Client is trying to accomplish TCP Connection with Server it landed in reconnect
call back and Get Error code -11. Where I can get description of Error Code. Any Suggestion ? please.

Again Thank you for your help.

Thanks & Regards,
Prakash Parmar

ESP_Faye
Posts: 1628
Joined: Mon Oct 27, 2014 11:08 am

Re: Communication between two ESP8266 module

Postby ESP_Faye » Tue Jul 07, 2015 3:30 pm

Hi,

Sorry that I don't really understand what your question is .

Do you mean that you don't want ESP8266 station to try to reconnect AP when the connection break ?
Call wifi_station_set_reconnect_ policy can disable reconnect.

Thanks for your interest in Espressif Systems and ESP8266 !

william5858
Posts: 2
Joined: Fri Sep 23, 2016 11:06 am

Re: Communication between two ESP8266 module

Postby william5858 » Tue Mar 07, 2017 1:28 pm

If you use AP mode, the device join then leave.
Please use blank.bin to clean 0x7E000 and 0x3FE000 to solve this problem, these address base on flash size map 6.
station: f0:b4:29:3b:fc:ee join, AID = 1
station: f0:b4:29:3b:fc:ee leave, AID = 1

Who is online

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