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
NSH is a system console that can be used through different interfaces. In this tutorial, we will show how to use it over the UART peripheral. The UART (Universal Asynchronous Receiver-Transmitter) is a communication peripheral implemented on a micro-controller, which allows bidirectional serial communication.
10
+
NSH is a system console that can be used through different interfaces.
11
+
In this tutorial, we will show how to use it over the UART and USB peripherals.
For this tutorial we're going to execute the following configuration in the Micro-ROS build system:
22
+
For this tutorial we are going to execute the following configuration in micro-ros-build:
23
+
20
24
```bash
21
25
ros2 run micro_ros_setup create_firmware_ws.sh nuttx olimex-stm32-e407
26
+
# For UART
22
27
ros2 run micro_ros_setup configure_firmware.sh nsh_uart
28
+
# For USB
29
+
ros2 run micro_ros_setup configure_firmware.sh nsh
23
30
```
24
31
25
32
Once the board is configured, we need to build it by typing the command:
33
+
26
34
```bash
27
35
ros2 run micro_ros_setup build_firmware.sh
28
36
```
29
37
30
-
If the compilation succeds, it should return this output:
38
+
If the compilation succeeds, it should return this output:
31
39
```bash
32
40
CP: nuttx.hex
33
41
CP: nuttx.bin
34
42
```
35
-
## Flash the firmware
36
43
37
-
The firmware is ready, it is just necessary to upload it. Now you need to do the following connection:
44
+
# Flash the firmware
45
+
46
+
The firmware is ready, it is just necessary to upload it.
47
+
Now you need to do the following connections:
38
48
- Connect the JTAG flasher device.
39
-
- Connect the USB TTL-232 with these pins out:
40
-
-`USART3 TX` -> `TTL232 RX`
41
-
-`USART3 RX` -> `TTL232 TX`
42
-
-`GND Board` -> `TTL232 GND`
49
+
- Connect the USB TTL-232 to the USART3 in case of UART communication:
50
+
-`USART3 TX` -> `TTL232 RX`
51
+
-`USART3 RX` -> `TTL232 TX`
52
+
-`GND Board` -> `TTL232 GND`
43
53
44
-
It should look like this:
45
54

55
+
- Connect the mini USB to the OTG2 for USB communication.
46
56
47
-
Note: You can find multiple USB-TTL232 devices available. But, even though the Olimex board is 5V tolerant, we recommend to use a 3V3 USB-TTL232 cable. The [Olimex Official cable](https://www.olimex.com/Products/Components/Cables/USB-Serial-Cable/USB-Serial-Cable-F/) is our recommendation but any is compatible.
57
+

48
58
49
59
Now flash the board by typing the next command:
50
60
```bash
51
61
ros2 run micro_ros_setup flash_firmware.sh
52
62
```
53
63
54
64
This should return this output once the process is finished:
65
+
55
66
```bash
56
67
wrote 49152 bytes from file nuttx.bin in 6.279262s (7.644 KiB/s)
57
68
Info : Listening on port 6666 for tcl connections
58
69
Info : Listening on port 4444 for telnet connections
59
70
```
71
+
60
72
## Connect to the console
61
73
62
-
Finally, connect the USB cable to the PC and open a terminal. Type the command ``dmesg`` to know the direction of the device. It should return something like this:
74
+
Finally, to use the NSH console you need to follow the steps listed below:
75
+
- Push the reset button. The green LED will turn on to say that it is working properly.
76
+
- Look for the device by typing `dmesg` on the console, this should return something like this:
77
+
63
78
```bash
79
+
# For UART
64
80
[17154.225244] usb 1-2: new full-speed USB device number 6 using xhci_hcd
65
81
[17154.380060] usb 1-2: New USB device found, idVendor=0403, idProduct=6001, bcdDevice= 6.00
66
82
[17154.380066] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
@@ -75,16 +91,30 @@ Finally, connect the USB cable to the PC and open a terminal. Type the command `
75
91
[17154.402762] usb 1-2: Detected FT232RL
76
92
[17154.403058] usb 1-2: FTDI USB Serial Device converter now attached to ttyUSB0
77
93
94
+
# For USB
95
+
[20614.570781] usb 1-2: new full-speed USB device number 7 using xhci_hcd
96
+
[20614.724366] usb 1-2: New USB device found, idVendor=0525, idProduct=a4a7, bcdDevice= 1.01
97
+
[20614.724372] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
98
+
[20614.724375] usb 1-2: Product: CDC/ACM Serial
99
+
[20614.724378] usb 1-2: Manufacturer: NuttX
100
+
[20614.724381] usb 1-2: SerialNumber: 0
101
+
[20614.745693] cdc_acm 1-2:1.0: ttyACM0: USB ACM device
102
+
[20614.746274] usbcore: registered new interface driver cdc_acm
103
+
[20614.746277] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
78
104
```
79
-
80
-
In this specific situation, the device is assigned to ``dev/ttyUSB0`` but it could be a different number.
105
+
In this specific situation, the device is assigned to `dev/ttyUSB0` and `dev/ttyACM0` for UART and USB communication respectively. Note that the last number could be different.
81
106
82
107
Finally, execute the next command to open the NSH console:
83
108
```
109
+
# For UART
84
110
sudo minicom -D /dev/ttyUSB0
111
+
112
+
# For USB
113
+
sudo minicom -D /dev/ttyACM0
85
114
```
86
115
87
-
Once the application is executed, push enter and it should return the next menu:
116
+
Once the port is opened, **you need to push two times the Enter key** and it should show the next menu:
117
+
88
118
```bash
89
119
nsh>?
90
120
help usage: help [-v] [<cmd>]
@@ -95,6 +125,4 @@ help usage: help [-v] [<cmd>]
95
125
96
126
Builtin Apps:
97
127
nsh>
98
-
```
99
-
100
-
Note: If you don't succeed with theses steps, check if you set a baud rate of 115200 bps and the configuration is set to 8N1 with no hardware and software flow control.
0 commit comments