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
Copy file name to clipboardExpand all lines: documentation/asciidoc/microcontrollers/debug-probe/uart-connection.adoc
+75Lines changed: 75 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -57,3 +57,78 @@ For terminal programs that support it, a description of the USB serial UART is a
57
57
image::images/description.jpg[width="60%"]
58
58
59
59
The unique serial number in this description means that on Windows your COM port numbering is "sticky" per device, and will allow you to write `udev` rules to associate a named device node with a particular Debug Probe.
60
+
61
+
== RTT connections
62
+
63
+
You can also configure your application to send its output directly over the SWD interface without the need for a UART connection. This uses a mechanism called Segger Real-Time Transport (RTT).
64
+
65
+
To do this, you must enable the RTT stdio driver in your application and connect to RTT with the Debug Probe.
66
+
67
+
NOTE: You must use a *debug build* of your application to send output over SWD.
68
+
69
+
=== Enabling the RTT stdio driver
70
+
71
+
The C/C++ SDK provides a stdio driver for RTT just like the ones for UART and USB. For more information, see xref:../pico-sdk/runtime.adoc#group_pico_stdio_rtt[pico_stdio_rtt].
72
+
73
+
To enable the driver in your build, include the following line in your *CMakeLists.txt* file (or link with *pico_stdio_rtt* which does the same thing):
74
+
75
+
[source,console]
76
+
----
77
+
pico_enable_stdio_rtt(<your_project_name> 1)
78
+
----
79
+
80
+
After calling `stdio_init_all()`, any output that your application sends with `printf()` is sent to RTT. If you want to copy your output to the UART as well, you can enable that too.
81
+
82
+
=== Connecting to RTT from VSCode
83
+
84
+
RTT is supported by OpenOCD and the VSCode https://marketplace.visualstudio.com/items?itemName=marus25.cortex-debug[Cortex-Debug] extension; both of these are set up as part of xref:../microcontrollers/debug-probe.adoc#install-tools[installing the tools].
85
+
86
+
To enable RTT for a debug session add a section to its launch configuration. Open your project's `.vscode` folder and add the following lines to the `launch.json` file, putting them in the appropriate configuration section, such as `"Pico Debug (Cortex-Debug)"`:
87
+
88
+
[source,json]
89
+
----
90
+
"rttConfig": {
91
+
"enabled": true,
92
+
"address": "auto",
93
+
"decoders": [
94
+
{
95
+
"label": "",
96
+
"port": 0,
97
+
"type": "console"
98
+
}
99
+
]
100
+
}
101
+
----
102
+
103
+
For more information, see https://github.com/Marus/cortex-debug/blob/master/debug_attributes.md[cortex-debug launch attributes].
104
+
105
+
If you now launch a debug session on an RTT-enabled application and open the *TERMINAL* tab, you see a list on the right that includes `RTT Ch:0 console`. Select this to see the output that your application sends to the `pico_stdio_rtt` driver.
106
+
107
+
=== Connecting to RTT in a standalone debug session
108
+
109
+
If you are using a standalone debug session as described in xref:../microcontrollers/debug-probe.adoc#standalone-debug-session[Starting a Debug Session], you can connect to RTT by completing the following steps:
110
+
111
+
. Build and upload your RTT-enabled application.
112
+
. Connect the Debug Probe and start `openocd` and `gdb` in separate terminals. For more information, see xref:../microcontrollers/debug-probe.adoc#standalone-debug-session[Standalone debug session].
113
+
114
+
. At the `gdb` prompt enter the following commands:
NOTE: The `gdb` commands prefixed with `monitor` are passed through to `openocd`. For more information about the commands used here, see https://openocd.org/doc/html/General-Commands.html[section 15.6] of the OpenOCD Manual.
126
+
+
127
+
OpenOCD searches for an RTT control block on the target and then creates a local TCP socket on port 60000.
128
+
129
+
. Open a third window and connect to the local socket with a tool like `nc` (netcat) or equivalent to see the RTT output from your application:
Copy file name to clipboardExpand all lines: documentation/asciidoc/microcontrollers/debug-probe/updating-firmware.adoc
+8-6Lines changed: 8 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,18 +5,20 @@ Firmware for the Debug Probe is available as a UF2 file distributed by Raspberry
5
5
The latest version of the Debug Probe firmware is version 2.2.3. If you're running an older version, or if you have accidentally overwritten the firmware on your Debug Probe, you can find the latest release of the firmware in https://github.com/raspberrypi/debugprobe/releases/latest[the debugprobe GitHub repository].
6
6
7
7
To check the firmware version of your Debug Probe, run:
8
+
8
9
[source, console]
9
10
----
10
11
$ lsusb -v -d 2e8a:000c | grep bcdDevice
11
12
----
12
-
This will report `bcdDevice 2.23` for Debug Probe firmware version 2.2.3.
13
+
14
+
This reports `bcdDevice 2.23` for Debug Probe firmware version 2.2.3.
13
15
14
16
NOTE: The `Info : CMSIS-DAP: FW Version = 2.0.0` line reported by `openocd` only refers to the CMSIS-DAP protocol level (which is different to the Debug Probe firmware version).
15
17
16
18
To update the firmware version of your Debug Probe:
17
19
18
-
1. Download `debugprobe.uf2` from the latest release.
19
-
1. Pinch to remove the top of the Debug Probe enclosure.
20
-
1. Push and hold the BOOTSEL button as you plug the Debug Probe into your computer, to mount a volume called "RPI-RP2".
21
-
1. Copy `debugprobe.uf2` onto the "RPI-RP2" volume. The volume will dismount automatically after the file finishes copying onto the device.
22
-
1. Your Debug Probe will reboot and now runs an updated version of the Debug Probe firmware. It is now ready for debugging.
20
+
. Download `debugprobe.uf2` from the latest release.
21
+
. Pinch to remove the top of the Debug Probe enclosure.
22
+
. Push and hold the BOOTSEL button as you plug the Debug Probe into your computer, to mount a volume called "RPI-RP2".
23
+
. Copy `debugprobe.uf2` onto the "RPI-RP2" volume. The volume will dismount automatically after the file finishes copying onto the device.
24
+
. Your Debug Probe reboots and now runs an updated version of the Debug Probe firmware. It is now ready for debugging.
0 commit comments