qmk_firmware

QMK firmware for my keyboards (Corne, Sweep Ferris) and trackball (Ploopy Adept)
Log | Files | Refs | Submodules | LICENSE

readme.md (9706B)


      1 # Debug version matrix.c
      2 
      3 This matrix.c is 0.13.19:quantum/matrix.c with the following additions:
      4 
      5 * Added the MATRIX_DEBUG_SCAN_{START/END} macro to measure the execution time of matrix_scan().
      6 * Added the MATRIX_DEBUG_DELAY_{START/END} macro to measure delay time.
      7 * Added the MATRIX_MUL_SELECT handling for symmetric70_proto.
      8 
      9 ## Current performance
     10 
     11   | MCU               | delay type    | execution time <br> of <br> `matrix_scan()` | matrix scan rate |
     12   |-------------------|---------------|------------|----------------|
     13   | Pro Micro (16MHz) | default       | 503us      | 1810 scans/sec |
     14   | Pro Micro (16MHz) | adaptive      | 383us      | 2320 scans/sec |
     15   | Pro Micro (16MHz) | fast adaptive | 382us      | 2330 scans/sec |
     16   | Proton C (72MHz)  | default       | 210us      | 4350 scans/sec |
     17   | Proton C (72MHz)  | adaptive      | 76.4us     | 10600 scans/sec |
     18   | Proton C (72MHz)  | fast adaptive | 75.6us     | 10800 scans/sec |
     19 
     20 ## Compile
     21 
     22 * Set MATRIX_IO_DELAY value
     23   * `make MTEST=mdelay0 handwired/symmetric70_proto/promicro/normal:default:flash`
     24   * `make MTEST=mdelay=1 handwired/symmetric70_proto/promicro/normal:default:flash`
     25   * `make MTEST=mdelay=2 handwired/symmetric70_proto/promicro/normal:default:flash`
     26   * `make MTEST=mdelay=3 handwired/symmetric70_proto/promicro/normal:default:flash`
     27   * `make MTEST=mdelay=4 handwired/symmetric70_proto/promicro/normal:default:flash`
     28   * `make MTEST=mdelay=5 handwired/symmetric70_proto/promicro/normal:default:flash`
     29   * `make MTEST=mdelay=10 handwired/symmetric70_proto/promicro/normal:default:flash`
     30   * `make MTEST=mdelay=20 handwired/symmetric70_proto/promicro/normal:default:flash`
     31   * `make MTEST=mdelay=30 handwired/symmetric70_proto/promicro/normal:default:flash`
     32 * Measure the execution time of matrix_scan()
     33   * `make MTEST=matrix_debug_scan[,<other options>..] handwired/symmetric70_proto/promicro/normal:default:flash`
     34 * Measure delay time.
     35   * `make MTEST=matrix_debug_delay[,<other options>..] handwired/symmetric70_proto/promicro/normal:default:flash`
     36 * Change the behavior of delay
     37   * `make MTEST=matrix_debug_delay,always_delay handwired/symmetric70_proto/promicro/normal:default:flash`
     38   * `make MTEST=matrix_debug_delay,adaptive_delay,mdelay0 handwired/symmetric70_proto/promicro/normal:default:flash`
     39   * `make MTEST=matrix_debug_delay,adaptive_delay_fast,mdelay0 handwired/symmetric70_proto/promicro/normal:default:flash`
     40 
     41 ## Measurement result
     42 ### Pro Micro (ATmega32u4 16Mhz)
     43 #### Default setting (show `matrix_scan()` time)
     44  - `make MTEST=matrix_debug_scan handwired/symmetric70_proto/promicro/normal:default:flash`
     45  - CH1: Row 0
     46  - CH2: Row 1
     47  - CH3: Row 4
     48  - CH4: matrix_scan()
     49  - Execution time of matrix_scan()  503us
     50  - Frequency of matrix scan 1.81kHz (551.0us)  
     51    ![DS1Z_QuickPrint2](https://user-images.githubusercontent.com/2170248/115994477-0ba64400-a612-11eb-98ba-b8cc362f26ac.png)
     52 
     53 #### Always call `matrix_output_unselect_delay()` (show `matrix_scan()` time, default MATRIX_IO_DELAY)
     54  - `make MTEST=matrix_debug_scan,always_delay handwired/symmetric70_proto/promicro/normal:default:flash`
     55  - CH1: Row 0
     56  - CH2: Row 1
     57  - CH3: Row 4
     58  - CH4: matrix_scan()
     59  - Execution time of matrix_scan()  521us
     60  - Frequency of matrix scan 1.76kHz (568.5us)  
     61    ![DS1Z_QuickPrint1](https://user-images.githubusercontent.com/2170248/115994488-1660d900-a612-11eb-83b1-cd820607db03.png)
     62 
     63 #### Adaptive delay (show `matrix_scan()` time, MATRIX_IO_DELAY = 0)
     64  - `make MTEST=matrix_debug_scan,mdelay0,adaptive_delay handwired/symmetric70_proto/promicro/normal:default:flash`
     65  - CH1: Row 0
     66  - CH2: Row 1
     67  - CH3: Row 4
     68  - CH4: matrix_scan()
     69  - Execution time of matrix_scan()  383us
     70  - Frequency of matrix scan 2.32kHz (431us)  
     71    ![DS1Z_QuickPrint3](https://user-images.githubusercontent.com/2170248/115994939-034f0880-a614-11eb-861f-b83a31efa51a.png)
     72 
     73 #### Adaptive delay (show delay time, MATRIX_IO_DELAY = 0)
     74  - `make MTEST=matrix_debug_delay,mdelay0,adaptive_delay handwired/symmetric70_proto/promicro/normal:default:flash`
     75 
     76 ##### Press R0C1, R1C1 key
     77  - CH1: Row 0
     78  - CH2: Row 1
     79  - CH3: Row 4
     80  - CH4: delay time
     81  - Delay time 68us
     82  - Frequency of matrix scan 1.77kHz (565us)  
     83    ![DS1Z_QuickPrint55](https://user-images.githubusercontent.com/2170248/119561268-ead33900-bddf-11eb-9cc4-7e04826486cf.png)
     84 
     85 #### Fast adaptive delay (show `matrix_scan()` time, MATRIX_IO_DELAY = 0)
     86  - `make MTEST=matrix_debug_scan,mdelay0,adaptive_delay_fast handwired/symmetric70_proto/promicro/normal:default:flash`
     87  - CH1: Row 0
     88  - CH2: Row 1
     89  - CH3: Row 4
     90  - CH4: matrix_scan()
     91  - Execution time of matrix_scan()  382us
     92  - Frequency of matrix scan 2.33kHz (428us)  
     93    ![DS1Z_QuickPrint56](https://user-images.githubusercontent.com/2170248/119561280-eeff5680-bddf-11eb-9576-e4cf64751955.png)
     94 
     95 #### Fast adaptive delay (show delay time, MATRIX_IO_DELAY = 0)
     96  - `make MTEST=matrix_debug_delay,mdelay0,adaptive_delay_fast handwired/symmetric70_proto/promicro/normal:default:flash`
     97 
     98 ##### Press R0C1, R1C1 key
     99  - CH1: Row 0
    100  - CH2: Row 1
    101  - CH3: Row 4
    102  - CH4: delay time
    103  - Delay time 11us
    104  - Frequency of matrix scan 2.21kHz (452us)  
    105    ![DS1Z_QuickPrint57](https://user-images.githubusercontent.com/2170248/119561318-faeb1880-bddf-11eb-8592-694f9ecb2248.png)
    106 
    107 ### Proton C (STM32F303 72MHz)
    108 #### Default setting (show `matrix_scan()` time)
    109  - `make MTEST=matrix_debug_scan handwired/symmetric70_proto/proton_c/normal:default:flash`
    110  - CH1: Row 0
    111  - CH2: Row 1
    112  - CH3: Row 4
    113  - CH4: matrix_scan()
    114  - Execution time of matrix_scan()  210us
    115  - Frequency of matrix scan 4.35kHz (230.0us)  
    116    ![DS1Z_QuickPrint16](https://user-images.githubusercontent.com/2170248/116131295-2ad2cd80-a707-11eb-8d0a-6f7912456e03.png)
    117 
    118 #### Always call `matrix_output_unselect_delay()` (show `matrix_scan()` time, default MATRIX_IO_DELAY)
    119  - `make MTEST=matrix_debug_scan,always_delay handwired/symmetric70_proto/proton_c/normal:default:flash`
    120  - CH1: Row 0
    121  - CH2: Row 1
    122  - CH3: Row 4
    123  - CH4: matrix_scan()
    124  - Execution time of matrix_scan()  242us
    125  - Frequency of matrix scan 3.85kHz (260.0us)  
    126    ![DS1Z_QuickPrint17](https://user-images.githubusercontent.com/2170248/116131308-31f9db80-a707-11eb-8db7-d1960fa7b068.png)
    127 
    128 #### Adaptive delay (show `matrix_scan()` time, MATRIX_IO_DELAY = 0)
    129  - `make MTEST=matrix_debug_scan,mdelay0,adaptive_delay handwired/symmetric70_proto/proton_c/normal:default:flash`
    130  - CH1: Row 0
    131  - CH2: Row 1
    132  - CH3: Row 4
    133  - CH4: matrix_scan()
    134  - Execution time of matrix_scan()  76.4us
    135  - Frequency of matrix scan 10.6kHz (94.4us)  
    136    ![DS1Z_QuickPrint18](https://user-images.githubusercontent.com/2170248/116131369-44741500-a707-11eb-9c74-fa39d9e80947.png)
    137 
    138 #### Adaptive delay (show delay time, MATRIX_IO_DELAY = 0)
    139  - `make MTEST=matrix_debug_delay,mdelay0,adaptive_delay handwired/symmetric70_proto/proton_c/normal:default:flash`
    140 
    141 ##### Press R0C1, R1C1 key
    142  - CH1: Row 0
    143  - CH2: Row 1
    144  - CH3: Row 4
    145  - CH4: delay time
    146  - Delay time 7.6us
    147  - Frequency of matrix scan 9.47kHz (105.6us)  
    148    ![DS1Z_QuickPrint58](https://user-images.githubusercontent.com/2170248/119666783-a3e15400-be70-11eb-9a58-220032117efd.png)
    149 
    150 ##### Connect a 500pF capacitor between C2 line and GND, Press R0C2, R1C2, R2C2, R3C2, R4C2 keys
    151  - CH1: Row 0
    152  - CH2: Row 1
    153  - CH3: Col 2
    154  - CH4: delay time
    155  - Delay time 12us + alpha
    156  - Frequency of matrix scan 5.45kHz (183us)
    157  - Threshold Voltage 1.9V  
    158    ![DS1Z_QuickPrint59](https://user-images.githubusercontent.com/2170248/119666946-cc694e00-be70-11eb-9b97-4c500416d774.png)
    159 
    160 ##### Connect a 1000pF capacitor between C2 line and GND, Press R0C2, R1C2, R2C2, R3C2, R4C2 keys
    161  - CH1: Row 0
    162  - CH2: Row 1
    163  - CH3: Col 2
    164  - CH4: delay time
    165  - Delay time 20us + alpha
    166  - Frequency of matrix scan 4.48kHz (223us)
    167  - Threshold Voltage 1.9V  
    168    ![DS1Z_QuickPrint60](https://user-images.githubusercontent.com/2170248/119667127-f3c01b00-be70-11eb-8e7f-6f0a81f95e97.png)
    169 
    170 #### Fast adaptive delay (show `matrix_scan()` time, MATRIX_IO_DELAY = 0)
    171  - `make MTEST=matrix_debug_scan,mdelay0,adaptive_delay_fast handwired/symmetric70_proto/proton_c/normal:default:flash`
    172  - CH1: Row 0
    173  - CH2: Row 1
    174  - CH3: Row 4
    175  - CH4: matrix_scan()
    176  - Execution time of matrix_scan()  75.6us
    177  - Frequency of matrix scan 10.8kHz (92.2us)  
    178    ![DS1Z_QuickPrint62](https://user-images.githubusercontent.com/2170248/119667218-0b979f00-be71-11eb-946c-16f0a0454056.png)
    179 
    180 #### Fast adaptive delay (show delay time, MATRIX_IO_DELAY = 0)
    181  - `make MTEST=matrix_debug_delay,mdelay0,adaptive_delay_fast handwired/symmetric70_proto/proton_c/normal:default:flash`
    182 
    183 ##### Press R0C1, R1C1 key
    184  - CH1: Row 0
    185  - CH2: Row 1
    186  - CH3: Row 4
    187  - CH4: delay time
    188  - Delay time 1.6us
    189  - Frequency of matrix scan 10.6kHz (94.4us)  
    190    ![DS1Z_QuickPrint63](https://user-images.githubusercontent.com/2170248/119667378-33870280-be71-11eb-95aa-64213138ddac.png)
    191    ![DS1Z_QuickPrint64](https://user-images.githubusercontent.com/2170248/119667504-52859480-be71-11eb-963e-eebc6e3da9dc.png)
    192 
    193 ##### Connect a 500pF capacitor between C2 line and GND, Press R0C2, R1C2, R2C2, R3C2, R4C2 keys
    194  - CH1: Row 0
    195  - CH2: Row 1
    196  - CH3: Col 2
    197  - CH4: delay time
    198  - Delay time 13.2us
    199  - Frequency of matrix scan 6.58kHz (152.6us)
    200  - Threshold Voltage 1.9V  
    201    ![DS1Z_QuickPrint65](https://user-images.githubusercontent.com/2170248/119667644-72b55380-be71-11eb-8030-854de1900408.png)
    202 
    203 ##### Connect a 1000pF capacitor between C2 line and GND, Press R0C2, R1C2, R2C2, R3C2, R4C2 keys
    204  - CH1: Row 0
    205  - CH2: Row 1
    206  - CH3: Col 2
    207  - CH4: delay time
    208  - Delay time 20us
    209  - Frequency of matrix scan 5.30kHz (188.8us)
    210  - Threshold Voltage 1.9V  
    211    ![DS1Z_QuickPrint66](https://user-images.githubusercontent.com/2170248/119667785-8f518b80-be71-11eb-8d40-fc3293aa072b.png)