ESP8266 Developer Zone The Official ESP8266 Forum 2015-10-30T13:02:02+08:00 https://bbs.espressif.com:443/feed.php?f=7&t=689 2015-10-30T13:02:02+08:00 2015-10-30T13:02:02+08:00 https://bbs.espressif.com:443/viewtopic.php?t=689&p=4379#p4379 <![CDATA[Re: About new ESP-NOW functions on SDK 1.2.0]]> I already add this in my user_main.c still it shows error.What will be the issue?

Statistics: Posted by koltegirish97 — Fri Oct 30, 2015 1:02 pm


]]>
2015-10-30T11:46:18+08:00 2015-10-30T11:46:18+08:00 https://bbs.espressif.com:443/viewtopic.php?t=689&p=4376#p4376 <![CDATA[Re: About new ESP-NOW functions on SDK 1.2.0]]>
Please add the function as below in user_main.c.

Code:

void user_rf_pre_init(void)
{
}

/******************************************************************************
 * FunctionName : user_init
 * Description  : entry of user application, init user function here
 * Parameters   : none
 * Returns      : none
*******************************************************************************/
void user_init(void)
{
    os_printf("SDK version:%s\n", system_get_sdk_version());
... ...
}

Statistics: Posted by ESP_Faye — Fri Oct 30, 2015 11:46 am


]]>
2015-10-27T20:38:05+08:00 2015-10-27T20:38:05+08:00 https://bbs.espressif.com:443/viewtopic.php?t=689&p=4315#p4315 <![CDATA[Re: About new ESP-NOW functions on SDK 1.2.0]]> After compiling code of mesh it shows following error .Anybody knows how to resolve it.
LD build/app.out
c:/Espressif/ESP8266_SDK/lib\libmain.a(app_main.o): In function `user_uart_wait_tx_fifo_empty':
(.irom0.text+0x598): undefined reference to `user_init'
c:/Espressif/ESP8266_SDK/lib\libmain.a(app_main.o): In function `user_rf_pre_init':
(.irom0.text+0x804): undefined reference to `user_init'
collect2.exe: error: ld returned 1 exit status
C:/Users/Girish/worksorg/mesh/Makefile:187: recipe for target 'build/app.out' failed
mingw32-make.exe: *** [build/app.out] Error 1

18:05:56 Build Finished (took 1s.205ms)

Statistics: Posted by koltegirish97 — Tue Oct 27, 2015 8:38 pm


]]>
2015-10-22T22:14:17+08:00 2015-10-22T22:14:17+08:00 https://bbs.espressif.com:443/viewtopic.php?t=689&p=4240#p4240 <![CDATA[Re: About new ESP-NOW functions on SDK 1.2.0]]> Statistics: Posted by kolban — Thu Oct 22, 2015 10:14 pm


]]>
2015-10-21T14:05:13+08:00 2015-10-21T14:05:13+08:00 https://bbs.espressif.com:443/viewtopic.php?t=689&p=4200#p4200 <![CDATA[Re: About new ESP-NOW functions on SDK 1.2.0]]> Can anybody provide the sample code for ESP-NOW FUNCTIONS that I can get an idea to build communication between two esp modules.As I refer the code but it shows compilation error.

Statistics: Posted by koltegirish97 — Wed Oct 21, 2015 2:05 pm


]]>
2015-10-06T02:51:04+08:00 2015-10-06T02:51:04+08:00 https://bbs.espressif.com:443/viewtopic.php?t=689&p=3991#p3991 <![CDATA[Re: About new ESP-NOW functions on SDK 1.2.0]]>
I have two ESP modules. ESP - 01 and ESP 12q. I configured both of modules as follows :

ESP - 01 : mac address - 18:fe:34:9e:18:21
- set mode - STATION
- set role - CONTROLLER ( 1 )
- registered send and receive callback
- Add peer ESP-12q (mac - 5c:cf:7f:00:da:1d ) , role - SLAVE ( 02 ), channel - 1

ESP - 12 : mac address - 5c:cf:7f:00:da:1d
- set mode - STATION+AP
- set role - SLAVE ( 2 )
- registered send and receive callback
- add peer ESP-01 (mac - 18:fe:34:9e:18:21 ), role - CONTROLLER( 1 ), channel - 1

I check the return value of each function call and I get success.

Problem :-
When I'm sending packet from ESP - 01 using esp_now_send function. I'm getting success and send call back is called but On other end( ESP - 12q ) I'm not getting any Packet.

