esp8266: esp_wifi netdev driver#10792
Conversation
|
I think this needs a rebase, as the runtime config stuff is merged now. |
Yes, but we could do this later after reviewing it. Travis doesn't fail with doccheck. |
|
get a compile error, something lwip related, maybe need to add the package as a dependency? I tried that but ran in further problems. Here the error when just adding |
|
@smlng I have investigated your compilation problem a bit more. It seems that @kaspar030 If I can fix it in the toolchain, do you see any chance to get it in riotdocker and murdock in short term? Otherwise, I would have to provide |
Can we find another solution? I did not try, but I expect issues when someone tries to use |
|
Maybe adding an |
There will be no chance to use esp8266 with RIOT's
Where would you suggest to use this? |
|
Maybe, I give some more implementation details to understand why esp8266 WiFi cannot be used without the vendor Unfortunatly, esp8266 WiFi interface is a deep black bock, absolutely no API and no documentation. Even though there are some experiments from reverse enginieering to access the WiFi interface, there is no successful approach. Therefore, the WiFi interface can only be used with Espressif's SDK. However, this SDK only provides only a high level API for WiFi access on top of the That is, there is no chance to use the WiFi interface (neither module One further implementation detail. Since there are no low level API functions to send a frame or to receive a frame, the only chance to get module /** override lwIP ethernet_intput to get ethernet frames */
extern err_t __real_ethernet_input(struct pbuf *pb, struct netif* netif);
err_t __wrap_ethernet_input(struct pbuf *pb, struct netif* netif)
{
ESP_WIFI_DEBUG("%p %p", pb, netif);
_esp_wifi_recv_cb(pb, netif);
return ERR_OK;
}So what are the options:
IMHO, option 1 is much better than option 2. BTW, even though ESP-NOW uses IEEE802.11 vendor action frames, Espressif's implementation depends also on the SDK and thus on their |
|
@smlng I could fix the compilation problem without touching the toolchain. |
85198d3 to
b34c4d1
Compare
|
I think +1 to option 1, I talked to quite a few people that chose other platforms because esp8266 wifi wasn't supported on RIOT. I think something is better than nothing assuming it doesn't corrupt anything else. |
I'm also voting for option 1. If at some point in the future there will be a cleaner way for getting wifi support on the 8266 we can still improve it. |
+1 here, too. The esp8266's main reason to exist is providing simple wifi access. |
|
For stress testing the following command is written above: |
|
maximum I could ping was with 1446B payload including ICMP, i.e. where the IP is of the AP I used for testing, with |
|
ping from my desktop node (iMac) to that node only worked up to 1280 bytes (incl. ICMP), but I guess that's somehow expectable for IPv6. |
|
Partially good news. With the new ESP8266 RTOS SDK 3.x, Espressif started in September last year to publish a SDK which is quite similar to the ESP-IDF (the ESP32 SDK that was also used for the RIOT port to ESP32). Initially, the RIOT port for ESP8266 was realized using the ESP8266 NONOS SDK since the ESP8266 RTOS SDK up to version 2.x was also closed source like the NONOS SDK, but additionally bases on FreeRTOS. I was already thinking about to try a port for the new ESP8266 RTOS SDK 3.x. Cons:
Pros:
It's already on my ToDo to take a try, but at moment it seems to be more reasonable to get the existing port working with the WiFi interface. |
|
Even though the MTU for Ethernet is 1.500, my Linux box starts to fragment from 1.440 bytes. That's the reason why I suggested to use
Good point. There might be a problem, I didn't realize since my frames including MAC header and FCS were never greater than the MTU in tests. |
Although only the station interface is needed, the WiFi interface has to be used in SoftAP + Station mode. Otherwise the send function blocks sporadically. Since the SoftAP interface is not used, it is configured with a hidden SSID and a long beacon interval. Connections from other stations are not allowed.
|
@sming @MichelRottleuthner Thank you for your review and your patience. Squashed. Let's the what Murdock says. |
61af527 to
0920bbb
Compare
Receiption of a frame in _esp_wifi_recv_cb while sending has no effect and should be possible to increases the performance.
b6ecbe8 to
88c65af
Compare
When the size of a received frame is checked, always the total length should be used instead of the length of the first lwIP pbuf in the pbuf chain. Otherwise, the check that the length does not exceed ETHERNET_MAX_LEN will always be true since the maximum size of one lwIP pbuf in a pbuf chain is 512 bytes.
|
Of course, esp8266 boards have to be blacklisted. |
MichelRottleuthner
left a comment
There was a problem hiding this comment.
When testing with USEMODULE="esp_wifi" BOARD=esp8266-esp-12x make all flash term everything works as expected.
Though, by mistake I found a small obstacle: when compiling gnrc_networking without providing USEMODULE="esp_wifi" this results in a kernel panic shortly after boot (maybe the watchdog?).
I wouldn't expect this and probably that will pop up quite often as the general usage for gnrc_networking is "just compile without parameters and use". IMHO without esp_wifi there should be just no network interface available, but it should not crash. Is there a way to fix this?
I found that, too - but I think its some other layer/function in GNRC. Because removing all |
|
Indeed, it is a pitfall and I'm not sure how we should handle it. The reason for this kernel panic is an
Sure, we could enable module |
I absolutely agree. |
So just a usual Friday when using vendor SDKs ;-) (see e.g. #10122). |
|
I hit the green button NOW! |
|
🎉 cheap WiFi in RIOT 🎉 finally 🎉 |
|
Lets remove the WIP label then :P |
|
😟 I added WIP label again by intention since I though it avoids merging. I found one further complete blocking case. I planned to fix it before the merge. Too late for the moment. |
|
Thank you all for your support. |
Contribution description
This PR adds a
netdevdriver for infrastructure mode WiFi for ESP8266 using the built-in WiFi module. Using thisnetdevdriver, ESP8266 can use an existing WiFi network to get connectivity. Thenetdevdriver supports WPA authentication only.The Wifi network interface (module
esp_wifi) and the ESP-NOW network interface (moduleesp_now#9917)can be used simultaneously, for example, to realize a border router for a mesh network which uses ESP-NOW.
Testing procedure
example/gnrc_networkingto at least one ESP8266 node using your AP configuration, e.g.,ifconfigcommand to check the existence of the network interface. You should be able to observe an output as follows:ifconfigthat the prefix is set.sudo ping6 fe80::<ESP_IID> -Ieth0 -s1392 -i 0.0001should be stable over hours.sudo ping6 fe80::<ESP_IID> -Ieth0 -s1392 -i 0.0001ping6 1000 fe80::<LAN_IID> 1392 0.Issues/PRs references
This PR depends on PRs #10656 and #10766 and is related to PR #9917.