ESP8266 Developer Zone The Official ESP8266 Forum 2017-07-20T16:04:03+08:00 https://bbs.espressif.com:443/feed.php?f=7&t=544 2017-03-07T13:28:36+08:00 2017-03-07T13:28:36+08:00 https://bbs.espressif.com:443/viewtopic.php?t=544&p=11442#p11442 <![CDATA[Re: Communication between two ESP8266 module]]> 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

Statistics: Posted by william5858 — Tue Mar 07, 2017 1:28 pm


]]>
2015-07-07T15:30:15+08:00 2015-07-07T15:30:15+08:00 https://bbs.espressif.com:443/viewtopic.php?t=544&p=2540#p2540 <![CDATA[Re: Communication between two ESP8266 module]]>
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 !

Statistics: Posted by ESP_Faye — Tue Jul 07, 2015 3:30 pm


]]>
2015-07-07T02:30:19+08:00 2015-07-07T02:30:19+08:00 https://bbs.espressif.com:443/viewtopic.php?t=544&p=2522#p2522 <![CDATA[Re: Communication between two ESP8266 module]]>
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:

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

Statistics: Posted by parmar7725274 — Tue Jul 07, 2015 2:30 am


]]>
2015-06-29T17:22:14+08:00 2015-06-29T17:22:14+08:00 https://bbs.espressif.com:443/viewtopic.php?t=544&p=2425#p2425 <![CDATA[Re: Communication between two ESP8266 module]]>
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:

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
}

Statistics: Posted by ESP_Faye — Mon Jun 29, 2015 5:22 pm


]]>
2017-07-20T16:04:03+08:00 2015-06-23T01:14:08+08:00 https://bbs.espressif.com:443/viewtopic.php?t=544&p=2343#p2343 <![CDATA[Re: Communication between two ESP8266 module]]>
Please Help me to figure out problem.
Give some solution. I'm waiting for your response.

Thanks & Regards,
Prakash P.

Statistics: Posted by parmar7725274 — Tue Jun 23, 2015 1:14 am


]]>
2015-06-19T01:35:44+08:00 2015-06-19T01:35:44+08:00 https://bbs.espressif.com:443/viewtopic.php?t=544&p=2316#p2316 <![CDATA[Re: Communication between two ESP8266 module]]>
I appreciate your patience,and thanks for your help.

From first time I understand what you are trying to say and I did it. And I also use your sample code, but in both case I'm getting same output.even though I also try with starting dhcp in STATION mode but no luck.

In your sample code for AP and STATION settings, whatever is given I iust copied and flash it on chip, but that is also not working.

Thanks again for your help, Would you like to suggest some solutions ? Please...

Thanks & Regards,
Prakash P.

Statistics: Posted by parmar7725274 — Fri Jun 19, 2015 1:35 am


]]>
2015-06-17T11:16:51+08:00 2015-06-17T11:16:51+08:00 https://bbs.espressif.com:443/viewtopic.php?t=544&p=2275#p2275 <![CDATA[Re: Communication between two ESP8266 module]]>
Espressif_Faye wrote:
Hi,

Here is a demo of ESP8266 softAP configuration http://bbs.espressif.com/viewtopic.php?f=21&t=227

Please notice that call “wifi_softap_get_config” first,otherwise,softap_config.ssid_len or softap_config.beacon_interval may be random value.. This may cause connection fail.

Thanks for your interest in ESP8266 !


Please pay attention on the softAP configuration demo,we recommended to call “wifi_softap_get_config” first,otherwise,softap_config.ssid_len or softap_config.beacon_interval may be random value.. This may cause connection fail.

Add codes below

Code:

      apConfig.ssid_len = 0;
      apConfig.beacon_interval = 100;

      wifi_softap_set_config(&apConfig);


Or just try codes below

Code:

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[33];
   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
}


Thanks for your interest in ESP8266 !

Statistics: Posted by ESP_Faye — Wed Jun 17, 2015 11:16 am


]]>
2015-06-17T01:40:13+08:00 2015-06-17T01:40:13+08:00 https://bbs.espressif.com:443/viewtopic.php?t=544&p=2269#p2269 <![CDATA[Re: Communication between two ESP8266 module]]>
Thanks for your humble help and spend your valuable time.

I had tried with above solution. But unfortunately it's still giving same problem.It's appreciated if you again take a look on log and suggest some solutions. please.

Again thanks for your help.

