Update 'dpctl'

Triss 2021-08-17 22:19:32 +00:00
parent 4080d4a486
commit 2f020fdc20
1 changed files with 32 additions and 31 deletions

@ -1,20 +1,21 @@
`dmctl` is the host-side utility for configuring the device at runtime. It can be used to query device info, switch to another mode, or perform a few mode-specific commands.
`dpctl` is the host-side utility for configuring the device at runtime. It can be used to query device info, switch to another mode, or perform a few mode-specific commands.
Communicating these commands happens over the [USB vendor interface](USB-config-%26-command-protocol).
### General usage
The `dmctl.sh` script can be found in the `host/` directory in the source tree.
The `dpctl.sh` script can be found in the `host/` directory in the source tree.
```
$ ./dmctl.sh --help
$ ./dpctl.sh --help
usage: dmctl [-h] [--conn CONN] subcommand ...
optional arguments:
-h, --help show this help message and exit
--conn CONN Connection string. Either a dmj-char device in /dev, a USB
bus.device number, or a USB VID:PID pair. Defaults to trying
/dev/dmj-* (if there is only one), and cafe:1312 otherwise.
--conn CONN Connection string. Either a dragonprobe-char device in /dev,
a USB bus.device number, or a USB VID:PID pair. Defaults to
trying /dev/dragonprobe-* (if there is only one), and
cafe:1312 otherwise.
subcommands:
For more info on each subcommand, run the program with 'subcommand --help' as
@ -36,7 +37,7 @@ subcommands:
### Connecting to a device
While it is possible to have `dmctl` connect directly to a USB device (using `--conn vid:pid` or `--conn bus.dev`), having the kernel module loaded will keep the USB vendor interface reserved for itself. To work around this problem, [a character device driver](Linux-kernel-modules) has been made, which exposes a `/dev/dmj-<id>` device which can also be used by `dmctl` using `--conn /dev/dmj-<id>`.
While it is possible to have `dpctl` connect directly to a USB device (using `--conn vid:pid` or `--conn bus.dev`), having the kernel module loaded will keep the USB vendor interface reserved for itself. To work around this problem, [a character device driver](Linux-kernel-modules) has been made, which exposes a `/dev/dragonprobe-<id>` device which can also be used by `dpctl` using `--conn /dev/dragonprobe-<id>`.
### General subcommands
@ -45,7 +46,7 @@ While it is possible to have `dmctl` connect directly to a USB device (using `--
Shows general device information. No other arguments required. Example:
```
$ ./dmctl.sh get-device-info
$ ./dpctl.sh get-device-info
CMSIS-DAP (RP2040 Pico): protocol version: 00.10, currently in mode 1 (Default mode with misc features)
available modes: 1, 4
```
@ -55,13 +56,13 @@ available modes: 1, 4
Gets info of a specific mode. An extra mode number can be specified, but it defaults to the current mode. Using `all` as mode number displays the information of all available modes. Example:
```
$ ./dmctl.sh get-mode-info
$ ./dpctl.sh get-mode-info
mode 1: Default mode with misc features: version 00.10 with features 1, 2, 3, 4
$ ./dmctl.sh get-mode-info 4
$ ./dpctl.sh get-mode-info 4
mode 4: SUMP logic analyzer mode: version 00.10 with no features
$ ./dmctl.sh get-mode-info 42
$ ./dpctl.sh get-mode-info 42
No mode 42 available
$ ./dmctl.sh get-mode-info all
$ ./dpctl.sh get-mode-info all
mode 1: Default mode with misc features: version 00.10 with features 1, 2, 3, 4
mode 4: SUMP logic analyzer mode: version 00.10 with no features
```
@ -71,7 +72,7 @@ mode 4: SUMP logic analyzer mode: version 00.10 with no features
This subcommand changes the device mode. Do note that this causes the device to temporarily disconnect for about one half to one second, in order to reconfigure its interface descriptor tables. Example:
```
$ ./dmctl.sh set-mode 4
$ ./dpctl.sh set-mode 4
```
### Mode 1-specific subcommands
@ -81,11 +82,11 @@ $ ./dmctl.sh set-mode 4
Enable or disable UART hardware flow control. Example:
```
$ ./dmctl.sh uart-cts-rts --get
$ ./dpctl.sh uart-cts-rts --get
Flow control disabled
$ ./dmctl.sh uart-cts-rts --enable
$ ./dmctl.sh uart-cts-rts --disable
$ ./dmctl.sh uart-cts-rts --set [true|false|0|1]
$ ./dpctl.sh uart-cts-rts --enable
$ ./dpctl.sh uart-cts-rts --disable
$ ./dpctl.sh uart-cts-rts --set [true|false|0|1]
```
#### tempsensor
@ -93,13 +94,13 @@ $ ./dmctl.sh uart-cts-rts --set [true|false|0|1]
Configures the device address of the emulated I2C temperature sensor device. Example:
```
$ ./dmctl.sh tempsensor --get
$ ./dpctl.sh tempsensor --get
Temperature sensor I2C emulation disabled
$ ./dmctl.sh tempsensor --set 0x18
$ ./dpctl.sh tempsensor --set 0x18
Temperature sensor I2C device changed from disabled to 0x18
$ ./dmctl.sh tempsensor --get
$ ./dpctl.sh tempsensor --get
Temperature sensor I2C device at address 0x18
$ ./dmctl.sh tempsensor --disable
$ ./dpctl.sh tempsensor --disable
Temperature sensor I2C device changed from 0x18 to disabled
```
@ -110,7 +111,7 @@ Temperature sensor I2C device changed from 0x18 to disabled
Does a JTAG (or other supported debug interface) scan:
```
usage: dmctl jtag-scan [-h] {jtag,swd} start end
usage: dpctl jtag-scan [-h] {jtag,swd} start end
positional arguments:
{jtag,swd} Pinout type to check for.
@ -119,7 +120,7 @@ positional arguments:
```
```
$ ./dmctl.sh jtag-scan jtag 10 15
$ ./dpctl.sh jtag-scan jtag 10 15
Starting JTAG scan...
JTAG scan finished (12 matches):
Certain matches:
@ -130,22 +131,22 @@ Possible matches:
3 TCK=11 TMS=10 TDI=14 TDO=12 nTRST=13 #toggle=2
<snip>
$ ./dmctl.sh jtag-scan swd 10 15
$ ./dpctl.sh jtag-scan swd 10 15
Starting SWD scan...
SWD scan finished (1 matches):
1 SWCLK=11 SWDIO=10 idcode=2ba01477
$ ./dmctl.sh jtag-scan swd 15 10
$ ./dpctl.sh jtag-scan swd 15 10
WARN: start pin 15 greater than end pin 10, swapping the order...
Starting SWD scan...
...
SWD scan finished (1 matches):
1 SWCLK=11 SWDIO=10 idcode=2ba01477
$ ./dmctl.sh jtag-scan swd 0 999
$ ./dpctl.sh jtag-scan swd 0 999
Start pin must be at least 2, but is 0
$ ./dmctl.sh jtag-scan idk 10 15
$ ./dpctl.sh jtag-scan idk 10 15
usage: dmctl jtag-scan [-h] {jtag,swd} start end
dmctl jtag-scan: error: argument type: invalid choice: 'idk' (choose from 'jtag', 'swd')
```
@ -157,12 +158,12 @@ dmctl jtag-scan: error: argument type: invalid choice: 'idk' (choose from 'jtag'
This subcommand can be used to get or set the SUMP logic analyzer sampling overclock settings. The actual meaning of the values passed depends on the hardware used. Example:
```
$ ./dmctl.sh sump-overclock --get
$ ./dpctl.sh sump-overclock --get
0
$ ./dmctl.sh sump-overclock --enable
$ ./dmctl.sh sump-overclock --get
$ ./dpctl.sh sump-overclock --enable
$ ./dpctl.sh sump-overclock --get
1
$ ./dmctl.sh sump-overclock --set 0
$ ./dpctl.sh sump-overclock --set 0
```
The setting is a single byte. However, a number of hardware platforms have a binary "enable/disable" option, for which `--enable`/`--disable` flag are made available. These simply set the byte value to 0 or 1.