diff --git a/Mode-3%3A-debug-interface-pinout-detector.md b/Mode-3%3A-debug-interface-pinout-detector.md new file mode 100644 index 0000000..872ee68 --- /dev/null +++ b/Mode-3%3A-debug-interface-pinout-detector.md @@ -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`.