-
Notifications
You must be signed in to change notification settings - Fork 71
#7859 Split NuttX tutorials. #127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
87 commits
Select commit
Hold shift + click to select a range
43a039c
Adding NSH USB and NSH UART tutorial
dfbc8b3
Adding UDP echo tutorial
98e75ad
Little rework of the tutorials
ce0fa58
Text fix
b319f60
Text Fix on UDP echo tutorial
ad46100
Adding tcp echo tutorial
983a128
Adding tcp echo tutorial
1e3dbae
Adding little rework
06c9b25
Little rework on the 6lowpan tutorial
a340a52
More rework on 6lowpan tutorial
822d174
Resolving conflict with master branch
052618e
Update _docs/tutorials/advanced/nuttx/6lowpan_config/index.md
d6b98b5
Update _docs/tutorials/advanced/nuttx/6lowpan_config/index.md
01cd977
Update _docs/tutorials/advanced/nuttx/6lowpan_config/index.md
e8a743c
Update _docs/tutorials/advanced/nuttx/6lowpan_config/index.md
957af84
Update _docs/tutorials/advanced/nuttx/6lowpan_config/index.md
15ee97c
Update _docs/tutorials/advanced/nuttx/6lowpan_config/index.md
a884f8e
Update _docs/tutorials/advanced/nuttx/6lowpan_config/index.md
89ef9e2
Update _docs/tutorials/advanced/nuttx/6lowpan_config/index.md
b7c8c9f
Update _docs/tutorials/advanced/nuttx/6lowpan_config/index.md
4792cc9
Update _docs/tutorials/advanced/nuttx/6lowpan_config/index.md
6770b12
Update _docs/tutorials/advanced/nuttx/6lowpan_config/index.md
e7b26db
Update _docs/tutorials/advanced/nuttx/6lowpan_config/index.md
fc2ff6c
Update _docs/tutorials/advanced/nuttx/6lowpan_config/index.md
9b91636
Update _docs/tutorials/advanced/nuttx/6lowpan_config/index.md
00a3496
Update _docs/tutorials/advanced/nuttx/nsh_uart/index.md
48e6415
Update _docs/tutorials/advanced/nuttx/nsh_uart/index.md
a9a26b5
Update _docs/tutorials/advanced/nuttx/nsh_uart/index.md
ae38aa9
Update _docs/tutorials/advanced/nuttx/nsh_uart/index.md
b033cbc
Update _docs/tutorials/advanced/nuttx/nsh_uart/index.md
0891d7c
Update _docs/tutorials/advanced/nuttx/udp_echo/index.md
a5eaed8
Update _docs/tutorials/advanced/nuttx/udp_echo/index.md
2a04e6e
Update _docs/tutorials/advanced/nuttx/udp_echo/index.md
5fb3c95
Update _docs/tutorials/advanced/nuttx/udp_echo/index.md
1c1d9b4
Update _docs/tutorials/advanced/nuttx/udp_echo/index.md
2870f14
Update _docs/tutorials/advanced/nuttx/nsh_uart/index.md
f34cf7a
Update _docs/tutorials/advanced/nuttx/6lowpan_config/index.md
bdef036
Update _docs/tutorials/advanced/nuttx/6lowpan_config/index.md
6f81537
Update _docs/tutorials/advanced/nuttx/6lowpan_config/index.md
1974d3b
Update _docs/tutorials/advanced/nuttx/6lowpan_config/index.md
cc2901b
Update _docs/tutorials/advanced/nuttx/6lowpan_config/index.md
1655950
Update _docs/tutorials/advanced/nuttx/6lowpan_config/index.md
a4fcc8d
Update _docs/tutorials/advanced/nuttx/nsh_uart/index.md
ad56162
Update _docs/tutorials/advanced/nuttx/nsh_usb/index.md
8353328
Update _docs/tutorials/advanced/nuttx/nsh_usb/index.md
ad04e62
Update _docs/tutorials/advanced/nuttx/nsh_usb/index.md
4dfdf1a
Update _docs/tutorials/advanced/nuttx/nsh_usb/index.md
9cbfde2
Update _docs/tutorials/advanced/nuttx/nsh_usb/index.md
7e58797
Update _docs/tutorials/advanced/nuttx/nsh_usb/index.md
181a97e
Update _docs/tutorials/advanced/nuttx/nsh_usb/index.md
a76aa1b
Update _docs/tutorials/advanced/nuttx/nsh_usb/index.md
8287dfb
Update _docs/tutorials/advanced/nuttx/nsh_usb/index.md
e4e4f86
Update _docs/tutorials/advanced/nuttx/nsh_usb/index.md
4f916d1
Update _docs/tutorials/advanced/nuttx/tcp_echo/index.md
5e78b87
Update _docs/tutorials/advanced/nuttx/tcp_echo/index.md
60acdd0
Update _docs/tutorials/advanced/nuttx/tcp_echo/index.md
aaa6013
Update _docs/tutorials/advanced/nuttx/tcp_echo/index.md
1df2bcc
Update _docs/tutorials/advanced/nuttx/tcp_echo/index.md
db659ed
Update _docs/tutorials/advanced/nuttx/tcp_echo/index.md
c7081d6
Update _docs/tutorials/advanced/nuttx/tcp_echo/index.md
0ac008e
Update _docs/tutorials/advanced/nuttx/tcp_echo/index.md
b90de09
Update _docs/tutorials/advanced/nuttx/tcp_echo/index.md
d475832
Update _docs/tutorials/advanced/nuttx/tcp_echo/index.md
d855b5c
Update _docs/tutorials/advanced/nuttx/tcp_echo/index.md
2cd10f3
Update _docs/tutorials/advanced/nuttx/tcp_echo/index.md
47881a4
Update _docs/tutorials/advanced/nuttx/tcp_echo/index.md
0973818
Update _docs/tutorials/advanced/nuttx/tcp_echo/index.md
af5f75b
Update _docs/tutorials/advanced/nuttx/tcp_echo/index.md
3c8125c
Update _docs/tutorials/advanced/nuttx/tcp_echo/index.md
1d5d375
Update _docs/tutorials/advanced/nuttx/tcp_echo/index.md
7ae02e6
Update _docs/tutorials/advanced/nuttx/tcp_echo/index.md
074334f
Update _docs/tutorials/advanced/nuttx/udp_echo/index.md
f469879
Update _docs/tutorials/advanced/nuttx/udp_echo/index.md
5c410a3
Update _docs/tutorials/advanced/nuttx/udp_echo/index.md
26e483b
Update _docs/tutorials/advanced/nuttx/udp_echo/index.md
0ae695d
Update _docs/tutorials/advanced/nuttx/udp_echo/index.md
b0b3ee4
Update _docs/tutorials/advanced/nuttx/udp_echo/index.md
779d32d
Update _docs/tutorials/advanced/nuttx/udp_echo/index.md
0f1fd14
Update _docs/tutorials/advanced/nuttx/udp_echo/index.md
e921d51
Update _docs/tutorials/advanced/nuttx/udp_echo/index.md
f613cee
Update _docs/tutorials/advanced/nuttx/udp_echo/index.md
b7b502e
Update _docs/tutorials/advanced/nuttx/udp_echo/index.md
005f4af
Update _docs/tutorials/advanced/nuttx/udp_echo/index.md
85c063c
Update _docs/tutorials/advanced/nuttx/udp_echo/index.md
195a84c
Update _docs/tutorials/advanced/nuttx/udp_echo/index.md
5919606
Merge branch 'master' into feature/advance_nuttx/nuttx_split
18f5090
Deleting previous version of NuttX getting started
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,22 +1,29 @@ | ||
| --- | ||
| title: 6LOWPAN communications between NuttX and a Raspberry Pi | ||
| permalink: /docs/tutorials/advanced/nuttx/6lowpan_nuttx_rpi/ | ||
| title: Configure 6LoWPAN communications | ||
| permalink: /docs/tutorials/advanced/nuttx/6lowpan_config/ | ||
| --- | ||
|
|
||
| | RTOS | Board Compatible | | ||
| |:-----:|:-----------------:| | ||
| | NuttX | Olimex-STM32-E407 | | ||
|
|
||
| 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. | ||
|
|
||
| ## What do we need? | ||
|
|
||
| **Disclaimer**: This tutorial doesn't use micro-ROS, it is just a proof of concept of the 6LoWPAN communication. | ||
|
|
||
| ## Hardware requirements: | ||
|
|
||
| - Raspberry Pi 3 | ||
| - micro-SD card (almost 16gb) with Raspbian lite already installed. | ||
| - Olimex-STM32-E407 board. | ||
| - Two PMODRF2 module which are base on the MRF24J40 module. | ||
| - Two PMODRF2 modules which are based on the MRF24J40 module. | ||
| - PC with Ubuntu (It works fine with Ubuntu 16.04) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. and higher? (maybe specify)
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't get what do you mean with "higher". |
||
| - 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). | ||
| ## How to set-up 6lowpan RPI? | ||
|
|
||
| First, we need to connect the PMODRF2 module to the RPI, so we need to set the next connections: | ||
| ## Set-up 6LoWPAN communications on the Raspberry PI | ||
|
|
||
| First, we need to connect the PMODRF2 module to the RPI, so we need to set the following connections: | ||
|
|
||
| | | RPI | PMODRF2 | | ||
| | -- | -- | -- | | ||
|
|
@@ -34,10 +41,10 @@ In the next links you can see the pinout of each board: | |
| - [PMODRF2 pionut.](https://reference.digilentinc.com/reference/pmod/pmodrf2/start) | ||
|
|
||
| Once you've set all the wires, power-on the RPI and download the next repository inside the RPI: | ||
| - https://github.com/micro-ROS/micro-ROS-bridge_RPI | ||
| - https://github.com/micro-ROS/micro-ROS-bridge_RPI/ | ||
|
|
||
| Execute the next command: | ||
| ```sudo ./micro-ROS-bridge_RPI/RPI_6lowpan/script.sh``` | ||
| Execute the command: | ||
| ```sudo ./micro-ROS-bridge_RPI/micro-ROS-HB.sh``` | ||
|
|
||
| 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: | ||
| ```dmesg | grep mrf24j40``` | ||
|
|
@@ -51,7 +58,6 @@ The last point is to set-up the network. | |
|
|
||
| - Set the PAN ID: ``sudo iwpan dev wpan0 set pan_id 0xabcd`` | ||
| - Set the page and channel: ``sudo iwpan phy phy0 set channel 0 26`` | ||
| - Set the short address: ``sudo iwpan dev wpan0 set short_addr 0x4204`` (Each board must a different one) | ||
| - Attach the phy layer to the lowpan: ``sudo ip link add link wpan0 name lowpan0 type lowpan`` | ||
| - Bring up the WPAN0 interface: ``sudo ip link set wpan0 up`` | ||
| - Bring up the RPI lowpan: ``sudo ip link set lowpan0 up`` | ||
|
|
@@ -60,7 +66,7 @@ The last point is to set-up the network. | |
| Now the RPI is ready to send and receive messages from a NuttX board or another RPI. | ||
|
|
||
|
|
||
| ## How to set-up 6lowpan in NuttX? | ||
| ## Set-Up 6LoWPAN communications on NuttX | ||
|
|
||
| First, we need to do the connections between the [Olimex board](/docs/overview/hardware) and the PMODRF2 module. | ||
|
|
||
|
|
@@ -70,39 +76,46 @@ First, we need to do the connections between the [Olimex board](/docs/overview/h | |
| - `Board D10` -> `MRF24J40 CS` | ||
| - `Board D8` -> `MRF24J40 INT` | ||
|
|
||
| Once the wiring is finished, we need to compile and upload the firmware. Type the next commands: | ||
|
|
||
| Go to the main folder of NuttX and type the command to configure the board: | ||
| `./scripts/configure.sh olimex-stm32-e407 mrf24j40-6lowpan` | ||
|
|
||
| Compile: | ||
| `make` | ||
| ### Create firmware | ||
|
|
||
| Upload: | ||
| `./scripts/flash.sh olimex-stm32-e407` | ||
|
|
||
| It should return somenthing like this: | ||
|
|
||
| - Configuration: | ||
| ``` | ||
| Copy files | ||
| Refreshing... | ||
| For this tutorial we're going to execute the configuration below in the Micro-ROS build system: | ||
| ```bash | ||
| ros2 run micro_ros_setup create_firmware_ws.sh nuttx olimex-stm32-e407 | ||
| ros2 run micro_ros_setup configure_firmware.sh mrf24j40-6lowpan | ||
| ``` | ||
| - Compilation: | ||
|
|
||
| Once the board is configured, we need to build it by typing the command: | ||
| ```bash | ||
| ros2 run micro_ros_setup build_firmware.sh | ||
| ``` | ||
|
|
||
| If the compilation succeds, it should return the following output: | ||
| ```bash | ||
| CP: nuttx.hex | ||
| CP: nuttx.bin | ||
| ``` | ||
| - Upload the firmware | ||
|
|
||
| ### Flash the firmware | ||
| Once the firmware is ready, you need to do the following connections: | ||
| - Connect the JTAG flasher device to the JTAG port. | ||
| - Connect the mini-USB port to the USB-OTG2 port. | ||
| - Check if the radio connections are fine. | ||
|
|
||
| Now flash the board by typing the command: | ||
| ```bash | ||
| ros2 run micro_ros_setup flash_firmware.sh | ||
| ``` | ||
| wrote 131072 bytes from file nuttx.bin in 3.763846s (34.008 KiB/s) | ||
|
|
||
| This should return this output once the process is finished: | ||
| ```bash | ||
| wrote 49152 bytes from file nuttx.bin in 6.279262s (7.644 KiB/s) | ||
| Info : Listening on port 6666 for tcl connections | ||
| Info : Listening on port 4444 for telnet connections | ||
| ``` | ||
| (The number of written bytes could be different in each board) | ||
|
|
||
| ## NuttX network configuration | ||
|
|
||
| Finally, connect the mini USB cable to the USB OTG2, and the console should return the next: | ||
| 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. | ||
|
|
||
| ```bash | ||
| nsh> ? | ||
|
|
@@ -161,10 +174,6 @@ Available commands | |
|
|
||
| ``` | ||
|
|
||
| **At this point the network is ready to work!** | ||
|
|
||
| Finally type ``quit`` two times to close the app and come back to the main menu. | ||
|
|
||
| ## Sending a message from NuttX to Raspbian: | ||
|
|
||
| ### Raspberry Part: | ||
|
|
@@ -228,18 +237,18 @@ lowpan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1280 | |
| TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 | ||
| ``` | ||
|
|
||
| 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. | ||
| 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. | ||
| `fe80::9c6e:87a5:eb60:84d0`` | ||
|
|
||
| Go to the place where lives the repo that you downloaded previously. Go to ``micro-ROS-bridge_RPI/RPI_6lowpan/Examples/6lowpan_recv`` | ||
| Finally, execute `recv_demo` telling to open the `61616` port. Type this command: ``./recv_demo 61616`` | ||
| Go to the place where you previously downloaded the repo. From there, go to ``micro-ROS-bridge_RPI/6LowPAN_Tests/6lowpan_recv`` | ||
| Finally, execute `recv_demo`, specifying to open the `61616` port. To do so, type this command: ``./recv_demo 61616`` | ||
|
|
||
| At this point, the RPI is ready to receive incoming packages. | ||
|
|
||
| ### NuttX part: | ||
| ### NuttX side | ||
|
|
||
| Execute ``udp_6lowpan`` application. | ||
| This will ask you if you want to configure the network. Type N, because is already configured. | ||
| This will ask you if you want to configure the network. Type N, because it is already configured. | ||
| Now you're in the main menu of the App. Type ``write`` to start the sending mode and will ask for the next data: | ||
| - The destination IP: This is the IP of the RPI which we saved previously. | ||
| - 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 | |
|
|
||
| If this does not work, do as follow: | ||
|
|
||
| Check if the Nuttx address is part within the Linux/Raspbian neighborhood table. | ||
| Check if the Nuttx address is part of the Linux/Raspbian neighborhood table. | ||
| If it is saved there, remove it: | ||
| ```bash | ||
| $ ip neigh # a bunch of address shall appear including yours (if you send a | ||
| message already) | ||
| $ ip neigh | ||
| fe80::2be:adde:de:fa00 dev lowpan0 FAILED | ||
| $ sudo ip neigh delete fe80::2be:adde:de:fa00 dev lowpan0 # Remove it. | ||
| ``` | ||
|
|
||
| Then, once deleted, add the Nuttx device it permanently (until reboot): | ||
| Then, once deleted, add the Nuttx device permanently (until reboot): | ||
|
|
||
| ```bash | ||
| $ sudo ip neigh add fe80::2be:adde:de:fa00 dev lowpan0 00:be:ad:de:00:de:fa:00 # Add it with the | ||
| corret Hardware address. | ||
| $ sudo ip neigh add fe80::2be:adde:de:fa00 dev lowpan0 00:be:ad:de:00:de:fa:00 | ||
| ``` | ||
|
|
||
| ### NuttX part: | ||
| First, we need the ip of the board, so type ``ifconfig`` in the main menu. This should return somenthing like this: | ||
| ### NuttX side | ||
| First, we need the IP of the board, so type ``ifconfig`` in the main menu. This should return something like this: | ||
| ```bash | ||
| wpan0 Link encap:6LoWPAN HWaddr 00:be:ad:de:00:de:fa:00 at UP | ||
| inet6 addr: fe80::2be:adde:de:fa00/64 | ||
|
|
@@ -339,12 +346,12 @@ Introduce the reception port | |
| Listening on 61616 for input packets | ||
| ``` | ||
|
|
||
| ### Raspbian Part: | ||
| ### Raspbian side | ||
|
|
||
| Go to the places that lives the previous download repo. Then go to this folder: ``/micro-ROS-bridge_RPI/RPI_6lowpan/Examples/6lowpan_send`` | ||
| Go to the place where you previously downloaded the repo. Then go to this folder: ``/micro-ROS-bridge_RPI/6LowPAN_Tests/6lowpan_send``. | ||
|
|
||
| And execute with root privileges the next app: ``send_demo``. | ||
| 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: | ||
| Now execute with root privileges the next app: ``send_demo``. | ||
| 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: | ||
| ``sudo send_demo 61616 fe80::2be:adde:de:fa00`` | ||
|
|
||
| This app returns any data. | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.