G120 4 wire touch inputs

Hi guys,
I just wanted to get some more information on the four analog inputs for a 4 wire touch panel with the G120. I have all the pinouts etc from the G120 manual but how is it accessed? Is it only certain panels? Does it have to be turned on? How is the size defined? I just cant seem to find any information on it other than it was going to be added to the firmware a couple of years ago and apparently it has.

Any information would be greatly appreciated.

@ jezzab - https://www.ghielectronics.com/docs/162/touch goes over using Touch. As long as you set your display configuration properly and have everything connected correctly, it should work just fine.

Thanks for the reply. Im still a little bit confused. Let say I was using a TSC2046 SPI touch controller. I decide to use the 4 ADC inputs the touch is used for on the G120 for another purpose. My TSC2046 driver calls touch events.

What happens? Will the two conflict and the ADC will trigger touch events?


If you use a touch controller then you should not use the built in touch libraries. You will simply use SPI. You will then feed your touch events into the system. See our glide library for further details please.

As long as you don’t call the touch initialise function your SPI controller with work fine.

I developed a system using the old ChipworkX module and the AD7846 (same as the TSC2046) and just fed the touch into Glide. The advantage you have with the SPI controller is that it is interrupt driven and not polled as per the processor ADC version so you get better response. At least it did on my design.

Microsoft.SPOT.Touch.TouchInput[] touches = new Microsoft.SPOT.Touch.TouchInput[1];

// Touch down
touches[0].X = x;
touches[0].Y = y;
GlideTouch.RaiseTouchDownEvent(null, new TouchEventArgs(touches));


Thanks for the response guys. Ive put the SPI controller on hold for the moment to do some quick testing. I have wired the YU YD XR XL to the pins listed in the manual. I have run the example as provided in this link but its stuck repeating a touch move event and the “circle” is roughly in the middle.

I know the wiring is good (its four wires, id hope i wouldn’t screw it up :stuck_out_tongue: ), I know the touch panel is good (tested it with a quick touch demo on another LPC1788 board I have).
I have been using another analog input which has been working great.

So, do any pull downs need to be applied to the analog pins? Or just wire the panel straight to it as it is now?
I would have though if i applied a ground to one of the pins the “circle” would change direction somewhat, even if there was filtering.

I think i’ve been staring at it too long. Ive written a driver to pull touch positions from a radio over CAN bus and then convert to touch events and works brilliantly but I cant get a bloody 4 wire panel to work that was built for this application. sigh Must be beer o’clock (Aussie time)


Hi Jeremy,

Can you show the code?

Sorry Dave, right now I just have the 4 wires wired to the G120 Analog ins for the touch panel and just running the GHI example:

The SPI stuff ive just left for the moment as I was having a problem with the chip possibly (its a first version board) but I did actually base it on the MS code and YOUR code snippets I found, so I owe you a beer for that one :slight_smile: So figured go basic, go simple, get it working and switch back to SPI testing.

Just the native inputs are reading out. Its showing its holding touch all the time and the point doesn’t move (points in debug show 320,220 ±5 all the time untouched or touched). So its like the ADCs are reading false data. That’s why i wondered if they needed a pull up/down or something :confused: I actually thought the panel was damaged until I plugged it into another board and the touch worked.

I would have thought though if I put GND onto one of the pins the XY location would atleast change a bit but no

One thing I am curious about is the wiring for the 4 wire resistive touch. In the manual it says to be wired as follows:

Analog Inputs:
YU - Pin 50 on G120 - LPC1788 P0.24 (AD1)
XL - Pin 52 on G120 - LPC1788 P0.23 (AD0)

Assume these are pulled high GPIO for 3V3 feed on X and Y axis:
YD - Pin 42 on G120 -LPC1788 P1.0 (ENET_TXD0/T3_CAP1/SSP2_CLK)
XR - Pin 41 on G120 - LPC1788 P1.1 (ENET_TXD1/T3_MAT3/SSP2_MOSI)

I decided to wire it up to the FEZ Cobra II and test 2 touch different touch panels (7" and 3.2"). No good. Doesnt read any touch position at all. Im just about ready to give up ;( Might have to go back to the TSC2046 path again…

analog input needs unadjusted voltages, so pulling the signal high or low will cause problems. leave pullup/down off and test again

All the tests I have done have been without any pullup or down. Just raw signal from the 4 wire panel

bugger !

I was basing the comment on your “pulled high GPIO for 3V3” comment.

I have a G120 (cobra2) here somewhere and I might be able to hijack touch panel connections of my Cobra1 screen if I’m lucky, some time over the weekend but no promises I can do anything meaningful.

Any info would be appreciated mate. Ive been reading about how they work etc and based on the LPC1788 data sheet and the way that the G120 manual says to wire it I assumed there was 3V3 on two of the wires (XD and YR) as the pins on the CPU cannot be used as analog inputs, and the analog inputs on the other sides (YU and YL) and then use the two axis as a voltage divider (I built a little DMM app (ohms and mV reading from the analog input) with the G120 when i was doing the G8 shifter stuff so kinda understand all that now). No expert and still learning, just getting weird results.

I also tried slapping up a program that reads the two ADC inputs and show the data but its really weird. Its like the two are linked (apply some voltage to one and it effects the other one). I have one more panel to come next week (the actual one I will be using). Ill try the 4 wire way and if I cant get that to work I will go back to my Plan A and use the TSC2046 controller and SPI. I just didnt realise at the time when I designed the board that you could just use the 4 wire panel straight to the board but the TSC2046 having the PEN_EN though on the TSC2046 is very nice though as Dave said.


The TE35 schematic shows pull down on 2 of the lines.

Your right! Just checked the T43 and they have 10K resistors on the analog lines too… hmm time to test again. Thanks mate :slight_smile:

1 Like


Must have the two 10K resistors in there.

Thanks for eveyones help. Obviously trap for new players :confused:

1 Like

I guess “wired up correctly” means putting in the two 10K resistors (pull down) not mentioned in the manual…

1 Like

There is no need for them with the TSC2046 though as that has them internal to the device. I’ve never needed them.

1 Like