Open limin-liu opened 7 years ago
Hi, ESP-NOW does support broadcast in ESP8266 non OS SDK V2.1, we will revise the documentation. Thanks for reporting!
in the description for this repository's new update code . link here --->https://github.com/espressif/ESP8266_NONOS_SDK/commit/90c641efe84066b47c4616ed367697a9f49f3ac5
Version 2.1.0(116b762)
uart_div_modify
, which can support a 32-bit DivLatchValue in the SDK instead of the ROM one, and also remove uart_div_modify
from the ld file;void user_spi_flash_dio_to_qio_pre_init(void)
. If the dio to qio flash mode is not used, users can add an empty user_spi_flash_dio_to_qio_pre_init
on the application side to reduce iRAM usage;system_phy_freq_trace_enable
in user_rf_pre_init
to enable it;Hi, thanks for your reporting. The documentation has been updated, see Chapter 3.8 in API Guide. ESP-NOW supports broadcast in V2.1.
How can we perform a broadcast with ESP-NOW? Do we transmit to mac address {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}? Because I tried that and it didn't seem to work ...
I would like to use broadcasts to let ESP-NOW devices discover other devices, with which they haven't paired yet. Is that possible?
Could you enlighten me, @FayeY ?
from the header file it seems we have to set it to "null" "
/**
* @brief Send ESPNOW data
*
* @attention 1. If peer_addr is not NULL, send data to the peer whose MAC address matches peer_addr
* @attention 2. If peer_addr is NULL, send data to all of the peers that are added to the peer list
* @attention 3. The maximum length of data must be less than ESP_NOW_MAX_DATA_LEN
* @attention 4. The buffer pointed to by data argument does not need to be valid after esp_now_send returns
*
* @param peer_addr peer MAC address
* @param data data to send
* @param len length of data
*
* @return
* - ESP_OK : succeed
* - ESP_ERR_ESPNOW_NOT_INIT : ESPNOW is not initialized
* - ESP_ERR_ESPNOW_ARG : invalid argument
* - ESP_ERR_ESPNOW_INTERNAL : internal error
* - ESP_ERR_ESPNOW_NO_MEM : out of memory
* - ESP_ERR_ESPNOW_NOT_FOUND : peer is not found
* - ESP_ERR_ESPNOW_IF : current WiFi interface doesn't match that of peer
*/
esp_err_t esp_now_send(const uint8_t *peer_addr, const uint8_t *data, size_t len);
I don't have multiple ESP32's to test with yet, will report once I do, It seems that all peers still need to be in the peer list , but it seems that they will still recieve broadcast messages anyway ( from the API docs )
the MAC header is a little different from that of standard frames. The FromDS and ToDS bits of FrameControl field are both 0. The first address field is set to the destination address. The second address field is set to the source address. The third address field is set to broadcast address(0xff:0xff:0xff:0xff:0xff:0xff).
We also need to add a Peer to the peer list with MAC addr FF:FF:FF:FF:FF:FF
From this example it seems that un-peered devices will still recieve Broadcasts ( as expected )
That’s not a real broadcast if you ask me. I haven’t looked at the source code, but I presume that it just loops through the peers one by one, doesn’t it?
It would be cool to allow ESPs to discover each other by broadcasting, and then adding each other as peers.
Op 27 nov. 2017 om 19:34 heeft Daniel notifications@github.com het volgende geschreven:
from the header file it seems we have to set it to "null" "
/**
- @brief Send ESPNOW data
- @attention 1. If peer_addr is not NULL, send data to the peer whose MAC address matches peer_addr
- @attention 2. If peer_addr is NULL, send data to all of the peers that are added to the peer list
- @attention 3. The maximum length of data must be less than ESP_NOW_MAX_DATA_LEN
- @attention 4. The buffer pointed to by data argument does not need to be valid after esp_now_send returns
- @param peer_addr peer MAC address
- @param data data to send
- @param len length of data
- @return
- ESP_OK : succeed
- ESP_ERR_ESPNOW_NOT_INIT : ESPNOW is not initialized
- ESP_ERR_ESPNOW_ARG : invalid argument
- ESP_ERR_ESPNOW_INTERNAL : internal error
- ESP_ERR_ESPNOW_NO_MEM : out of memory
- ESP_ERR_ESPNOW_NOT_FOUND : peer is not found
- ESP_ERR_ESPNOW_IF : current WiFi interface doesn't match that of peer / esp_err_t esp_now_send(const uint8_t peer_addr, const uint8_t *data, size_t len); I don't have multiple ESP32's to test with yet, will report once I do
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.
It seems its a real broadcast .. if you send unencrypted data to peer addr ff:ff:ff:ff:ff:ff then any device on the same channel will receive it You need to add a peer with Addr ff:ff:ff:ff:ff:ff to the peer list otherwise it doesnt send the packet..
Device A :
Sending: 29
Send Status: Success
Last Packet Sent to: ff:ff:ff:ff:ff:ff
Last Packet Send Status: Delivery Success
Device B :
Last Packet Recv from: 24:0a:c4:yy:yy:yy
Last Packet Recv Data: 29
test .ino here ( quick modified version of the esp-Now example, flashed to 2 ESP32 dev boards ) Gist link
Oh, then I stand corrected!
However, I only have one ESP32 so I can't test it on the ESP32. I have multiple ESP8266s so I will have a try asap. 🙂 Or did you already try it with multiple ESP8266s?
This doesn't seem to be working for me. I am able to send things freely when I call
esp_now_send(da, "ESP8266", 8 ); /*Also tried sending to null */
However, I never seem to be able to receive anything. I've tried adding many different combinations but even this...
esp_now_register_recv_cb(espnowcb);
esp_now_register_send_cb(espnowcbtx);
uint8_t routermac[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff,}; //Src Address of my router.
printf( "PEERINFO: %d\n", esp_now_add_peer(routermac, ESP_NOW_ROLE_COMBO, 0, 0, 0) );
esp_now_set_self_role(ESP_NOW_ROLE_COMBO);
Nothing gets received.
I am able to look at Wireshark and see appropriate messages going back and forth.
One note: Your protocol described here: http://esp-idf.readthedocs.io/en/latest/api-reference/wifi/esp_now.html is incomplete. There are 4 undocumented bytes between the vendor-specific action frame and vendor-specific action content. I still do not understand what they do.
I encountered the same issue as @cnlohr where I can successfully send to FF:FF:FF:FF:FF:FF, but those broadcast packets are never received. @Daniel-dk said it is needed to add the broadcast address as a peer, however that fails with a return code of -3 (I haven't found any explanation of this function's return codes). I'm on SDK 2.2.1 (via the Arduino core 2.4.1)
@FayeY Can we please re-open this issue as it is definitely present in the current nonos sdk. I am stuck back at 1.5.2 for projects where this is needed.
I have the same Problem with esp8266. I can send boardcasts, but no esp8266 receive them.
Indeed. the issue is still very much open and very much a problem with the official NONOS sdk. I am not sure why espressif is leaving this issue closed.
I can confirm this problem too. Devs, do we have anyone working on this?
Thanks
I'm not really sure how to get their attention...
@cnlohr, as far as I'm concerned they might as well have abandoned esp8266 and are working on esp32. Most of them are dedicated to direct customers of espressif (for example alibaba), with features going into the SDK only if they need them for the customers.
If only everything could be open source... 🙄
@Junhao-Espressif, PTAL
@FayeY I am glad that Espressif is pursuing this again. It is much more powerful than any framework could be. By having true broadcast access, it opens a lot of doors that are unworkable with different options.
@FayeY I am coming up on a commercial project that will be using 2,500 units and I really could use this feature. I don't want to stick the customer with the old firmware version.
Hi @limin-liu @franklinvv @Daniel-dk @cnlohr
Please try using the following two files. After testing, we will update them on GitHub.
SDK ver: 3.0.0(e27cf60) compiled @ Sep 5 2018 15:35:05
phy ver: 1136_0, pp ver: 10.2
SDK version:3.0.0(e27cf60)
mode : sta(5c:cf:7f:14:c7:8a)
add if0
esp_now init ok
==================
CONTROLLER
==================
FF FF FF FF FF FF SEND SUCCESSFUL!
now from[5E CF 7F 14 C6 4A len: 13]:ACK[00000000]
FF FF FF FF FF FF SEND SUCCESSFUL!
now from[5E CF 7F 14 C6 4A len: 13]:ACK[00000001]
FF FF FF FF FF FF SEND SUCCESSFUL!
now from[5E CF 7F 14 C6 4A len: 13]:ACK[00000002]
FF FF FF FF FF FF SEND SUCCESSFUL!
now from[5E CF 7F 14 C6 4A len: 13]:ACK[00000003]
FF FF FF FF FF FF SEND SUCCESSFUL!
FF FF FF FF FF FF SEND SUCCESSFUL!
now from[5E CF 7F 14 C6 4A len: 13]:ACK[00000004]
FF FF FF FF FF FF SEND SUCCESSFUL!
SDK version:3.0.0(e27cf60)
mode : softAP(5e:cf:7f:14:c6:4a)
add if1
dhcp server start:(ip:192.168.4.1,mask:255.255.255.0,gw:192.168.4.1)
bcn 100
esp_now init ok
==================
SLAVE
==================
recv action mgment
now from[5C CF 7F 14 C7 8A len: 12]:Hello World!
5C CF 7F 14 C7 8A SEND SUCCESSFUL!
recv action mgment
now from[5C CF 7F 14 C7 8A len: 12]:Hello World!
5C CF 7F 14 C7 8A SEND SUCCESSFUL!
recv action mgment
now from[5C CF 7F 14 C7 8A len: 12]:Hello World!
5C CF 7F 14 C7 8A SEND SUCCESSFUL!
recv action mgment
now from[5C CF 7F 14 C7 8A len: 12]:Hello World!
5C CF 7F 14 C7 8A SEND SUCCESSFUL!
recv action mgment
now from[5C CF 7F 14 C7 8A len: 12]:Hello World!
5C CF 7F 14 C7 8A SEND SUCCESSFUL!
recv action mgment
now from[5C CF 7F 14 C7 8A len: 12]:Hello World!
5C CF 7F 14 C7 8A SEND SUCCESSFUL!
recv action mgment
now from[5C CF 7F 14 C7 8A len: 12]:Hello World!
5C CF 7F 14 C7 8A SEND SUCCESSFUL!
recv action mgment
now from[5C CF 7F 14 C7 8A len: 12]:Hello World!
5C CF 7F 14 C7 8A SEND SUCCESSFUL!
recv action mgment
now from[5C CF 7F 14 C7 8A len: 12]:Hello World!
5C CF 7F 14 C7 8A SEND SUCCESSFUL!
recv action mgment
now from[5C CF 7F 14 C7 8A len: 12]:Hello World!
5C CF 7F 14 C7 8A SEND SUCCESSFUL!
recv action mgment
now from[5C CF 7F 14 C7 8A len: 12]:Hello World!
I cannot look into this for another few days. But, I am eagerly going to try it out when I can!
@Junhao-Espressif I gave the libs posted on September 9th a try, and they worked! In the setup I called esp_now_add_peer() with NULL for the key, and 0 for the key length and was able to broadcast and receive unencrypted packets. Thanks!
Also I did my testing with @cnlohr, so I think those libs can be uploaded to the repository.
Is there a way to try the fix in lib_support_broadcast.tar.gz with the Arduino/ESP8266 code? When I try updating with the two files in lib_support_broadcast.tar.gz then all the compiles fail with:
C:\Arduino\ESP8266\181104\arduino-1.8.7\hardware\esp8266com\esp8266/tools/sdk/lib\libpp.a(pm_for_bcn_only_mode.o): In function `fpm_open':
/home/jhzhang/workspace/source_code/ESP8266_NONOS/esp8266_nonos_sdk_core/app/pp/pm_for_bcn_only_mode.c:227: undefined reference to `system_rf_cal_sector'
C:\Arduino\ESP8266\181104\arduino-1.8.7\hardware\esp8266com\esp8266/tools/sdk/lib\libpp.a(trc.o): In function `rcBuildIndex':
/home/jhzhang/workspace/source_code/ESP8266_NONOS/esp8266_nonos_sdk_core/app/pp/trc.c:414: undefined reference to `open_signaling_measurement'
collect2.exe: error: ld returned 1 exit status
exit status 1
Error compiling for board LOLIN(WEMOS) D1 R2 & mini.
Thats with the latest (today) Arduino/esp8266 github code where system_get_sdk_version() returns: 3.0.0-dev(c0f7b44)
I see libespnow.a and libpp.a were modified in b7ac6686ff7b906f6c80a45df02956e94d4b4566, but they are not identical to the files from lib_support_broadcast.tar.gz. @xcguang are the only differences compilation options, or did something else change?
@Junhao-Espressif Can you tell me how to implement this fix for a normal Esp8266 with Arduino IDE? As I cannot figure out how to install that file you posted, and I really need to be able to broadcast to get my project working. @AEFeinstein Or can you tell me how you got it working, if you were using an Arduino IDE that is? (this is for windows btw)
I was not using the Arduino IDE, I was using the non os sdk directly with a makefile on Linux. Sorry I cannot help you.
Hi @DavidAC95 ,
Could you tell me the SDK verison ?
@Junhao-Espressif the most recent ESP8266 core for the Arduino IDE (2.5.0-beta2) was released just yesterday and that uses SDK version 3.0.0-dev(c0f7b44).
@torntrousers
that uses SDK version 3.0.0-dev(c0f7b44)
not according to this file: https://github.com/esp8266/Arduino/blob/2.5.0-beta2/tools/sdk/version#L1
Mmm, interesting. I just now did a Serial.println(system_get_sdk_version());
on an ESP running the latest release and 3.0.0-dev(c0f7b44) is what that outputs.
@Junhao-Espressif I dont have the system in front of me at this moment. And I won't for a few weeks now but the last library update I did was for esp8266 2.4.2 which was on Dec 13th.
I too am interested in the Arduino IDE release of this fix.
@Junhao-Expressif has any progress been made on this issue for the Arduino IDE?
@ arduino users, please understand that espressif cannot answer here for arduino. Check the referenced issue above directing to the esp8266/arduino repository. Short answer, arduino still has not nonos-sdk-v3. Upgrading to this version is not straightforward as it was with older versions and we are currently busy with arduino core 2.5.0 stabilization. With espressif's vision of nonos-sdk's future, we need to think a bit more before our next step.
If thats the case then in the interim is there any possibility of having the ESP-Now broadcast fix thats in nonos-sdk-v3 back ported to the nonos-sdk version used in https://github.com/esp8266/Arduino/issues/5521#issuecomment-448383868?
@d-a-v I understand, then we will probably switch to the esp32 as we need broadcast capability. I do have one more question though, can the esp32 talk to esp8266? As in if we have the main hub being a esp32 could it broadcast to the esp8266s that we already have?
Hi
I have this issue too and have tried 2.5 beta2 and 2.4.2 and neither seem to work. I have changed the 2 libraries from 2.5 beta 2 to the ones about and then get linker errors. Anyone have broadcasting working?
@Junhao-Espressif any update on the bug?
@DavidAC95 I have an esp32 sending an espnow message to an esp8266 (directly using its mac address) and the esp8266 receiving it. Broadcasting from the esp32 to the esp8266 is what doesn't seem to work.
thanks
Lee.
Here's the fix for the Arduino library: https://github.com/esp8266/Arduino/issues/6174
In my experience, the Arduino framework uses a library that implements only pseudo broadcast.[1] So if you want to simply send messages to all devices, you will be satisfied. Protocol will not function if you have any requirements for time.
You may want to use the ESP-IDF framework based on freeRTOS. This version supports broadcast too. It isn't a real broadcast also.
But I'll be planning to inspect this problem in more detail. I'll actualize the information.
In your decribetion of code : WIFI
But in your reference V2.1.0 : 3.8 part for ESPNOW still "ESP-NOW do not support broadcast and multicast.“
So ESPNOW actually support broadcast or not?