Thanks & regards,
Prakash P.

Statistics: Posted by parmar7725274 — Wed Jun 17, 2015 1:40 am


]]>
2015-06-16T14:33:53+08:00 2015-06-16T14:33:53+08:00 https://bbs.espressif.com:443/viewtopic.php?t=544&p=2253#p2253 <![CDATA[Re: Communication between two ESP8266 module]]>
Please try to add configuration of apConfig.beacon_interval

Code:

      apConfig.beacon_interval = 100;
      wifi_softap_set_config(&apConfig);


Thanks for your interest in ESP8266 !

Statistics: Posted by ESP_Faye — Tue Jun 16, 2015 2:33 pm


]]>
2015-06-13T13:44:16+08:00 2015-06-13T13:44:16+08:00 https://bbs.espressif.com:443/viewtopic.php?t=544&p=2203#p2203 <![CDATA[Re: Communication between two ESP8266 module]]>
I tried with each combination of SOFTAP_MODE and STATIONAP_MODE for AccessPoint
and STATION_MODE and STATIONAP_MODE for Station.

Every time Facing Same problem.

Thanks & Regards,
Prakash P.

Statistics: Posted by parmar7725274 — Sat Jun 13, 2015 1:44 pm


]]>
2015-06-13T13:26:30+08:00 2015-06-13T13:26:30+08:00 https://bbs.espressif.com:443/viewtopic.php?t=544&p=2202#p2202 <![CDATA[Re: Communication between two ESP8266 module]]>
Thanks for your help.

I'm facing some error. Can you take a look of log and suggest any solution ? Please.

SoftAp Log :

mode : sta(18:fe:34:9e:16:b5) + softAP(1a:fe:34:9e:16:b5)
add if0
dhcp server start:(ip:192.168.4.1,mask:255.255.255.0,gw:192.168.4.1)
add if1
bcn 100
add 1
aid 1
station: 18:fe:34:9e:18:21 join, AID = 1
station: 18:fe:34:9e:18:21 leave, AID = 1
rm match
add 1
aid 1
station: 18:fe:34:9e:18:21 join, AID = 1
station: 18:fe:34:9e:18:21 leave, AID = 1


Station log :

mode : sta(18:fe:34:9e:18:21)
add if0
scandone
add 0
aid 1
pm open phy_2,type:2 0 0
cnt
reconnect
rm match
pm close 7 0 0/10001392
scandone
add 0
aid 1
pm open phy_2,type:2 0 0
cnt
reconnect
rm match
pm close 7 0 0/10001361
scandone
add 0
aid 1
pm open phy_2,type:2 0 0
cnt
reconnect
rm match
pm close 7 0 0/10000192
WiFi connecting fail


Regards,
Prakash P.

Statistics: Posted by parmar7725274 — Sat Jun 13, 2015 1:26 pm


]]>
2015-06-05T10:11:58+08:00 2015-06-05T10:11:58+08:00 https://bbs.espressif.com:443/viewtopic.php?t=544&p=2061#p2061 <![CDATA[Re: Communication between two ESP8266 module]]>
Here is a demo of ESP8266 softAP configuration http://bbs.espressif.com/viewtopic.php?f=21&t=227

Please notice that call “wifi_softap_get_config” first,otherwise,softap_config.ssid_len or softap_config.beacon_interval may be random value.. This may cause connection fail.

Thanks for your interest in ESP8266 !

Statistics: Posted by ESP_Faye — Fri Jun 05, 2015 10:11 am


]]>
2015-06-05T01:41:15+08:00 2015-06-05T01:41:15+08:00 https://bbs.espressif.com:443/viewtopic.php?t=544&p=2059#p2059 <![CDATA[Re: Communication between two ESP8266 module]]>
Thanks for reply.

But unfortunateley I still facing same problem.

Here is code, which I'm using.

ESP-1 : SoftAp ( Access Point / SERVER )