Please help me to solve this.

Thanks & Regards,
Prakash Parmar

Statistics: Posted by parmar7725274 — Tue Oct 06, 2015 2:51 am


]]>
2015-07-25T01:41:06+08:00 2015-07-25T01:41:06+08:00 https://bbs.espressif.com:443/viewtopic.php?t=689&p=2839#p2839 <![CDATA[Re: About new ESP-NOW functions on SDK 1.2.0]]> They are something like a poor man's MQTT for sending short messages between ESP8266 with very little overhead.
All ESP8266s must be on the same network, so this could be for sending data from sensors.

Statistics: Posted by Lurch — Sat Jul 25, 2015 1:41 am


]]>
2015-07-24T21:38:28+08:00 2015-07-24T21:38:28+08:00 https://bbs.espressif.com:443/viewtopic.php?t=689&p=2836#p2836 <![CDATA[Re: About new ESP-NOW functions on SDK 1.2.0]]> I am still very interested to learn a basic question ... "What are these new functions?" What are their purpose? I haven't yet been able to find any documentation on what "ESP-NOW" actually does for me? Can some kind soul offer a brief explanation?

Neil

Statistics: Posted by kolban — Fri Jul 24, 2015 9:38 pm


]]>
2015-07-24T21:30:10+08:00 2015-07-24T21:30:10+08:00 https://bbs.espressif.com:443/viewtopic.php?t=689&p=2835#p2835 <![CDATA[Re: About new ESP-NOW functions on SDK 1.2.0]]> I made a stupid mistake of not #include <espnow.h> in the begin. The compiler also never gives an error, strange.

Statistics: Posted by baoshi — Fri Jul 24, 2015 9:30 pm


]]>
2015-07-24T15:13:37+08:00 2015-07-24T15:13:37+08:00 https://bbs.espressif.com:443/viewtopic.php?t=689&p=2814#p2814 <![CDATA[Re: About new ESP-NOW functions on SDK 1.2.0]]>
1、I receive -4 error for all the esp_now_add_peer calls.
-> esp_now_add_peer needs 5 parameters, you lost the parameter channel.

2、The print in hello_cb is client:0, encrypted client:0. But esp_now_send seems successful.
-> This is because that esp_now_add_peer failed in question 1. We will optimize the return value of ESP-NOW APIs in next SDK.

Thanks for your interest in Espressif Systems and ESP8266 !

Statistics: Posted by ESP_Faye — Fri Jul 24, 2015 3:13 pm


]]>
2015-07-21T21:55:50+08:00 2015-07-21T21:55:50+08:00 https://bbs.espressif.com:443/viewtopic.php?t=689&p=2775#p2775 <![CDATA[Re: About new ESP-NOW functions on SDK 1.2.0]]>
I have this piece of code:

Code:

void user_init(void)
{
  int rc;
  // Configure the UART
  uart_init(BIT_RATE_115200, BIT_RATE_115200);
  ets_uart_printf("\n\n");
 
  wifi_set_opmode(1); // STATION
 
  u8 key[16]= {0x33, 0x44, 0x33, 0x44, 0x33, 0x44, 0x33, 0x44, 0x33, 0x44, 0x33, 0x44, 0x33, 0x44, 0x33, 0x44};
  u8 local[6] = {0x18, 0xfe, 0x34, 0x9c, 0x3e, 0xf0};   // This module in STATION mode
  u8 remote[6] = {0x1a, 0xfe, 0x34, 0x9c, 0x3e, 0xe5};   // Another modules in SOFTAP mode
 
  if (esp_now_init()==0)
  {
    ets_uart_printf("esp_now init ok\n");
    esp_now_register_recv_cb(simple_cb);
    ets_uart_printf("dlink send to A cur chan %d\n", wifi_get_channel());
    if (rc = esp_now_set_self_role(1)) ets_uart_printf("set_self_role failed %d\r\n", rc); // CONTROLLER
    if (rc = esp_now_add_peer(local, 1, key, 16)) ets_uart_printf("add_peer failed %d\r\n", rc);
    if (rc = esp_now_add_peer(remote, 2, key, 16)) ets_uart_printf("add_peer failed %d\r\n", rc);
  } else
  {
    ets_uart_printf("esp_now init failed\n");
  }
 
  // Set up a timer to send the message
  os_timer_disarm(&hello_timer);
  os_timer_setfn(&hello_timer, (os_timer_func_t *)hello_cb, (void *)0);
  os_timer_arm(&hello_timer, DELAY, 1);
}

