![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
potok
README.md@63:99e063d738ee, 2018-06-05 (annotated)
- Committer:
- mbed_official
- Date:
- Tue Jun 05 10:15:03 2018 +0100
- Revision:
- 63:99e063d738ee
- Parent:
- 49:d44cac40bf15
- Child:
- 71:a0fbcc153b55
Add ISM43362 driver support for STM32 wifi DISCO boards
.
Commit copied from https://github.com/ARMmbed/mbed-os-example-wifi
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 0:857719181846 | 1 | # mbed-os-example-wifi # |
mbed_official | 0:857719181846 | 2 | |
mbed_official | 49:d44cac40bf15 | 3 | Wi-Fi example for Mbed OS |
mbed_official | 0:857719181846 | 4 | |
mbed_official | 49:d44cac40bf15 | 5 | ## Getting started with the Wi-Fi API ## |
mbed_official | 0:857719181846 | 6 | |
mbed_official | 49:d44cac40bf15 | 7 | This is an example of a Wi-Fi application using the Wi-Fi and network socket APIs that [Mbed OS](https://github.com/ARMmbed/mbed-os) provides. |
mbed_official | 0:857719181846 | 8 | |
mbed_official | 49:d44cac40bf15 | 9 | The program brings up the Wi-Fi and the underlying network interface and uses it to scan available networks, connects to a network, prints interface and connection details and performs an HTTP operation. |
mbed_official | 49:d44cac40bf15 | 10 | |
mbed_official | 49:d44cac40bf15 | 11 | For more information about Wi-Fi APIs, please visit the [Mbed OS Wi-Fi](https://os.mbed.com/docs/latest/reference/wi-fi.html) documentation. |
mbed_official | 0:857719181846 | 12 | |
mbed_official | 0:857719181846 | 13 | ### Supported hardware ### |
mbed_official | 0:857719181846 | 14 | |
mbed_official | 49:d44cac40bf15 | 15 | * [u-blox Odin board](https://os.mbed.com/platforms/ublox-EVK-ODIN-W2/) built-in Wi-Fi module. |
mbed_official | 49:d44cac40bf15 | 16 | * [Realtek RTL8195AM](https://os.mbed.com/platforms/REALTEK-RTL8195AM/) built-in Wi-Fi module. |
mbed_official | 63:99e063d738ee | 17 | * [ST DISCO IOT board](https://os.mbed.com/platforms/ST-Discovery-L475E-IOT01A/) with integrated [ISM43362 WiFi Inventek module](https://github.com/ARMmbed/wifi-ism43362). |
mbed_official | 63:99e063d738ee | 18 | * [ST DISCO_F413ZH board](https://os.mbed.com/platforms/ST-Discovery-F413H/) with integrated [ISM43362 WiFi Inventek module](https://github.com/ARMmbed/wifi-ism43362). |
mbed_official | 49:d44cac40bf15 | 19 | * [NUCLEO-F401RE](https://os.mbed.com/platforms/ST-Nucleo-F401RE/) with [X-NUCLEO-IDW04A1](http://www.st.com/content/st_com/en/products/ecosystems/stm32-open-development-environment/stm32-nucleo-expansion-boards/stm32-ode-connect-hw/x-nucleo-idw04a1.html) Wi-Fi expansion board using pins D8 and D2 _(of the Arduino connector)_. |
mbed_official | 49:d44cac40bf15 | 20 | * [NUCLEO-F401RE](https://os.mbed.com/platforms/ST-Nucleo-F401RE/) with [X-NUCLEO-IDW01M1](https://os.mbed.com/components/X-NUCLEO-IDW01M1/) Wi-Fi expansion board using pins PA_9 and PA_10 _(of the Morpho connector)_. |
mbed_official | 49:d44cac40bf15 | 21 | * [NUCLEO-F429ZI](https://os.mbed.com/platforms/ST-Nucleo-F429ZI/) with ESP8266-01 module using pins D1 and D0. |
mbed_official | 49:d44cac40bf15 | 22 | * [NUCLEO-L476RG](https://os.mbed.com/platforms/ST-Nucleo-L476RG/) with ESP8266-01 module using pins D8 and D2. |
mbed_official | 49:d44cac40bf15 | 23 | * Other Mbed targets with an ESP8266 module, [X-NUCLEO-IDW04A1](http://www.st.com/content/st_com/en/products/ecosystems/stm32-open-development-environment/stm32-nucleo-expansion-boards/stm32-ode-connect-hw/x-nucleo-idw04a1.html) or [X-NUCLEO-IDW01M1](https://os.mbed.com/components/X-NUCLEO-IDW01M1/) expansion board. |
mbed_official | 49:d44cac40bf15 | 24 | *(The Mbed target board the Wi-Fi shield connects to shouldn't have any other network interface, for example Ethernet.)* |
mbed_official | 0:857719181846 | 25 | |
mbed_official | 49:d44cac40bf15 | 26 | ESP8266 is a fallback option if the build is for unsupported platform. |
mbed_official | 0:857719181846 | 27 | |
mbed_official | 32:bca3f5f442b3 | 28 | #### Connecting the ESP8266 #### |
mbed_official | 49:d44cac40bf15 | 29 | |
mbed_official | 27:b3c6dba3b6e9 | 30 | To connect the ESP8266 module to your development board, look at the [ESP8266 Cookbook page](https://developer.mbed.org/users/4180_1/notebook/using-the-esp8266-with-the-mbed-lpc1768/). In general, this means hooking up the ESP8266 TX pin to `D0` and the ESP8266 RX pin to `D1` on your development board. |
mbed_official | 6:9944c5308062 | 31 | |
mbed_official | 49:d44cac40bf15 | 32 | **Note:** On NUCLEO development boards, pins `D0` and `D1` are used for serial communication with the computer. Use pins `D8` (to ESP8266 TX) and `D2` (to ESP8266 RX) instead. |
mbed_official | 32:bca3f5f442b3 | 33 | |
mbed_official | 44:63be19b7a3db | 34 | #### Connecting the X-NUCLEO-IDW0XX1 #### |
mbed_official | 49:d44cac40bf15 | 35 | |
mbed_official | 49:d44cac40bf15 | 36 | To connect the [X-NUCLEO-IDW04A1](http://www.st.com/content/st_com/en/products/ecosystems/stm32-open-development-environment/stm32-nucleo-expansion-boards/stm32-ode-connect-hw/x-nucleo-idw04a1.html) or [X-NUCLEO-IDW01M1](https://developer.mbed.org/components/X-NUCLEO-IDW01M1/) expansion board to your NUCLEO development board, plug the expansion board on top of the NUCLEO board using the Arduino or Morpho connector. |
mbed_official | 6:9944c5308062 | 37 | |
mbed_official | 44:63be19b7a3db | 38 | ## Getting started ## |
mbed_official | 0:857719181846 | 39 | |
mbed_official | 49:d44cac40bf15 | 40 | 1. Import the example. |
mbed_official | 0:857719181846 | 41 | |
mbed_official | 32:bca3f5f442b3 | 42 | ``` |
mbed_official | 32:bca3f5f442b3 | 43 | mbed import mbed-os-example-wifi |
mbed_official | 32:bca3f5f442b3 | 44 | cd mbed-os-example-wifi |
mbed_official | 32:bca3f5f442b3 | 45 | ``` |
mbed_official | 49:d44cac40bf15 | 46 | |
mbed_official | 49:d44cac40bf15 | 47 | 2. Configure the Wi-Fi shield to use. |
mbed_official | 0:857719181846 | 48 | |
mbed_official | 49:d44cac40bf15 | 49 | Edit ```mbed_app.json``` to include the correct Wi-Fi shield, SSID and password: |
mbed_official | 0:857719181846 | 50 | |
mbed_official | 32:bca3f5f442b3 | 51 | ``` |
mbed_official | 33:12f0df4d51d7 | 52 | "config": { |
mbed_official | 32:bca3f5f442b3 | 53 | "wifi-shield": { |
mbed_official | 63:99e063d738ee | 54 | "help": "Options are internal, WIFI_ESP8266, WIFI_ISM43362, WIFI_IDW0XX1", |
mbed_official | 44:63be19b7a3db | 55 | "value": "WIFI_ESP8266" |
mbed_official | 32:bca3f5f442b3 | 56 | }, |
mbed_official | 32:bca3f5f442b3 | 57 | "wifi-ssid": { |
mbed_official | 32:bca3f5f442b3 | 58 | "help": "WiFi SSID", |
mbed_official | 32:bca3f5f442b3 | 59 | "value": "\"SSID\"" |
mbed_official | 32:bca3f5f442b3 | 60 | }, |
mbed_official | 32:bca3f5f442b3 | 61 | "wifi-password": { |
mbed_official | 32:bca3f5f442b3 | 62 | "help": "WiFi Password", |
mbed_official | 32:bca3f5f442b3 | 63 | "value": "\"Password\"" |
mbed_official | 32:bca3f5f442b3 | 64 | } |
mbed_official | 32:bca3f5f442b3 | 65 | }, |
mbed_official | 32:bca3f5f442b3 | 66 | ``` |
mbed_official | 0:857719181846 | 67 | |
mbed_official | 49:d44cac40bf15 | 68 | Sample ```mbed_app.json``` files are provided for ESP8266 (```mbed_app_esp8266.json```), X-NUCLEO-IDW04A1 (```mbed_app_idw04a1.json```) and X-NUCLEO-IDW01M1 (```mbed_app_idw01m1```). |
mbed_official | 44:63be19b7a3db | 69 | |
mbed_official | 63:99e063d738ee | 70 | For WIFI_ISM43362, ignore the value of `wifi-shield` as it is already overrides per supported targets. |
mbed_official | 63:99e063d738ee | 71 | |
mbed_official | 49:d44cac40bf15 | 72 | For built-in Wi-Fi, ignore the value of `wifi-shield`. |
mbed_official | 33:12f0df4d51d7 | 73 | |
mbed_official | 49:d44cac40bf15 | 74 | 3. Compile and generate binary. |
mbed_official | 0:857719181846 | 75 | |
mbed_official | 32:bca3f5f442b3 | 76 | For example, for `GCC`: |
mbed_official | 32:bca3f5f442b3 | 77 | |
mbed_official | 32:bca3f5f442b3 | 78 | ``` |
mbed_official | 32:bca3f5f442b3 | 79 | mbed compile -t GCC_ARM -m UBLOX_EVK_ODIN_W2 |
mbed_official | 32:bca3f5f442b3 | 80 | ``` |
mbed_official | 36:aa0b6789bbd2 | 81 | |
mbed_official | 44:63be19b7a3db | 82 | 4. Open a serial console session with the target platform using the following parameters: |
mbed_official | 49:d44cac40bf15 | 83 | |
mbed_official | 36:aa0b6789bbd2 | 84 | * **Baud rate:** 9600 |
mbed_official | 36:aa0b6789bbd2 | 85 | * **Data bits:** 8 |
mbed_official | 36:aa0b6789bbd2 | 86 | * **Stop bits:** 1 |
mbed_official | 36:aa0b6789bbd2 | 87 | * **Parity:** None |
mbed_official | 36:aa0b6789bbd2 | 88 | |
mbed_official | 44:63be19b7a3db | 89 | 5. Copy or drag the application `mbed-os-example-wifi.bin` in the folder `mbed-os-example-wifi/BUILD/<TARGET NAME>/<PLATFORM NAME>` onto the target board. |
mbed_official | 36:aa0b6789bbd2 | 90 | |
mbed_official | 49:d44cac40bf15 | 91 | 6. The serial console should display a similar output to below, indicating a successful Wi-Fi connection: |
mbed_official | 49:d44cac40bf15 | 92 | |
mbed_official | 36:aa0b6789bbd2 | 93 | ``` |
mbed_official | 36:aa0b6789bbd2 | 94 | WiFi example |
mbed_official | 36:aa0b6789bbd2 | 95 | |
mbed_official | 36:aa0b6789bbd2 | 96 | Scan: |
mbed_official | 36:aa0b6789bbd2 | 97 | Network: Dave Hot Spot secured: Unknown BSSID: 00:01:02:03:04:05 RSSI: -58 Ch: 1 |
mbed_official | 36:aa0b6789bbd2 | 98 | 1 network available. |
mbed_official | 36:aa0b6789bbd2 | 99 | |
mbed_official | 36:aa0b6789bbd2 | 100 | Connecting... |
mbed_official | 36:aa0b6789bbd2 | 101 | Success |
mbed_official | 36:aa0b6789bbd2 | 102 | |
mbed_official | 36:aa0b6789bbd2 | 103 | MAC: 00:01:02:03:04:05 |
mbed_official | 36:aa0b6789bbd2 | 104 | IP: 192.168.0.5 |
mbed_official | 36:aa0b6789bbd2 | 105 | Netmask: 255.255.255.0 |
mbed_official | 36:aa0b6789bbd2 | 106 | Gateway: 192.168.0.1 |
mbed_official | 36:aa0b6789bbd2 | 107 | RSSI: -27 |
mbed_official | 36:aa0b6789bbd2 | 108 | |
mbed_official | 36:aa0b6789bbd2 | 109 | Sending HTTP request to www.arm.com... |
mbed_official | 36:aa0b6789bbd2 | 110 | sent 38 [GET / HTTP/1.1] |
mbed_official | 36:aa0b6789bbd2 | 111 | recv 64 [HTTP/1.1 301 Moved Permanently] |
mbed_official | 36:aa0b6789bbd2 | 112 | |
mbed_official | 36:aa0b6789bbd2 | 113 | Done |
mbed_official | 36:aa0b6789bbd2 | 114 | ``` |
mbed_official | 0:857719181846 | 115 | |
mbed_official | 49:d44cac40bf15 | 116 | ## Troubleshooting |
mbed_official | 0:857719181846 | 117 | |
mbed_official | 49:d44cac40bf15 | 118 | If you have problems, you can review the [documentation](https://os.mbed.com/docs/latest/tutorials/debugging.html) for suggestions on what could be wrong and how to fix it. |