Skip to content

Commit da3aa2f

Browse files
Juan Flores MuñozFranFin
authored andcommitted
#7859 Split NuttX tutorials. (#127)
* Adding NSH USB and NSH UART tutorial * Adding UDP echo tutorial * Little rework of the tutorials * Text fix * Text Fix on UDP echo tutorial * Adding tcp echo tutorial * Adding tcp echo tutorial * Adding little rework * Little rework on the 6lowpan tutorial * More rework on 6lowpan tutorial * Resolving conflict with master branch * Update _docs/tutorials/advanced/nuttx/6lowpan_config/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/6lowpan_config/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/6lowpan_config/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/6lowpan_config/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/6lowpan_config/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/6lowpan_config/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/6lowpan_config/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/6lowpan_config/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/6lowpan_config/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/6lowpan_config/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/6lowpan_config/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/6lowpan_config/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/6lowpan_config/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/6lowpan_config/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/nsh_uart/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/nsh_uart/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/nsh_uart/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/nsh_uart/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/nsh_uart/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/udp_echo/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/udp_echo/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/udp_echo/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/udp_echo/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/udp_echo/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/nsh_uart/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/6lowpan_config/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/6lowpan_config/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/6lowpan_config/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/6lowpan_config/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/6lowpan_config/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/6lowpan_config/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/nsh_uart/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/nsh_usb/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/nsh_usb/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/nsh_usb/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/nsh_usb/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/nsh_usb/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/nsh_usb/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/nsh_usb/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/nsh_usb/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/nsh_usb/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/nsh_usb/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/tcp_echo/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/tcp_echo/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/tcp_echo/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/tcp_echo/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/tcp_echo/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/tcp_echo/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/tcp_echo/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/tcp_echo/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/tcp_echo/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/tcp_echo/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/tcp_echo/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/tcp_echo/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/tcp_echo/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/tcp_echo/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/tcp_echo/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/tcp_echo/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/tcp_echo/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/tcp_echo/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/udp_echo/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/udp_echo/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/udp_echo/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/udp_echo/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/udp_echo/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/udp_echo/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/udp_echo/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/udp_echo/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/udp_echo/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/udp_echo/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/udp_echo/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/udp_echo/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/udp_echo/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Update _docs/tutorials/advanced/nuttx/udp_echo/index.md Co-Authored-By: FranFin <58737168+FranFin@users.noreply.github.com> * Deleting previous version of NuttX getting started Co-authored-by: FranFin <58737168+FranFin@users.noreply.github.com>
1 parent 5aa5d77 commit da3aa2f

54 files changed

Lines changed: 936 additions & 1852 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

_data/docs.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,13 @@
5656
- title: Advanced Tutorials with Nuttx
5757
docs:
5858
- tutorials/advanced/nuttx/nuttx_getting_started
59-
- tutorials/advanced/nuttx/add_a_microros_application
59+
- tutorials/advanced/nuttx/nsh_usb
60+
- tutorials/advanced/nuttx/nsh_uart
61+
- tutorials/advanced/nuttx/udp_echo
62+
- tutorials/advanced/nuttx/tcp_echo
63+
- tutorials/advanced/nuttx/6lowpan_config
6064
- tutorials/advanced/nuttx/debugging_gdb_openocd
6165
- tutorials/advanced/nuttx/debugging_vscode
62-
- tutorials/advanced/nuttx/6lowpan_nuttx_rpi
6366
- tutorials/advanced/nuttx/microros_nuttx_bsp
6467
- tutorials/advanced/nuttx/microros_6lowpan_tutorial
6568

_docs/tutorials/advanced/nuttx/6lowpan_nuttx_rpi/index.md renamed to _docs/tutorials/advanced/nuttx/6lowpan_config/index.md

Lines changed: 60 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,29 @@
11
---
2-
title: 6LOWPAN communications between NuttX and a Raspberry Pi
3-
permalink: /docs/tutorials/advanced/nuttx/6lowpan_nuttx_rpi/
2+
title: Configure 6LoWPAN communications
3+
permalink: /docs/tutorials/advanced/nuttx/6lowpan_config/
44
---
55

6+
| RTOS | Board Compatible |
7+
|:-----:|:-----------------:|
8+
| NuttX | Olimex-STM32-E407 |
69

710
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.
811

9-
## What do we need?
12+
13+
**Disclaimer**: This tutorial doesn't use micro-ROS, it is just a proof of concept of the 6LoWPAN communication.
14+
15+
## Hardware requirements:
1016

