Skip to content
This repository was archived by the owner on Apr 24, 2019. It is now read-only.

Support for STM Radio Expansion Boards #327

Merged
merged 1 commit into from
Nov 24, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 33 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ This example supports these shields:

* [AT86RF233/212B](https://github.com/ARMmbed/atmel-rf-driver)
* [NXP-MCR20a](https://github.com/ARMmbed/mcr20a-rf-driver)
* [X-NUCLEO-IDS01A4](https://github.com/ARMmbed/stm-spirit1-rf-driver) (*a.k.a.* Spirit1) radio shields. Check instructions for compilation [here](#compile-configuration-for-spirit1)
* [X-NUCLEO-IDS01A4](https://github.com/ARMmbed/stm-spirit1-rf-driver) (*a.k.a.* Spirit1) radio shields. Check instructions for compilation [here](#compile-configuration-for-spirit1).

To select the radio shield make sure that the `mbed_app.json` file points to the correct radio driver type:

Expand Down Expand Up @@ -122,12 +122,12 @@ For sub-GHz shields ([Spirit1](https://github.com/ARMmbed/stm-spirit1-rf-driver)

```json
"mbed-mesh-api.6lowpan-nd-channel-page": 2,
"mbed-mesh-api.6lowpan-nd-channel": 1
"mbed-mesh-api.6lowpan-nd-channel": 1,
"mbed-mesh-api.6lowpan-nd-channel-mask": "(1<<1)"
```

For more information about the radio shields, see [the related documentation](docs/radio_module_identify.md).

=======
#### Supported combinations of board and shields

See Mesh-minimal's [Notes on different hardware](https://github.com/ARMmbed/mbed-os-example-mesh-minimal/blob/master/Hardware.md) for known combinations of development boards and RF shields that have been tested with mesh networking stack.
Expand Down Expand Up @@ -155,6 +155,7 @@ With Thread, you can change the operating mode of the client from the default ro
* UBLOX_EVK_ODIN_W2. Check instructions for compilation [here](#compile-configuration-for-odin-wifi).
* K64F + GROVE SEEED shield using [ESP8266](https://en.wikipedia.org/wiki/ESP8266) WiFi module.
* NUCLEO_F429ZI + GROVE SEEED shield using [ESP8266](https://en.wikipedia.org/wiki/ESP8266) WiFi module.
* [NUCLEO_F401RE](https://os.mbed.com/platforms/ST-Nucleo-F401RE/) + [X-NUCLEO-IDW0XX1](https://github.com/ARMmbed/wifi-x-nucleo-idw01m1/).

To run this application using ESP8266 WiFi Interface, you need:

Expand All @@ -166,8 +167,8 @@ To run this application using ESP8266 WiFi Interface, you need:

```json
"network-interface": {
"help": "options are ETHERNET,WIFI,MESH_LOWPAN_ND,MESH_THREAD.",
"value": "WIFI"
"help": "options are ETHERNET,WIFI_ESP8266,WIFI_IDW0XX1,WIFI_ODIN,MESH_LOWPAN_ND,MESH_THREAD.",
"value": "WIFI_ESP8266"
}
```

Expand Down Expand Up @@ -201,14 +202,36 @@ For example, NUCLEO_F401RE requires a different serial connection:

#### Compile configuration for ODIN WiFi

To compile ODIN WiFi configuration, you need to tell mbed NOT to compile the related files. To do that, set up a `.mbedignore` file. An example file is available in the `configs` folder.
To compile ODIN WiFi configuration, you need to tell mbed NOT to compile mesh files for example. To do that, set up a `.mbedignore` file. An example file is available in the `configs` folder.

This should resolve the issue:

```
cp configs/eth-wifi-mbedignore ./.mbedignore
```

``` bash
cp configs/wifi_odin_v4.json mbed_app.json
<use your favourite editor to modify mbed_app.json for WiFi details>
cp configs/mesh-mbedignore ./.mbedignore
```

#### Compile configuration for STM `X-NUCLEO-IDW0XX1` WiFi expansion boards

Currently, two STM WiFi expansion boards are available:
- `X-NUCLEO-IDW01M1`, which is the Morpho form-factor board, and
- `X-NUCLEO-IDW04A1`, which is the Arduino form-factor board.

The label is clearly printed on the PCB.

To compile STM X-NUCLEO WiFi configuration, you need to tell mbed NOT to compile mesh files for example. To do that, set up a `.mbedignore` file. Example files are available in the `configs` folder.

This should resolve the issue (example for `X-NUCLEO-IDW01M1`):

``` bash
cp configs/wifi_idw01m1_v4.json mbed_app.json
<use your favourite editor to modify mbed_app.json for WiFi details>
cp configs/mesh-mbedignore ./.mbedignore
```

If you have issues with the `X-NUCLEO-IDW04A1` board, please double-check that macro `IDW04A1_WIFI_HW_BUG_WA` has been added to the `macros` section of the `mbed_app.json` file.

### Non listed board support

Apart from the listed configurations, this example can work on other Mbed OS supported hardware boards which support any of the given network interface including Ethernet, WiFi, Mesh (6LoWPAN) or Thread, provided the configuration fulfills condition that the target hardware has TLS entropy implemented for it. On devices where hardware entropy is not present, TLS is disabled by default. This would result in compile time failures or linking failures.
Expand Down
7 changes: 7 additions & 0 deletions build_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,10 @@ mbed compile -m K64F -t $TOOL
cp BUILD/K64F/$TOOL/mbed-os-example-client.bin k64f-$TOOL-Thread.bin
mbed compile -m NUCLEO_F429ZI -t $TOOL
cp ./BUILD/NUCLEO_F429ZI/$TOOL/mbed-os-example-client.bin f429zi-$TOOL-Thread.bin

echo WiFi-X-Nucleo
cp configs/wifi_idw01m1_v4.json mbed_app.json
cp configs/wifi-idw0xx1-mbedignore .mbedignore
mbed compile -m NUCLEO_F401RE -t $TOOL
cp ./BUILD/NUCLEO_F401RE/GCC_ARM/mbed-os-example-client.bin f401re-$TOOL-WifiXNucleo.bin

1 change: 1 addition & 0 deletions configs/mesh-mbedignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
easy-connect/esp8266-driver/*
easy-connect/wifi-x-nucleo-idw01m1/*
36 changes: 36 additions & 0 deletions configs/wifi_idw01m1_v4.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"config": {
"network-interface":{
"help": "Options are ETHERNET, WIFI_ESP8266, WIFI_IDW0XX1, WIFI_ODIN, MESH_LOWPAN_ND, MESH_THREAD",
"value": "WIFI_IDW0XX1"
},
"wifi-ssid": {
"help": "WiFi SSID",
"value": "\"SSID\""
},
"wifi-password": {
"help": "WiFi Password",
"value": "\"Password\""
},
"wifi-tx": {
"help": "TX pin for serial connection to external device",
"value": "PA_9"
},
"wifi-rx": {
"help": "RX pin for serial connection to external device",
"value": "PA_10"
}
},
"macros": ["MBEDTLS_USER_CONFIG_FILE=\"mbedtls_mbed_client_config.h\"", "MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES","MBEDTLS_TEST_NULL_ENTROPY"],
"target_overrides": {
"*": {
"target.features_add": ["COMMON_PAL"],
"platform.stdio-baud-rate": 115200,
"platform.stdio-convert-newlines": true,
"mbed-trace.enable": 0,
"idw0xx1.expansion-board": "IDW01M1",
"drivers.uart-serial-txbuf-size": 730,
"drivers.uart-serial-rxbuf-size": 730
}
}
}
36 changes: 36 additions & 0 deletions configs/wifi_idw04a1_v4.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"config": {
"network-interface":{
"help": "Options are ETHERNET, WIFI_ESP8266, WIFI_IDW0XX1, WIFI_ODIN, MESH_LOWPAN_ND, MESH_THREAD",
"value": "WIFI_IDW0XX1"
},
"wifi-ssid": {
"help": "WiFi SSID",
"value": "\"SSID\""
},
"wifi-password": {
"help": "WiFi Password",
"value": "\"Password\""
},
"wifi-tx": {
"help": "TX pin for serial connection to external device",
"value": "D8"
},
"wifi-rx": {
"help": "RX pin for serial connection to external device",
"value": "D2"
}
},
"macros": ["MBEDTLS_USER_CONFIG_FILE=\"mbedtls_mbed_client_config.h\"", "MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES","MBEDTLS_TEST_NULL_ENTROPY", "IDW04A1_WIFI_HW_BUG_WA"],
"target_overrides": {
"*": {
"target.features_add": ["COMMON_PAL"],
"platform.stdio-baud-rate": 115200,
"platform.stdio-convert-newlines": true,
"mbed-trace.enable": 0,
"idw0xx1.expansion-board": "IDW04A1",
"drivers.uart-serial-txbuf-size": 750,
"drivers.uart-serial-rxbuf-size": 750
}
}
}
2 changes: 1 addition & 1 deletion easy-connect.lib
Original file line number Diff line number Diff line change
@@ -1 +1 @@
https://github.com/ARMmbed/easy-connect/#bf821b0695ccada3620a6091503eb53a2a1ac3c8
https://github.com/ARMmbed/easy-connect/#6af200df4817ec38661b409c7ba417e6098e8f1f
9 changes: 8 additions & 1 deletion main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ class LedResource {
status_ticker.attach_us(blinky, 250000);
return;
}
// Wait requested time, then continue prosessing the blink pattern from next position.
// Wait requested time, then continue processing the blink pattern from next position.
Thread::wait(blink_args->blink_pattern.at(blink_args->position));
blink_args->position++;
}
Expand Down Expand Up @@ -326,6 +326,11 @@ void button_clicked() {
updates.release();
}

// debug printf function
void trace_printer(const char* str) {
printf("%s\r\n", str);
}

// Entry point to the program
int main() {

Expand Down Expand Up @@ -361,6 +366,8 @@ Add MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES and MBEDTLS_TEST_NULL_ENTROPY in mbed_app
printf("\nStarting mbed Client example\n");

mbed_trace_init();
mbed_trace_print_function_set(trace_printer);
mbed_trace_config_set(TRACE_MODE_COLOR | TRACE_ACTIVE_LEVEL_INFO | TRACE_CARRIAGE_RETURN);

NetworkInterface* network = easy_connect(true);
if(network == NULL) {
Expand Down
2 changes: 1 addition & 1 deletion mbed_app.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"config": {
"network-interface":{
"help": "Options are ETHERNET, WIFI_ESP8266, WIFI_ODIN, MESH_LOWPAN_ND, MESH_THREAD, CELLULAR_ONBOARD",
"help": "Options are ETHERNET, WIFI_IDW0XX1, WIFI_ESP8266, WIFI_ODIN, MESH_LOWPAN_ND, MESH_THREAD, CELLULAR_ONBOARD",
"value": "ETHERNET"
},
"mesh_radio_type": {
Expand Down