Main Site Documentation

Possible to change the TE35 TouchScreen input pins on G120


#1

We would like to keep SPI3 so we changed the touchscreen pins like so:
-(same) AD1 (G120 pin50) (Gadgeteer socket pin 4)
-(same) AD0 (G120 pin52) (Gadgeteer socket pin 5)
-(different not pin P1.0) P0.6 (G120 pin17) (Gadgeteer socket pin 6)
-(different not pin P1.1) P0.4 (G120 pin30) (Gadgeteer socket pin 7)

On the software side, I then used the FEZCobraII gadgeteer mainboard, and changed the socket setup routine like so:


            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(4);
            socket.SupportedTypes = new char[] { 'A', 'I', 'T', 'X' };
            socket.CpuPins[3] = G120.Pin.P0_25;
            socket.CpuPins[4] = G120.Pin.P0_24;
            socket.CpuPins[5] = G120.Pin.P0_23;
            socket.CpuPins[6] = G120.Pin.P0_6;
            socket.CpuPins[7] = G120.Pin.P0_4;
            //socket.CpuPins[6] = G120HW.Pin.P1_0;
            //socket.CpuPins[7] = G120HW.Pin.P1_1;
            socket.CpuPins[8] = G120.Pin.P0_27;
            socket.CpuPins[9] = G120.Pin.P0_28;

I though I was golden, but then after some testing the touchscreen P1.0 and P1.1 stays the same …
I have debugged and I know it went over the code above with the new socket configuration.
Did I miss something ? Is there another place to change those touchscreen pins configuration ?
Thanks


#2

Yes, The display works fine, a TE35, all pins for the LCD are identical to FezCobraII board schematic.
The touchscreen pins however(4 are necessary) , 2 of them (digital inputs) uses P1.0 and P1.1, which is also used for SPI3.
We would like to use different digital pins, P0.6 and P0.4 for example, instead of P1.0 and P1.1.
Does that make sense ?


#3

Yes, we wanted to use all of them.

So far:
SPI1: Soundcard
SPI2: Ethernet ENC28J60
SPI3: Wifi RS21

I guess we will never use Wifi and Ethernet at the same time.
Would it work to put both wifi and ethernet on the same SPI2 bus?


#4

Ok I will test it out. Going to probably try to put wifi+ethernet and select which we want to use.

Also, how hard would it be to expose the touchscreen pins configuration instead of being hardcoded ?

On a related note about the touchscreen, but it would be probably best to start a new thread: I believe the touchscreen code to detect a touch event could be improved.
Sometimes, randomly, but can be seen easily by pressing multiple times on the screen per second, we get a touchevent not on the correct position.
The position is ALWAYS too much UP and LEFT.
The theory I have for this bug is that: you must have a loop somewhere that samples the analog pins multiple times per second.
But sometimes the sample is taken while a finger is being pressed (lets say halfway pressed).
I believe that an Improvement could be made: Detect that the analog is above the threshold that ‘something is pressed’, but don’t fire the touch event yet! wait for a sample or 2 that the curve is ‘stable’ enough that the touch is fully pressed and only then fire the event at the correct position.
I already verified with an oscilloscope, and the touchscreen analog output seems to be not the problem (it seems sensitive enough).


#5

Well yea if possible I would like to use the premium libraries like it is, and not mess with it if possible.
Could this be a feature for a next 4.2 SDK release ?


#6

I think that this only changes the assignment of the digital io pins. The analog pins will be defined elsewhere?


#7

The two analog pins are pin 4 and 5 on a gadgeteer connector, and they are analog AD1 and AD0 respectively.
The two digital pins are pin 6 and 7 on the gadgeteer connector, and they are norammly P1.0 and P1.1

The problem I have is I would like to use digital pins P0.6 and P0.4 instead of P1.0 and P1.1, the two analog pins are fine.

I changed them on the Socket listing of the FezCobraII board that I recompiled, but it doesnt seem to do anything.
It still uses P1.0 and P1.1 instead of P0.6 and P0.4 for the touchscreen.


#8

touch pins are currently fixed


#9

Thanks if this could be changed in the future it would be great.
Meanwhile we’re modifying our design to use SPI2 for both wifi and ethernet.