Driver debugging FAQ _ keypad

Source: Internet
Author: User

Author: Liu Xuhui Raymond reprinted. Please indicate the source

Email:Colorant@163.com

Blog:Http://blog.csdn.net/colorant/

Home page:Http://sites.google.com/site/rgbbones/

 

The keypad here is not a portable keyboard on a PC, but a non-portable keyboard that is common in embedded devices. Common keypad connection methods include matrix scanning and direct gpio detection. In terms of detection methods, you can use gpio scanning to perform detection. Some CPUs integrate the scanning circuit logic to perform automatic detection. Some key-value values of certain key-bits have fixed errors.
  • Symptom

In most cases, the read value of some key bits is a constant error value. For example, the value should be 0x20 in theory, and the read value should be 0 or 0x420, sometimes the correct key value can be read at the moment of release. Different boards are basically the same keys. Some keys will never cause read errors.

 
  • Analysis

I started to think it was a technical problem with the keyboard. Poor contact led to crosstalk between some intersections. But I found that all the problematic buttons were on the same scan line, in addition, the keys of all the rows to be scanned are incorrect. As a result, the keys in the same column of the next row are superimposed. The analysis shows that during keyboard drive scanning, the scanning level between adjacent rows changes too fast. due to factors such as capacitance in the hardware, the scanning level is not stable when reading the key value, the key value is incorrectly read. The main contradiction is that the chip selection and clock signal of the SPI port of the CPU used cannot be independently controlled from the data cable.
  • Solution
In terms of hardware, it is necessary to minimize the additional capacitance on the scanning line. In terms of software, it can increase the delay time between changing the line scan voltage and reading registers, waiting for the completion of the charging and discharging process. Only one key is pressed, but multiple key values are read.
  • Symptom
After a key is pressed, multiple key values can be detected simultaneously.
  • Analysis
This problem is actually another manifestation of the previous problem. Due to the interference in the charging and discharging process, the array scanning process may be misjudged.
  • Solution
Same as above. Some key-value drivers have been detected, but Upper-layer applications cannot read them.
  • Symptom
After pressing some keys, you can see that the key value has been detected in the driver, but the upper-layer application did not read the corresponding value from the device node.
  • Analysis
This problem is usually caused by incorrect settings of the input_dev-> keybit mask of the keyboard event in the input subsystem. If the mask of the corresponding key value is not set, the input subsystem discards the corresponding event, the application is not distributed to the upper layer.
  • Solution
Correctly set the mask bit for each button

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.