1117
- Raspberry Pi 3
1218
- micro-SD card (almost 16gb) with Raspbian lite already installed.
1319
- Olimex-STM32-E407 board.
14-
- Two PMODRF2 module which are base on the MRF24J40 module.
20+
- Two PMODRF2 modules which are based on the MRF24J40 module.
1521
- PC with Ubuntu (It works fine with Ubuntu 16.04)
1622
- NuttX source code, you can find a Docker file with all the tools [here](https://github.com/micro-ROS/docker/tree/pre_refactor/Embedded/NuttX/development/stm32-e407).
17-
## How to set-up 6lowpan RPI?
1823

19-
First, we need to connect the PMODRF2 module to the RPI, so we need to set the next connections:
24+
## Set-up 6LoWPAN communications on the Raspberry PI
25+
26+
First, we need to connect the PMODRF2 module to the RPI, so we need to set the following connections:
2027

2128
| | RPI | PMODRF2 |
2229
| -- | -- | -- |
@@ -34,10 +41,10 @@ In the next links you can see the pinout of each board:
3441
- [PMODRF2 pionut.](https://reference.digilentinc.com/reference/pmod/pmodrf2/start)
3542

3643
Once you've set all the wires, power-on the RPI and download the next repository inside the RPI:
37-
- https://github.com/micro-ROS/micro-ROS-bridge_RPI
44+
- https://github.com/micro-ROS/micro-ROS-bridge_RPI/
3845

39-
Execute the next command:
40-
```sudo ./micro-ROS-bridge_RPI/RPI_6lowpan/script.sh```
46+
Execute the command:
47+
```sudo ./micro-ROS-bridge_RPI/micro-ROS-HB.sh```
4148

4249
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 connections are fine:
4350
```dmesg | grep mrf24j40```
@@ -51,7 +58,6 @@ The last point is to set-up the network.
5158

5259
- Set the PAN ID: ``sudo iwpan dev wpan0 set pan_id 0xabcd``
5360
- Set the page and channel: ``sudo iwpan phy phy0 set channel 0 26``
54-
- Set the short address: ``sudo iwpan dev wpan0 set short_addr 0x4204`` (Each board must a different one)
5561
- Attach the phy layer to the lowpan: ``sudo ip link add link wpan0 name lowpan0 type lowpan``
5662
- Bring up the WPAN0 interface: ``sudo ip link set wpan0 up``
5763
- Bring up the RPI lowpan: ``sudo ip link set lowpan0 up``
@@ -60,7 +66,7 @@ The last point is to set-up the network.
6066
Now the RPI is ready to send and receive messages from a NuttX board or another RPI.
6167

6268

63-
## How to set-up 6lowpan in NuttX?
69+
## Set-Up 6LoWPAN communications on NuttX
6470

6571
First, we need to do the connections between the [Olimex board](/docs/overview/hardware) and the PMODRF2 module.
6672

@@ -70,39 +76,46 @@ First, we need to do the connections between the [Olimex board](/docs/overview/h
7076
- `Board D10` -> `MRF24J40 CS`
7177
- `Board D8` -> `MRF24J40 INT`
7278

73-
Once the wiring is finished, we need to compile and upload the firmware. Type the next commands:
74-
75-
Go to the main folder of NuttX and type the command to configure the board:
76-
`./scripts/configure.sh olimex-stm32-e407 mrf24j40-6lowpan`
77-
78-
Compile:
79-
`make`
79+
### Create firmware
8080

81-
Upload:
82-
`./scripts/flash.sh olimex-stm32-e407`
83-
84-
It should return somenthing like this:
85-
86-
- Configuration:
87-
```
88-
Copy files
89-
Refreshing...
81+
For this tutorial we're going to execute the configuration below in the Micro-ROS build system:
82+
```bash
83+
ros2 run micro_ros_setup create_firmware_ws.sh nuttx olimex-stm32-e407
84+
ros2 run micro_ros_setup configure_firmware.sh mrf24j40-6lowpan
9085
```
91-
- Compilation:
86+
87+
Once the board is configured, we need to build it by typing the command:
88+
```bash
89+
ros2 run micro_ros_setup build_firmware.sh
9290
```
91+
92+
If the compilation succeds, it should return the following output:
93+
```bash
9394
CP: nuttx.hex
9495
CP: nuttx.bin
9596
```
96-
- Upload the firmware
97+
98+
### Flash the firmware
99+
Once the firmware is ready, you need to do the following connections:
100+
- Connect the JTAG flasher device to the JTAG port.
101+
- Connect the mini-USB port to the USB-OTG2 port.
102+
- Check if the radio connections are fine.
103+
104+
Now flash the board by typing the command:
105+
```bash
106+
ros2 run micro_ros_setup flash_firmware.sh
97107
```
98-
wrote 131072 bytes from file nuttx.bin in 3.763846s (34.008 KiB/s)
108+
109+
This should return this output once the process is finished:
110+
```bash
111+
wrote 49152 bytes from file nuttx.bin in 6.279262s (7.644 KiB/s)
99112
Info : Listening on port 6666 for tcl connections
100113
Info : Listening on port 4444 for telnet connections
101114
```
102-
(The number of written bytes could be different in each board)
103115

116+
## NuttX network configuration
104117

105-
Finally, connect the mini USB cable to the USB OTG2, and the console should return the next:
118+
Push the reset button and type Enter two times. Now the NSH console should be output through the terminal. Type ``?`` to check if every application is flashed. The following output should appear.
106119

107120
```bash
108121
nsh> ?
@@ -161,10 +174,6 @@ Available commands
161174

162175
```
163176
164-
**At this point the network is ready to work!**
165-
166-
Finally type ``quit`` two times to close the app and come back to the main menu.
167-
168177
## Sending a message from NuttX to Raspbian:
169178
170179
### Raspberry Part:
@@ -228,18 +237,18 @@ lowpan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1280
228237
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
229238
```
230239
231-
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.
240+
As you can see, there are two IPs in this network interface, but we are interested only in the second one. Save it because we will use it later with NuttX.
232241
`fe80::9c6e:87a5:eb60:84d0``
233242

234-
Go to the place where lives the repo that you downloaded previously. Go to ``micro-ROS-bridge_RPI/RPI_6lowpan/Examples/6lowpan_recv``
235-
Finally, execute `recv_demo` telling to open the `61616` port. Type this command: ``./recv_demo 61616``
243+
Go to the place where you previously downloaded the repo. From there, go to ``micro-ROS-bridge_RPI/6LowPAN_Tests/6lowpan_recv``
244+
Finally, execute `recv_demo`, specifying to open the `61616` port. To do so, type this command: ``./recv_demo 61616``
236245

237246
At this point, the RPI is ready to receive incoming packages.
238247

239-
### NuttX part:
248+
### NuttX side
240249

241250
Execute ``udp_6lowpan`` application.
242-
This will ask you if you want to configure the network. Type N, because is already configured.
251+
This will ask you if you want to configure the network. Type N, because it is already configured.
243252
Now you're in the main menu of the App. Type ``write`` to start the sending mode and will ask for the next data:
244253
- The destination IP: This is the IP of the RPI which we saved previously.
245254
- The destination port: For this specific example is 61617.
@@ -282,24 +291,22 @@ The Linux 6lowpan utility needs to have a ping response before sending a data pa
282291
283292
If this does not work, do as follow:
284293
285-
Check if the Nuttx address is part within the Linux/Raspbian neighborhood table.
294+
Check if the Nuttx address is part of the Linux/Raspbian neighborhood table.
286295
If it is saved there, remove it:
287296
```bash
288-
$ ip neigh # a bunch of address shall appear including yours (if you send a
289-
message already)
297+
$ ip neigh
290298
fe80::2be:adde:de:fa00 dev lowpan0 FAILED
291299
$ sudo ip neigh delete fe80::2be:adde:de:fa00 dev lowpan0 # Remove it.
292300
```
293301
294-
Then, once deleted, add the Nuttx device it permanently (until reboot):
302+
Then, once deleted, add the Nuttx device permanently (until reboot):
295303
296304
```bash
297-
$ sudo ip neigh add fe80::2be:adde:de:fa00 dev lowpan0 00:be:ad:de:00:de:fa:00 # Add it with the
298-
corret Hardware address.
305+
$ sudo ip neigh add fe80::2be:adde:de:fa00 dev lowpan0 00:be:ad:de:00:de:fa:00
299306
```
300307
301-
### NuttX part:
302-
First, we need the ip of the board, so type ``ifconfig`` in the main menu. This should return somenthing like this:
308+
### NuttX side
309+
First, we need the IP of the board, so type ``ifconfig`` in the main menu. This should return something like this:
303310
```bash
304311
wpan0 Link encap:6LoWPAN HWaddr 00:be:ad:de:00:de:fa:00 at UP
305312
inet6 addr: fe80::2be:adde:de:fa00/64
@@ -339,12 +346,12 @@ Introduce the reception port
339346
Listening on 61616 for input packets
340347
```
341348
342-
### Raspbian Part:
349+
### Raspbian side
343350
344-
Go to the places that lives the previous download repo. Then go to this folder: ``/micro-ROS-bridge_RPI/RPI_6lowpan/Examples/6lowpan_send``
351+
Go to the place where you previously downloaded the repo. Then go to this folder: ``/micro-ROS-bridge_RPI/6LowPAN_Tests/6lowpan_send``.
345352
346-
And execute with root privileges the next app: ``send_demo``.
347-
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:
353+
Now execute with root privileges the next app: ``send_demo``.
354+
These demos have two arguments: The first is the port to open in the destination and the second is the destination IP. A specific example for this demo could be:
348355
``sudo send_demo 61616 fe80::2be:adde:de:fa00``
349356
350357
This app returns any data.

0 commit comments

Comments
 (0)