-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Signal Capture for debug
WORK_IN_PROGRESS
This is not that useful if you have already logic analyzer or oscilloscope. This can be used by users who don't have such equipments to see signal of their keyboard.
'Signal Capture' firmwares code is available for converters listed below.
-
IBMPC converter: https://github.com/tmk/tmk_keyboard/tree/signal_capture/converter/ibmpc_usb
-
PC98 converter: https://github.com/tmk/tmk_keyboard/tree/signal_capture/converter/pc98_usb
Download proper firmware *_capture_*.hex
for your converter.
- https://github.com/tmk/tmk_keyboard/tree/signal_capture/converter/ibmpc_usb/binary
- https://github.com/tmk/tmk_keyboard/tree/signal_capture/converter/pc98_usb/binary
Build 'Signal Capture' firmware and flash it onto your converter with commands like below.
make -f Makefile.capture clean
make -f Makefile.capture
make -f Makefile.capture dfu
Signal Capture prints signal data in text format on hid_listen
like below.
0021 0001 0001 6401 D423 D5C2 D720 D962 DBD0 DE22 DF53 E091 E2E3 E402
Capture records need to be convertered into Value Change Dump(VCD) format using tmk_core/common/capture2vcd.py to see signal.
You need to install pyvcd before using the script.
$ pip3 install pyvcd
To convert into VCD format:
$ python3 capture2vcd.py <capture_file>
or
$ cat <capture_data> | python3 capture2vcd.py
You can see converted VCD data with tool like Sigrok PulsView.
Captured data are stored in ring buffer at AVR SRAM(0x100-2FF) temporarily and then, printed in format below.
Capture record format:
P: pin state(4-bit)
T: timer(us)
C: overflow count(4096 per count)
1. Pin change: TTTP
pin state should be changed from state of previous record.
TTT indicates time(12-bit): 0-FFFh(4095)
2. Time elapsed: CC0P
pin state should be same as state of previous record.
CC indicates time elapsed: CC(1-255) * 1000h(4096)
3. Time elapsed: 000P
pin state should be same as state of previous record.
this indicates time elapsed: 256 * 1000h(4096)
Just place decoder holder in ~/.local/share/libsigrokdecode/decoders
on Linux and macOS, or
%ProgramData%\libsigrokdecode\decoders
on Windows.