Add 'Mode 3: debug interface pinout detector'

Triss 2021-08-01 23:21:15 +00:00
parent f5a237358e
commit 4bfaccc510
1 changed files with 41 additions and 0 deletions

@ -0,0 +1,41 @@
Mode 3 provides a tool to scan for JTAG and SWD pinouts on a board.
The implementation is lifted from [JTAGenum](https://github.com/cyphunk/JTAGenum/blob/master/JTAGenum.ino) and [SWDscan](https://github.com/szymonh/SWDscan/blob/master/src/main.cpp), for which we are very grateful.
## Pinout
Any pin marked as "test pin" below can be probed. Actual pins probed depends on the command used to scan, see [dmctl](https://git.lain.faith/sys64738/DapperMime-JTAG/wiki/dmctl#jtag-scan).
### Raspberry Pico
On the Raspberry Pico, 20 pins can be used:
| Pin number | Usage | Usage | Pin number |
|:---------- |:-------------- | --------------:| ----------:|
| GP0 | stdio UART TX | | VBUS |
| GP1 | stdio UART RX | | VSYS |
| GND | <ground> | <ground> | GND |
| GP2 | Test pin | | 3V3 EN |
| GP3 | Test pin | | 3V3 OUT |
| GP4 | Test pin | | ADC VREF |
| GP5 | Test pin | | GP28 / ADC2|
| GND | <ground> | <ground> | GND / AGND|
| GP6 | Test pin | | GP27 / ADC1|
| GP7 | Test pin | | GP26 / ADC0|
| GP8 | Test pin | | RUN |
| GP9 | Test pin | Test pin | GP22 |
| GND | <ground> | <ground> | GND |
| GP10 | Test pin | Test pin | GP21 |
| GP11 | Test pin | Test pin | GP20 |
| GP12 | Test pin | Test pin | GP19 |
| GP13 | Test pin | Test pin | GP18 |
| GND | <ground> | <ground> | GND |
| GP14 | Test pin | Test pin | GP17 |
| GP15 | Test pin | Test pin | GP16 |
| <end>| <bottom> | <bottom> | <end>|
## Usage
This mode is controlled entirely through [dmctl](https://git.lain.faith/sys64738/DapperMime-JTAG/wiki/dmctl#jtag-scan).
Time spent scanning is proportional to `n_pins_probed nCr n_pins_in_itf`, i.e. `n_pins_probed!/(n_pins_probed-n_pins_in_itf)!`. For JTAG, `n_pins_in_itf` is equal to 5, for SWD, it is 2. `n_pins_probed` depends on the `start` and `end` arguments passed to `dmctl`.