LOCAL void ICACHE_FLASH_ATTR hello_cb(void *arg)
{
  u8 all_cnt, encrypt_cnt;

  if (esp_now_get_cnt_info(&all_cnt, &encrypt_cnt))
  ets_uart_printf("get_cnt_info failed\r\n");
  ets_uart_printf("client:%d, encrypted client:%d\r\n", all_cnt, encrypt_cnt);
  ets_uart_printf("send ");
  if (esp_now_send(NULL, "Hello", 6))
    ets_uart_printf("fail\r\n");
  else
    ets_uart_printf("ok\r\n");
}


I receive -4 error for all the esp_now_add_peer calls.
The print in hello_cb is client:0, encrypted client:0. But esp_now_send seems successful.

Any idea?

Thanks

Statistics: Posted by baoshi — Tue Jul 21, 2015 9:55 pm


]]>
2015-07-21T17:21:49+08:00 2015-07-21T17:21:49+08:00 https://bbs.espressif.com:443/viewtopic.php?t=689&p=2768#p2768 <![CDATA[Re: About new ESP-NOW functions on SDK 1.2.0]]>
1、The mode will effect the interface selection. And it can be used for judge some condition. We recommend to use slave mode for ESP8266 softAP or sta+softAP mode, controller mode for ESP8266 station mode.


2. If you want to send ESP-NOW package, the app layer must keep the channel in the same.

ESP-NOW is for smart-light project, usually we use device LIGHT on slave mode, device SWITCH on controller mode.

Statistics: Posted by ESP_Faye — Tue Jul 21, 2015 5:21 pm


]]>
2015-07-21T14:19:26+08:00 2015-07-21T14:19:26+08:00 https://bbs.espressif.com:443/viewtopic.php?t=689&p=2763#p2763 <![CDATA[Re: About new ESP-NOW functions on SDK 1.2.0]]>
I tried the code you provided.

It seems I always get -4 error from esp_now_add_peer call. It there any clue what I did wrongly? (esp_now_init and esp_now_set_self_role is ok).

Also, would you please give a little explanation what is CONTROLLER role and what is SLAVE role?

Thanks

Baoshi

Statistics: Posted by baoshi — Tue Jul 21, 2015 2:19 pm


]]>
2015-07-17T08:43:51+08:00 2015-07-17T08:43:51+08:00 https://bbs.espressif.com:443/viewtopic.php?t=689&p=2717#p2717 <![CDATA[Re: About new ESP-NOW functions on SDK 1.2.0]]>
I have two questions.

1. What is the difference between this controller mode and slave mode?

2. And, When the channel of the own and peer are not the same, esp8266 can send a packet to the peer esp8266?

3. I would like to know the meaning of the return value is 0 esp_now_is_peer_exist.
When we received the return 0, that esp8266 is going to disappear?

Thanks,

Peter.

Statistics: Posted by nice72 — Fri Jul 17, 2015 8:43 am


]]>
2015-07-15T11:05:35+08:00 2015-07-15T11:05:35+08:00 https://bbs.espressif.com:443/viewtopic.php?t=689&p=2682#p2682 <![CDATA[Re: About new ESP-NOW functions on SDK 1.2.0]]>
Sorry that ESP-NOW can not broadcast right now..

But we will think over your request, and let you know if there is any update.

Thanks for your interest in Espressif Systems and ESP8266 !

Statistics: Posted by ESP_Faye — Wed Jul 15, 2015 11:05 am


]]>
2015-07-14T20:45:45+08:00 2015-07-14T20:45:45+08:00 https://bbs.espressif.com:443/viewtopic.php?t=689&p=2665#p2665 <![CDATA[Re: About new ESP-NOW functions on SDK 1.2.0]]>
Ok, got it. Thanks!
I have another question.
Can I use a broadcast mac like: u8 da1[6] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
as destination so I can discover an unknown ESP8266 device then add it as my peer(slave)?

Statistics: Posted by Ivan — Tue Jul 14, 2015 8:45 pm


]]>
2015-07-14T17:55:17+08:00 2015-07-14T17:55:17+08:00 https://bbs.espressif.com:443/viewtopic.php?t=689&p=2663#p2663 <![CDATA[Re: About new ESP-NOW functions on SDK 1.2.0]]>
Sorry that ESP-NOW only support ESP8266 device..

