Skip to content

Signal Capture for debug

hasu@tmk edited this page Feb 14, 2022 · 28 revisions

WORK_IN_PROGRESS

This is not useful if you have logic analyzer or oscilloscope. This is used by users without the equipments to see signal of their keyboard.

There are converter firmwares with Signal Capture enabled.

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

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

make -f Makefile.capture

Capture record

Signal Capture prints signal data in text format on hid_listen like below.

64CF51:23 446D67:61 447A47:60 448713:62 44A9E8:60 44AB5C:61 44AC76:63 44AED4:61 44B163:63 

format on hid_listen:

# Capture record format: <time> ':' <stat>
#     time   6 hex chars; timestamp of event, which counts 1/16 us per tick
#           and is comprised of three bytes:
#               timer xtra(overflow count)
#               timer high
#               timer low
#     stat   2 hex chars;  Pin state

Convert into VCD format

Capture records need to be convertered into Value Change Dump data to see signal.

https://en.wikipedia.org/wiki/Value_change_dump

$ python3 capture2vcd.py <capture_file>

or

$ cat <capture_data> | python3 capture2vcd.py

You can see converted VCD data with tool like sigrok pulsview or GTKWave.

Internals

Capture record format in AVR memory(0x100-2FF):

// Capture record in iqueue buffer:
//     [0]:Pin
//     [1]:Timer low
//     [2]:Timer high
//     [3]:Timer overflow
Clone this wiki locally