Closed MarceloSalazar closed 7 years ago
- Implement ::gethostbyname & dns_lookup Example: https://github.com/ARMmbed/esp8266-driver/blob/master/ESP8266Interface.cpp#L88
@MarceloSalazar what is the advantage of reimplementing ::gethostbyname()
rather than resorting to NetworkStack::gethostbyname()
General requirements for the driver
- Driver should run on its own thread for TX of AT commands
Does this mean, that mbed's netsockets are not thread-safe?!? :zap:
- RX of AT commands happens on IRQ context.
Is this a requirement? If yes, why? Isn't it enough to receive incoming data via Interrupt?
@MarceloSalazar what is the advantage of reimplementing ::gethostbyname() rather than resorting to NetworkStack::gethostbyname()
There is a small code size improvement if you can offload DNS logic to an external chip (ESP8266 for example). But using mbed's gethostbyname is probably easier and less error prone. I think you're right with sticking to NetworkStack::gethostbyname()
.
Driver should run on its own thread for TX of AT commands
I don't think this should be a requirement. There may be a performance benefit to buffering outgoing packets, but functionality should come first and sending TX data in the callers thread will probably work just fine.
RX of AT commands happens on IRQ context.
I don't think I understand this bullet point. RX of AT commands can't happen in IRQ context, since waiting for a serial may block. The driver does need to signal the socket_attach
callback when data comes in, but the RX of AT commands needs to either occur during the top-level call of socket_recv
or in a seperate thread.
Pls. find attached the test results of an adapted version of the ESP8266 tests for release v0.1.1 of the wifi-x-nucleo-idw01m1
driver.
Please note:
ATParser
which can be found herewifi-x-nucleo-idw01m1
driver and to fit our local environment (e.g. in order to use NSAPI_SECURITY_WPA2
) and can be found herembed test -n tests-net* --compile -DMBED_CFG_SPWF01SA_SSID=<ssid> -DMBED_CFG_SPWF01SA_PASS=<pwd> -DMBED_CFG_SPWF01SA_DEBUG=false
and run with command line
mbed test -n tests-net* --run
cc @nikapov-ST
@betzw thanks a lot for updating the driver. We'll have a look into this soon.
@MarceloSalazar @betzw I made a trial with mbed OS example client using a NUCLEO_L476RG + X-NUCLEO-IDW01M1 and it seems it correctly connects and provides the virtual button data to the mbed device connector.
You can check it yourself here: https://github.com/nikapov-ST/mbed-os-example-client
To enable the Wi-Fi:
easy-connect lib was also modified to include support to STM Wi-Fi: https://github.com/nikapov-ST/easy-connect
@nikapov-ST this is great news! thanks for confirming, I'll give it a try soon. FYI @screamerbg
Thanks @betzw and @nikapov-ST for working on the driver and sharing this detailed information.
I confirm I've been able to successfully use your Client example application on the NUCLEO_L476RG + X-NUCLEO-IDW01M1 :) Some CLI tests are failing (UDP/DTLS), but suspect it's caused by my environment - I need to review this again.
In order to move forward and have the Wifi driver/module supported, I'd suggest working on the following areas (probably in this order):
ATParser: understand what changes are strictly required. Please submit a PR to the official repo. Then update the ATParser.lib
Update mbed-os-example-wifi to have a simpler app to demo Wifi
Update easy-connect
Update mbed-os-example-client. May need to a discussion on the name of the configuration files.
Let me know if you have any question.
ATParser: understand what changes are strictly required. Please submit a PR to the official repo. Then update the ATParser.lib
Pls. refer to ATParser PR #11.
@MarceloSalazar & @nikapov-ST, Just to inform you that PR #11 has been merged.
Btw, I have made this repo public.
@betzw that's great! Could you please test with the mbed-os-example-wifi and send a PR to the docs once you see it working?
@MarceloSalazar, pls. refer to https://github.com/ARMmbed/mbed-os-example-wifi/pull/50
@MarceloSalazar, can we close this issue?
Marcelo is currently on vacation.
@betzw let's keep this item open a bit more until we have the driver supported in mbed-os-example-client.
@nikapov-ST, at what point are we there?
@betzw @MarceloSalazar In fact I was waiting for having mbed-os-example-wifi (simpler example) integrated first :-) . So, will try to progress with the client-example.
@MarceloSalazar, could you pls. take a look at mbed-os-example-client issue #303?
@MarceloSalazar, should I try to proceed with the PR for integrating X-NUCLEO-IDW01M1 into mbed-os-example-client despite of issue https://github.com/ARMmbed/mbed-os-example-client/issues/303?
@betzw yes, you could start testing and preparing a PR for mbed-os-example-client and easy-connect, that could get merged as soon as ARMmbed/mbed-os#4406 gets released in 5.6 (and client app updated to point at 5.6).
@MarceloSalazar, pls. take a look at https://github.com/ARMmbed/easy-connect/pull/42 regarding easy-connect.
Btw, using the current master
branch of mbed-os does not yet solve the issue on my side even if https://github.com/ARMmbed/mbed-os/pull/4406 is already merged in ...
Find here relevant feedback on the current driver implementation and suggestions to make it compatible with mbed OS 5: Branch: https://github.com/ARMmbed/wifi-x-nucleo-idw01m1/tree/betzw_wb
General requirements for the driver
Features & enhancements
Implement ::gethostbyname & dns_lookup Example: https://github.com/ARMmbed/esp8266-driver/blob/master/ESP8266Interface.cpp#L88
Implement ::set_credentials (currently returns NSAPI_ERROR_UNSUPPORTED) Example: https://github.com/ARMmbed/esp8266-driver/blob/master/ESP8266Interface.cpp#L111
Implement ::get_gateway Example: https://github.com/ARMmbed/esp8266-driver/blob/master/ESP8266Interface.cpp#L151
Implement ::get_netmask Example: https://github.com/ARMmbed/esp8266-driver/blob/master/ESP8266Interface.cpp#L156
Implement ::scan (currently returns NSAPI_ERROR_UNSUPPORTED) Example: https://github.com/ARMmbed/esp8266-driver/blob/master/ESP8266Interface.cpp#L166
Implement ::connect() - no parameters Example: https://github.com/ARMmbed/esp8266-driver/blob/master/ESP8266Interface.cpp#L51
Consider checking return errors: https://github.com/ARMmbed/wifi-x-nucleo-idw01m1/blob/betzw_wb/SpwfInterface.cpp#L145
Example: https://github.com/ARMmbed/esp8266-driver/blob/master/ESP8266Interface.cpp#L70 https://github.com/ARMmbed/esp8266-driver/blob/master/ESP8266Interface.cpp#L74 https://github.com/ARMmbed/esp8266-driver/blob/master/ESP8266Interface.cpp#L78 https://github.com/ARMmbed/esp8266-driver/blob/master/ESP8266Interface.cpp#L82
Consider checking FW version of module to avoid problems in the future (only if fw is expected to change)
Example: https://github.com/ARMmbed/esp8266-driver/blob/master/ESP8266Interface.cpp#L61 https://github.com/ARMmbed/esp8266-driver/blob/master/ESP8266/ESP8266.h#L35
AT ATParser We probably need to understand the requirements you have to modify it, and how we could possibly incorporate certain changes in the ARMmbed/ATParser. There are more users for the AT parser and need to make sure it continues to work. Maybe we need a separate issue on ATPartner to discuss details. For now, see relevant changes here: https://github.com/betzw/ATParser/tree/betzw_wb/ vs https://github.com/ARMmbed/ATParser/#269f14532b98442669c50383782cbce1c67aced5
Potential risks of driver getting stuck (could it have a timeout?) https://github.com/ARMmbed/wifi-x-nucleo-idw01m1/blob/betzw_wb/SPWF01SA/SPWFSA01.cpp#L176 https://github.com/ARMmbed/wifi-x-nucleo-idw01m1/blob/betzw_wb/SPWF01SA/SPWFSA01.cpp#L338
Testing
@betzw cc @geky @screamerbg