Thanks for your interest in ESP8266 !

Statistics: Posted by ESP_Faye — Tue Jul 14, 2015 5:55 pm


]]>
2015-07-14T12:11:56+08:00 2015-07-14T12:11:56+08:00 https://bbs.espressif.com:443/viewtopic.php?t=689&p=2660#p2660 <![CDATA[Re: About new ESP-NOW functions on SDK 1.2.0]]>
Thanks for your response.
When I look at the example. It seems that the destination device must be an ESP8266 wifi module. Is that true?
Can I use ESP_NOW to send something to someone which is not an ESP device? like PC or mobile phone?

Statistics: Posted by Ivan — Tue Jul 14, 2015 12:11 pm


]]>
2015-07-13T17:44:27+08:00 2015-07-13T17:44:27+08:00 https://bbs.espressif.com:443/viewtopic.php?t=689&p=2639#p2639 <![CDATA[Re: About new ESP-NOW functions on SDK 1.2.0]]>
Here is a simple example

Code:

void ICACHE_FLASH_ATTR simple_cb(u8 *macaddr, u8 *data, u8 len)
{
   int i;
   u8 ack_buf[16];
   u8 recv_buf[17];
   os_printf("now from[");
   for (i = 0; i < 6; i++)
      os_printf("%02X, ", macaddr[i]);
   os_printf(" len: %d]:", len);
   os_bzero(recv_buf, 17);
   os_memcpy(recv_buf, data, len<17?len:16);
   show_buf2(data,len);
   if (os_strncmp(data, "ACK", 3) == 0)
     return;

   os_sprintf(ack_buf, "ACK[%08x]", ack_count++);
   esp_now_send(macaddr, ack_buf, os_strlen(ack_buf));
 }
void user_init(void)
{
   u8 key[16]= {0x33, 0x44, 0x33, 0x44, 0x33, 0x44, 0x33, 0x44, 0x33, 0x44, 0x33, 0x44, 0x33, 0x44, 0x33, 0x44};
   u8 da1[6] = {0x18, 0xfe, 0x34, 0x97, 0xd5, 0xb1};
   u8 da2[6] = {0x1a, 0xfe, 0x34, 0x97, 0xd5, 0xb1};
   if (esp_now_init()==0) {
      os_printf("esp_now init ok\n");
      esp_now_register_recv_cb(simple_cb);
      os_printf("dlink send to A cur chan %d\n", wifi_get_channel());

      esp_now_set_self_role(1);
      esp_now_add_peer(da1, 1, key, 16);
      esp_now_add_peer(da2, 2, key, 16)
   } else {
     os_printf("esp_now init failed\n");
     }
 }
void ICACHE_FLASH_ATTR demo_send_(u8 *data, u8 len)
{
  /* the demo will send to two devices which added by esp_now_add_peer() */
    esp_now_send(NULL, data, len);

}

Statistics: Posted by ESP_Faye — Mon Jul 13, 2015 5:44 pm


]]>
2015-07-11T23:55:53+08:00 2015-07-11T23:55:53+08:00 https://bbs.espressif.com:443/viewtopic.php?t=689&p=2626#p2626 <![CDATA[Re: About new ESP-NOW functions on SDK 1.2.0]]>
Neil

Statistics: Posted by kolban — Sat Jul 11, 2015 11:55 pm


]]>
2015-07-08T16:09:26+08:00 2015-07-08T16:09:26+08:00 https://bbs.espressif.com:443/viewtopic.php?t=689&p=2572#p2572 <![CDATA[Re: About new ESP-NOW functions on SDK 1.2.0]]>
I'm also interested. Let me know if you get something.

Thanks & Regards,
Prakash P.

Statistics: Posted by parmar7725274 — Wed Jul 08, 2015 4:09 pm


]]>
2015-07-06T09:55:31+08:00 2015-07-06T09:55:31+08:00 https://bbs.espressif.com:443/viewtopic.php?t=689&p=2500#p2500 <![CDATA[About new ESP-NOW functions on SDK 1.2.0]]>
Could you please kindly provide an example on how to use the new ESP-NOW functions on SDK 1.2.0?
I think I really need this for my project but just no idea on how to use it.
Thanks!

Statistics: Posted by Ivan — Mon Jul 06, 2015 9:55 am


]]>