Code:

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

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

   wifi_softap_dhcps_stop();

   if( wifi_get_phy_mode() != PHY_MODE_11N )
   {
      ets_uart_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);
      //after esp_iot_sdk_v0.9.2, need not to restart
      //system_restart();
   }

   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)
   {
      #ifdef 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;

      wifi_softap_set_config(&apConfig);
   }

   os_delay_us(500000);
   wifi_softap_dhcps_start();

   #ifdef PLATFORM_DEBUG
   if (wifi_get_opmode() == SOFTAP_MODE)
   {
      wifi_softap_get_config(&apConfig);
      os_sprintf(macaddress, MACSTR, MAC2STR(macaddr));
      os_sprintf(info,"OPMODE: %u, SSID: %s, PASSWORD: %s, CHANNEL: %d, AUTHMODE: %d, MACADDRESS: %s PHU MODE : %d\r\n",
               wifi_get_opmode(),
               apConfig.ssid,
               apConfig.password,
               apConfig.channel,
               apConfig.authmode,
               macaddress,
               wifi_get_phy_mode());
      ets_uart_printf(info);
   }
   #endif

   //BtnInit();

   #ifdef PLATFORM_DEBUG
   ets_uart_printf("ESP8266 platform started!\r\n");
   #endif
}


ESP-2 : Station mode ( CLIENT )

Code:

void platform_init( void )
{
   uint8 ret;
   char ssid[32]       = "NeelKanth";
   char password[64]    = "1234512345";

   struct station_config stationConf, stationConfig;

   ret = wifi_station_disconnect( );
   os_printf("\n\r wifi_station_disconnect : %d \n", ret);

  //wifi_station_dhcpc_stop( );

    //Setup wifi
    os_printf(" Start in STATION mode: %d \r\n",wifi_get_opmode());

    if( wifi_get_opmode() != STATION_MODE )
    {
       os_printf(" Start in STATION mode\r\n");
       wifi_set_opmode( STATION_MODE );               // Station Mode
    }

   wifi_set_phy_mode( PHY_MODE_11N );

   if( wifi_station_get_config( &stationConf ) )
   {
      os_memset( stationConf.ssid,       0, sizeof(stationConf.ssid) );
      os_memset( stationConf.password,    0, sizeof(stationConf.password) );

      os_sprintf( stationConf.ssid,       "%s", ssid );
      os_sprintf( stationConf.password,    "%s", password );

       //need not mac address
      stationConf.bssid_set = 0;

      if( !wifi_station_set_config( &stationConf ) )
      {
         os_printf("Failed to set STATION MODE configuration\r\n");
      }
   }

//   wifi_station_dhcpc_start( );

   ret = wifi_station_connect ( );
   os_printf("\n\r wifi_station_connect : %d \n", ret);

   wifi_station_set_auto_connect(1);

   if(wifi_station_get_config(&stationConfig))
   {
      os_printf("\nSTA config: OPMODE: %u, SSID: %s, PASSWORD: %s, PHy Mode : %d\r\n",
                                       wifi_get_opmode(),
                                       stationConfig.ssid,
                                       stationConfig.password,
                                       wifi_get_phy_mode() );
   }

}

/******************************************************************************
 * FunctionName : user_init
 * Description  : entry of user application, init user function here
 * Parameters   : none
 * Returns      : none
*******************************************************************************/
void user_init(void)
{

    system_timer_reinit();

    uart_init(BIT_RATE_115200, BIT_RATE_115200);

    platform_init();

   // network_init();

}


Please Help me !!

Thanks in advance.

- Prakash.

Statistics: Posted by parmar7725274 — Fri Jun 05, 2015 1:41 am


]]>
2015-06-04T10:18:21+08:00 2015-06-04T10:18:21+08:00 https://bbs.espressif.com:443/viewtopic.php?t=544&p=2047#p2047 <![CDATA[Re: Communication between two ESP8266 module]]>
Here is a demo of ESP8266 station connects to AP http://bbs.espressif.com/viewtopic.php?f=21&t=228

Please notice that "stationConf.bssid_set = 0; " need to be set.

Thanks for your interest in ESP8266 !

Statistics: Posted by ESP_Faye — Thu Jun 04, 2015 10:18 am


]]>
2015-06-04T01:02:49+08:00 2015-06-04T01:02:49+08:00 https://bbs.espressif.com:443/viewtopic.php?t=544&p=2042#p2042 <![CDATA[Communication between two ESP8266 module]]>
I have written firmware to configure ONE ESP as AccessPoint and another one as a STATION. Both are working fine with router, I means ESP8266 with Station configuration is able to connect with router and Using my cell phone I can connect ESP8266 which have SoftAP configuration. That means both are working fine but when I’m trying to Connect each other without router, Its not happening. ESP8266 with station configuration gives error NO ap found.

Any help ?

Thanks in advance.

Statistics: Posted by parmar7725274 — Thu Jun 04, 2015 1:02 am


]]>