You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 4f6d78c
Browse filesBrowse the repository at this point in the historyBrowse files
@@ -989,357 +988,7 @@ This version of the 6lowpan stack, have interoperability with 6lowpan stack of L
989
988
990
989
The ping between NuttX devices work properly, but with Linux, devices don't work properly and a final point to know is the dynamic association and multi-hop communication doesn't work properly. So, communications are only point-to-point.
991
990
992
-
## How to set 6lowpan communication between Raspbian and Nuttx.
993
991
994
-
This guide will show how to set-up a Raspberry Pi 3 (RPI) running Raspbian and an Olimex STM32 E407 board running NuttX to have 6lowpan communication between them.
995
-
996
-
### What do we need?
997
-
998
-
- Raspberry Pi 3
999
-
- micro-SD card (almost 16gb) with Raspbian lite already installed.
1000
-
- Olimex-STM32-E407 board.
1001
-
- Two PMODRF2 module which are base on the MRF24J40 module.
1002
-
- PC with Ubuntu (It works fine with Ubuntu 16.04)
1003
-
1004
-
### How to set-up 6lowpan RPI?
1005
-
1006
-
First, we need to connect the PMODRF2 module to the RPI, so we need to set the next connections:
1007
-
1008
-
|| RPI | PMODRF2 |
1009
-
| -- | -- | -- |
1010
-
| VIN | 1 | 12 |
1011
-
| GND | 20 | 11 |
1012
-
| RESET | 17 | 8 |
1013
-
| INT | 16 | 7 |
1014
-
| SDI | 19 | 2 |
1015
-
| SDO | 21 | 3 |
1016
-
| SCK | 23 | 4 |
1017
-
| CS | 26 | 1 |
1018
-
1019
-
In the next links you can see the pinout of each board:
1020
-
[- Raspberry Pi 3 pinout.](https://i.pinimg.com/originals/84/46/ec/8446eca5728ebbfa85882e8e16af8507.png)
If everything goes fine, at the end of the script, the board should restart. After the start-up, type the next command to see if the configuration and the connection are fine:
1030
-
```dmesg | grep mrf24j40```
1031
-
1032
-
And if everything is fine, it should return the next:
1033
-
```bash
1034
-
pi@raspberrypi:~ $ dmesg | grep mrf24j40
1035
-
[ 4.075212] mrf24j40 spi0.0: probe(). IRQ: 169
1036
-
```
1037
-
The last point is to set-up the network.
1038
-
1039
-
- Set the PAN ID: ``sudo iwpan dev wpan0 set pan_id 0xabcd``
1040
-
- Set the page and channel: ``sudo iwpan phy phy0 set channel 0 26``
1041
-
- Set the short address: ``sudo iwpan dev wpan0 set short_addr 0x4204`` (Each board must a different one)
1042
-
- Attach the phy layer to the lowpan: ``sudo ip link add link wpan0 name lowpan0 type lowpan``
1043
-
- Bring up the WPAN0 interface: ``sudo ip link set wpan0 up``
1044
-
- Bring up the RPI lowpan: ``sudo ip link set lowpan0 up``
1045
-
1046
-
1047
-
Now the RPI is ready to send and receive messages from a NuttX board or another RPI.
1048
-
1049
-
1050
-
### How to set-up 6lowpan NuttX?
1051
-
1052
-
First, we need to do the connections between the Olimex board and the PMODRF2 module.
1053
-
1054
-
- `Board D13` -> `MRF24J40 SCLK`
1055
-
- `Board D12` -> `MRF24J40 MISO`
1056
-
- `Board D11` -> `MRF24J40 MOSI`
1057
-
- `Board D10` -> `MRF24J40 CS`
1058
-
- `Board D8` -> `MRF24J40 INT`
1059
-
1060
-
Once the wiring is finished, we need to compile and upload the firmware. Type the next commands:
1061
-
1062
-
o to the main folder of NuttX and type the command to configure the board:
As you can see there is two IP in this network interface. But you need to remember the second one. We will use later with NuttX.
1218
-
`fe80::9c6e:87a5:eb60:84d0``
1219
-
1220
-
Go to the place where lives the repo that you downloaded previously. Go to ``micro-ROS-bridge_RPI/RPI_6lowpan/Examples/6lowpan_recv``
1221
-
Finally, execute recv_demo telling to open the 61616 port. Type this command: ``./recv_demo 61616``
1222
-
1223
-
At this point, the RPI is ready to receive incoming packages.
1224
-
1225
-
### NuttX part:
1226
-
1227
-
Execute ``udp_6lowpan`` application.
1228
-
This will ask you if you want to configure the network. Type N, because is already configured.
1229
-
Now you're in the main menu of the App. Type ``write`` to start the sending mode and will ask for the next data:
1230
-
- The destination IP: This is the IP of the RPI which we saved previously.
1231
-
- The destination port: For this specific example is 61617.
1232
-
- The origin port: This is the port that we want to open to send the message, for example, we could use 61618.
1233
-
1234
-
At this point it should look like this:
1235
-
1236
-
``` bash
1237
-
nsh> udp_6lowpan
1238
-
Do you want to execute the automatic WPAN configuration? (y/n)
1239
-
1240
-
Available commands
1241
-
-To send a package type: write
1242
-
-To receive a package type: read
1243
-
-To exit type: quit
1244
-
Introduce the IVP6 Destination
1245
-
Introduce the port destination
1246
-
Introduce the port origin
1247
-
Conection data:
1248
-
-Dest_IP: fe80::857:adfe:5a82:c7ac
1249
-
-Dest_Port: 61616
1250
-
-Origin_Port: 61617
1251
-
Introduce a message to send:
1252
-
```
1253
-
Now if you type somenthing and press enter NuttX should show the next:
1254
-
```bash
1255
-
Introduce a message to send:
1256
-
Sending 5 characters: hello
1257
-
```
1258
-
1259
-
And the RPI, should show the next message:
1260
-
```bash
1261
-
Received (from fe80::2be:adde:de:fa00): hello
1262
-
```
1263
-
1264
-
### Sending a message from the Raspbian to NuttX:
1265
-
1266
-
**Very important note! :**
1267
-
The Linux 6lowpan utility needs to have a ping response before sending a data package, but the ping implementation of NuttX is not compatible. So the solution for this problem is to send a message from NuttX to Linux, just to add the NuttX direction to the neighborhood table.
1268
-
1269
-
If this does not work, do as follow:
1270
-
1271
-
Check if the Nuttx address is part within the Linux/Raspbian neighborhood table.
1272
-
If it is, remove it:
1273
-
```bash
1274
-
$ ip neigh # a bunch of address shall appear including yours (if you send a
1275
-
message already)
1276
-
fe80::2be:adde:de:fa00 dev lowpan0 FAILED
1277
-
$ sudo ip neigh delete fe80::2be:adde:de:fa00 dev lowpan0 # Remove it.
1278
-
```
1279
-
1280
-
Then once delete add the Nuttx device it permanently (until reboot):
1281
-
1282
-
```bash
1283
-
$ sudo ip neigh add fe80::2be:adde:de:fa00 dev lowpan0 00:be:ad:de:00:de:fa:00 # Add it with the
1284
-
corret Hardware address.
1285
-
```
1286
-
1287
-
#### NuttX part:
1288
-
First we need the ip of the board, so type``ifconfig``in the main menu. This should return somenthing like this:
1289
-
```bash
1290
-
wpan0 Link encap:6LoWPAN HWaddr 00:be:ad:de:00:de:fa:00 at UP
1291
-
inet6 addr: fe80::2be:adde:de:fa00/64
1292
-
inet6 DRaddr: ::/64
1293
-
1294
-
RX: Received Fragment Errors
1295
-
00000000 00000000 00000000
1296
-
IPv6 Dropped
1297
-
00000000 00000000
1298
-
TX: Queued Sent Errors Timeouts
1299
-
00000000 00000000 00000000 00000000
1300
-
Total Errors: 00000000
1301
-
1302
-
IPv6 TCP UDP ICMPv6
1303
-
Received 0000 0000 0000 0000
1304
-
Dropped 0000 0000 0000 0000
1305
-
IPv6 VHL: 0000
1306
-
Checksum ---- 0000 0000 ----
1307
-
TCP ACK: 0000 SYN: 0000
1308
-
RST: 0000 0000
1309
-
Type 0000 ---- ---- 0000
1310
-
Sent 0000 0000 0000 0000
1311
-
Rexmit ---- 0000 ---- ----
1312
-
```
1313
-
1314
-
For us is important to remember the **inet6_addr** which is: ``fe80::2be:adde:de:fa00``
1315
-
1316
-
Execute ``udp_6lowpan`` app, type``N`` to the configuration request and finally type read, to start the receiving mode.
1317
-
Type the port that you want to open, for example, the 61616. And it should look like this mean is waiting for the incoming message.
1318
-
1319
-
```bash
1320
-
Available commands
1321
-
-To send a package type: write
1322
-
-To receive a package type: read
1323
-
-To exit type: quit
1324
-
Introduce the reception port
1325
-
Listening on 61616 for input packets
1326
-
```
1327
-
1328
-
#### Raspbian Part:
1329
-
1330
-
Go to the places that lives the previous download repo. Then go to this folder: ``/micro-ROS-bridge_RPI/RPI_6lowpan/Examples/66lowpan_send``
1331
-
1332
-
And execute with root privileges the next app: ``send_demo``.
1333
-
These demos have two arguments: The first is the port to open in the destination and the second is the destination IP. An example of this specific demo could be:
1334
-
``sudo send_demo 61616 fe80::2be:adde:de:fa00``
1335
-
1336
-
This app returns any data.
1337
-
1338
-
On the other hand, in the NuttX board we will see the next:
1339
-
```bash
1340
-
Received 12 bytes from 80fe:0000:0000:0000:cda9:ff00:00fe:0442 port 39464
0 commit comments