ATMEL mxt224 capacitive touch screen debugging notes

Source: Internet
Author: User

After reading datasheet for four days, I finally started to write code yesterday. So far, the capacitive screens I have done include ITE, Solomon, focaltech, EETI, and cypress. To be honest, the driver for writing these things is already familiar, but today I still feel it! ATMEL's capacitive screen is the best. The interface for drivers is perfect, and even the object-oriented idea is used! The Atmel driver is really a pleasure. Now you can experience the pleasure of being a driver engineer!

The reason for taking over this job is that our company has been assigned to another fake mobile phone company... It is said to be a merger. In fact, it cannot be a rape. Because the boss of the mobile phone company has the say. Some of the promises and benefits that the company once gave us have all taken over from this shanzhai company... From then on, the people in our original class were like women who fell into the qinglou building one by one .... Whoever wants to get on ....

Just go up and above... Who makes us suffer... But you won't even have a climax !, The whole person is on you, and it makes you suffer...

I was an icdesign company, but now I want to take over the mess of a mobile phone solution. We will go public in two months, saying that we will not be able to solve some problems.

Last week, I gave us information to make a capacitive screen.

When I get my cell phone, I can't help it! The whole screen-tip of the capacitive screen is offset, and the coordinates are not accurate to the LCD. When two fingers touch, the touch coordinates of one of the points cannot be released. This obvious bug is not solved! Look at the svn log. It seems that this driver was started four or five months ago. To this extent .... They also use SVN .. Use SVN to manage Android code! This is enough to show how many of these people are lazy. In order not to learn about git, they used SVN to manage such projects ....

I read the code and described it in four words, which is unsightly! What a bad word! As you can imagine, if a group of such people leave the support of Fae, the words will be "dead "!!!! Obviously, this mess is handed over to us because marvel does not have enough support for them... (They are a marvel solution)

I gave up fixing the garbage-like driver...

It seems that you still need to write the driver ..

Wait for your brother to finish writing this note next week! Brother will solve the problem within two weeks... The pressure is still quite high... Now, this driver is the worship of ATMEL! If brother's company is transformed into a shanzhai mobile phone company step by step, he should consider the way out as soon as possible... Nnd

It turns out that the touch screen should be calibrated every time it is turned on... It's really bullshit !!!! This is what the boss said... The boss was fooled by his "two knives" engineer .... So cruel ..


I plan to use the interrupt + polling method to read the reported point information, so I need to read the status of the interrupt pin. The gpio_get_value function is used. It is found that the read value from beginning to end is 0, which is depressing. I had to use the oscilloscope to measure the actual level. I found everything was right. The level was high or low. How can I read it? After a long time, I finally found that the returned value of gpio_get_value is an integer int, But I assigned this return value to a u8 value. Naturally, the return value is truncated, so I always get 0, this is my negligence.

However, this function is platform-related, and some return values are not 0 or 1, so that even if I use u8 to store the return value, there will be no problems, however, on some platforms, the return value of this function may be the value of gpio-related registers, which is a 32-bit value. It filters out other irrelevant bits with a mask, only one bit indicating value is left, so we can see that one of the 32 bits may be 1 and the other is 0. If gpio_get_value returns such a 32-bit int value, then we only need to make a judgment based on the value of 0 or not. If I assign this value to a type smaller than 32 like this, it will be suspended in any case. Haha. No ..

Atmel firmware is really nice! The driver provides an object-oriented interface. In this way, the driver programming becomes more convenient, and the portability of the driver is greatly improved!

In addition, Atmel provides an 8-byte user data. In this way, the driver can write some signs in it, thus improving the adaptive capability of the driver. It depends on whether the driver designer can think of how to use it and how to use it!

When you adjust the touch screen, it is best to enable the device to automatically run the relevant touch screen test applications when it is turned on. This will greatly facilitate debugging, because you cannot guarantee that your driver can be used up. The following information can help us do not lock the screen on Android.

In Android 2.3, how does one disable Android boot lock screen:

Frameworks/base/policy/src/COM/Android/Internal/policy/impl/keyguardviewmediator. Java

Line: 192

External apps (like the phone app) can tell us to disable the keyguard.

Private Boolean mexternallyenabled = true // set this parameter to false.

How to set the default automatic lock time

Base/packages/settingsprovider/RES/values/defaults. xml


The default time of def_screen_off_timeout is 60000 milliseconds, that is, one minute. Change it to what you want. Be sure not to cross-border.

About Multi-Point reporting

Multi-Point reporting by kernel is performed by group.


Protocol Example A------------------Here is what a minimal event sequence for a two-contact touch would looklike for a type A device:   ABS_MT_POSITION_X x[0]   ABS_MT_POSITION_Y y[0]   SYN_MT_REPORT   ABS_MT_POSITION_X x[1]   ABS_MT_POSITION_Y y[1]   SYN_MT_REPORT   SYN_REPORTThe sequence after moving one of the contacts looks exactly the same; theraw data for all present contacts are sent between every synchronizationwith SYN_REPORT.Here is the sequence after lifting the first contact:   ABS_MT_POSITION_X x[1]   ABS_MT_POSITION_Y y[1]   SYN_MT_REPORT   SYN_REPORTAnd here is the sequence after lifting the second contact:   SYN_MT_REPORT   SYN_REPORTIf the driver reports one of BTN_TOUCH or ABS_PRESSURE in addition to theABS_MT events, the last SYN_MT_REPORT event may be omitted. Otherwise, thelast SYN_REPORT will be dropped by the input core, resulting in nozero-contact event reaching userland.

Therefore, if the touch screen hardware generates data according to a group, that is, each package contains all the points detected this time, you can easily use the Sync method mentioned above. That is, a syn_mt_report is appended to each vertex in the package. After all the vertex reports in the package are completed, the driver appends a syn_report to indicate that the current report is over.

However, the firmware of ATMEL does not group vertices as we expect. Instead, messages are sent sequentially. Therefore, to achieve multi-point reporting requirements of the kernel, the logic policy must be used to implement it... This is a little inconvenient.

However, I have already figured out the method .. After verification, write it ..

It is found that when two vertices are reported through the real-to-multiple-point reporting method mentioned above, if one of the vertices is released, this point will still be displayed on the screen. And disappears only after the next report is completed. The solution is to release the event report at one of the points and then report all the events once. In this way, N points are reported last time, and n-1 points are reported this time.


It is a tragedy. When mass production was just around the corner, they did not know why, but changed the drive of the capacitive screen. After the change, the multi-touch screen became invalid, leaving a single point of failure. However, such a thing is also submitted to the server. I am more and more skeptical about this shanzhai company. The driver I wrote was completed a week ago. Considering that they were about to produce the driver, I didn't submit my code, after replacing a driver, a detailed long-cycle test is required to determine whether a driver has potential problems. But I didn't even think that they had changed the driver in the last ten days, and it seems that they were released to the central server without any tests. This may be a fan ..... But it's okay with brother ..

Fortunately, I solved the problem of multi-point failure caused by the new driver yesterday. To be honest, the bug is very low ......

I personally think that a good driver engineer will spend a week studying datasheet, and then spend another week writing code. I did. But very tired. For such a company. Really not worth it.

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: 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.