I just posted Plain NETMF touchscreen driver for FT5x06 based displays (like NHD5.0) on Codeshare. Feel free to discuss and make suggestions here.
Holy **** it almost works!
When I say almost, what I mean is that the interrupt is being detected but the touch values being returned are not making sense and detecting more than 1 finger and I suspected this is because I had the LCD hard up against the metal panel.
When I removed the panel from the frame, it was the same so not sure what is happening here. I get the following on the debug output if I hold my finger on the panel. In this case it was in the middle. It’s the same for any position.
Finger 1 up!
Finger 4 down!
Finger 2 up!
Finger 4 up!
Finger 1 down!
Finger 2 down!
Finger 3 down!
Finger 0 up!
Finger 1 up!
Finger 2 up!
Finger 3 up!
Finger 0 down!
Finger 1 down!
Finger 2 down!
Finger 0 up!
Finger 2 up!
Finger 2 down!
Finger 3 down!
Finger 0 down!
Finger 2 up!
Finger 0 up!
Finger 1 up!
Finger 2 down!
Finger 3 up!
Finger 0 down!
Finger 1 down!
Finger 3 down!
Finger 1 up!
Finger 3 up!
Finger 0 up!
Finger 0 down!
Finger 1 down!
Zoom out
Finger 1 up!
Finger 0 up!
Finger 2 up!
Finger 0 down!
Finger 1 down!
Finger 2 down!
Finger 1 up!
Finger 2 up!
Finger 1 down!
Finger 2 down!
Finger 3 down!
Finger 4 down!
Finger 3 up!
Finger 4 up!
Finger 1 up!
Finger 2 up!
Finger 1 down!
Finger 2 down!
Finger 1 up!
Finger 2 up!
Finger 1 down!
Finger 2 down!
Finger 1 up!
Finger 2 up!
Finger 0 up!
Finger 0 down!
Finger 1 down!
Finger 3 down!
Finger 0 up!
Finger 2 down!
Finger 3 up!
Zoom in
Finger 1 up!
Finger 2 up!
Interestingly when I display the X and Y values, the Y is very good and matches with where I am touching anywhere on the display. The X on the other hand is way out. It seems to be random positions.
Not started delving fully into the code yet but the _currentX values are all different. Eg, a touch in the middle of the display yields these values for x
223
375
518
689
799
and Y has the following
254
254
255
252
252
I get the same readings with the LCD install in the panel or not.
This was a basic test but it’s encouraging for sure but need to find out why X is way out and why it detects multiple touch when only 1 finger is in contact with the display.
Let me clear it up, you put ONE finger on the screen and you get the following output?
This is very strange. I can’t reproduce anything like that on my side. For me, everything works as expected:
Finger 0 down! 7:4
Finger 1 down! 332:237
Finger 2 down! 725:468
Finger 3 down! 99:379
Finger 1 up! 332:237
Finger 2 up! 725:468
Finger 3 up! 99:379
Finger 0 up! 7:4
And all the coordinates are correct, too…
Yip. One finger on the screen and it outputs continuously to the debug output. It stops when I lift the finger.
There is no interrupts until I touch the screen.
It’s strange that the Y is correct for all touch points it detects but X is all over the place. It’s as if the system is detecting more than 1 X positional touch.
could you find the line
int numberOfFingers = _registerValues[0x02][0];
And print to Debug output the numberOfFingers?
Also, exchange
for (int i = 0; i < 5; i++) {
ids[i] = _registerValues[0x05 + i * 6][0] >> 4;
}
to
for (int i = 0; i < 5; i++) {
ids[i] = _registerValues[0x05 + i * 6][0] >> 4;
Debug.Print(i +":"+ ids[i]);
}
and post the output here?
Here ya go
The first one is when it first starts up the code. From fingers = 3 is when I am touching the screen and don’t life my finger. There was where more than this though, I only copied some of.
Fingers = 0
0:2
1:15
2:15
3:15
4:15
Fingers = 3
0:0
1:1
2:2
3:15
4:15
Finger 0 down!
Where 381,246
Finger 1 down!
Where 287,246
Finger 2 down!
Where 207,246
Fingers = 3
0:0
1:2
2:3
3:15
4:15
Finger 1 up!
Finger 3 down!
Where 4095,4095
Fingers = 1
0:0
1:2
2:3
3:1
4:4
Finger 2 up!
Finger 3 up!
Fingers = 5
0:0
1:2
2:1
3:3
4:4
Finger 1 down!
Where 600,248
Finger 2 down!
Where 155,248
Finger 3 down!
Where 508,248
Finger 4 down!
Where 61,248
Fingers = 3
0:0
1:3
2:4
3:1
4:2
Finger 1 up!
Finger 2 up!
Fingers = 5
0:0
1:3
2:4
3:1
4:2
Finger 1 down!
Where 110,247
Finger 2 down!
Where 0,247
Fingers = 5
0:0
1:1
2:3
3:4
4:2
Fingers = 5
0:0
1:1
2:3
3:4
4:2
Fingers = 3
0:0
1:1
2:3
3:2
4:15
Finger 2 up!
Finger 4 up!
Fingers = 1
0:0
1:1
2:2
3:3
4:15
Finger 1 up!
Finger 3 up!
Fingers = 4
0:0
1:1
2:3
3:4
4:2
Finger 1 down!
Where 486,248
Finger 3 down!
Where 290,248
Finger 4 down!
Where 734,248
Looks like the whole thing is screwed since the very beginning. Register 0x02 (number of touches) value appears to be randomly changing, and it looks like registers 0x03, 0x09, 0x0F and others containing important Touch Event Flag are randomized, too. But until it returns correct number of touches, there’s no point in diving deeper.
Perhaps you could:
[ul]
Poll the register 0x02 manually and see if it still shows nonsences;
Check if the display is the only device using I2C bus;
Check if your display really has a FT5306 chip (a desperate check that’ll be…)?[/ul]
This could be a faulty display panel.
I connected up the second display I have and it is working fine even after mounting in the front panel frame and in direct contact with the metal of the frame.
I may run some code to download all the settings for this working panel and compare them with the one that does not work.
No idea what was wrong before, but I got the faulty display working. I didn’t actually do anything, I just plugged it in again and it worked!
Now all I have to do is figure out how to hook the touch into the system. I am using CLIX2 for this project and all future ones.
I have also added a function that allows you to read the registers as I used this to confirm the 2 panels where similar. There are a few differences though which I assume is something that is done at the factory for calibration.
EDITED: Spoke too soon. After I re-ran the application the touch is all over the place again. When I read the settings they still look ok. Need to dig into this a bit more.
Glad you sorted it out
Next week I’ll receive the brighter version of this display. Hopefully it has the same touch controller…
Quick question for you Simon.
What did you do with the wake pin on the CTP connection?
I left it unconnected. The only reference in the docs was to connect to ground for flashing but nothing on what to do with it if not used.
Well, the datasheet states:
So I connected it to +3.3V to enable interrupts from the controller.
It seems to have a small pullup as I read 2V but I put in a pullup anyway. Same issue with this 1 panel so I am suspecting there is a fault with it as the other one works perfectly every time.
I have emailed Newhaven to find out if they have any idea.
I’ll be ordering 2 more of them this week for the clock now that the basics work along with 2 of the high brightness to test on another project.
Really appreciate your time and the code you created. I’ll feedback anything I find along the way and any changes I find. I am looking at some of the other gestures!
Improvement are of course welcomed. However, ZoomIn and ZoomOut are implemented by the chip. For anything else, you’ll have to code it yourself…
In the document I have, there is also Move Up, Move Down, Move Left and Move right, which I had assumed was swiping gestures.
Huh?.. You obviously have some different document than I do Can you you show me it?
It’s on the Newhaven website.
Oh, I see now.
However, there’s no way I could trigger those additional gestures…
I have just received that brighter LCD from Newhaven. It’s freaking awesome!!! Even though I can only drive it at 40mA, yet still much brighter, and view angles are so much better!.. Pretty much perfect.
That’s good to know. I’ll be order some soon. Looks like I can get 40mA out of the driver I already have. This is good as it avoid a rework of the PCB.