Skip to content

Signal Capture for debug

hasu@tmk edited this page May 21, 2022 · 28 revisions

Signal Capture Firmware

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.

There are firmwares with 'Signal Capture' feature enabled.

For IBMPC converter: https://github.com/tmk/tmk_keyboard/tree/signal_capture/converter/ibmpc_usb

For PC98 converter: https://github.com/tmk/tmk_keyboard/tree/signal_capture/converter/pc98_usb

Build 'Signal Capture' firmware and flash it onto your converter with command below.

make -f Makefile.capture clean
make -f Makefile.capture
make -f Makefile.capture dfu

Capture record

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 

Convert into VCD format

Capture records need to be convertered into Value Change Dump(VCD) format using tmk_core/common/capture2vcd.py to see signal.

$ python3 capture2vcd.py <capture_file>

or

$ cat <capture_data> | python3 capture2vcd.py

You can see converted VCD data with tool like sigrok PulsView.

Internals

Capture record format

Captured data are stored in ring buffer at AVR SRAM(0x100-2FF) temporarily and then, printed in format below.

    # Pin change:
    #     TTTP
    # Timer overflow:
    #     CC0P
    # P:Pin(4bit)
    # T:Timer(12bit)[us]
    # C:Overflow count(8bit)

Sigrok

https://sigrok.org/wiki/Main_Page

Decoder

Installation

Just place decoder holder in ~/.local/share/libsigrokdecode/decoders on Linux and macOS, or %ProgramData%\libsigrokdecode\decoders on Windows.

IBMPC AT

ADB

Clone this wiki locally