Resistive touch twr-lcd using k70

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Resistive touch twr-lcd using k70

1,359 Views
ankurchauhan
Contributor I

Hi,

I'm using k70 Tower kit with resistive touch twr-lcd module.

I'm using bare metal project.

Can anyone share some sample code for resistive touch twr-lcd(for k70).

Regards

Ankur

Labels (1)
0 Kudos
Reply
6 Replies

965 Views
nikhilullal
Contributor I

Dear Luis,

          Can you please explain what hardware rework is required for the TWR-LCD?


With Regards,

Nikhil Ullal

0 Kudos
Reply

965 Views
ankurchauhan
Contributor I

I need to read the data from the screen whenever its get touch..

0 Kudos
Reply

965 Views
LuisCasado
NXP Employee
NXP Employee

Hello,

You can also check the eGUI code. It includes drivers for resistive touch screen and ADC.

https://github.com/Gargy007/eGUI/tree/master/D4D/low_level_drivers/touch_screen

This is the configyration for TWR-K70 using the TWR-LCD touch screen. Notice, you need hardware rework to connect resistive touch in TWR-LCD to TWR-K70.

  #define D4DTCH_ADC_HW D4DTCH_ADC_HW_KINETIS

 

  #define D4DTCH_ADC_ID 1 // Use ADC module 1

 

#define D4DTCH_MCU_USER_INIT {D4DTCH_X_PLUS_PCR = PORT_PCR_MUX(1) | PORT_PCR_DSE_MASK;\

                              D4DTCH_X_MINUS_PCR = PORT_PCR_MUX(1) | PORT_PCR_DSE_MASK;\

                              D4DTCH_Y_PLUS_PCR = PORT_PCR_MUX(1) | PORT_PCR_DSE_MASK;\

                              D4DTCH_Y_MINUS_PCR = PORT_PCR_MUX(1) | PORT_PCR_DSE_MASK;\

}

  // X+ wire definition 

  #define D4DTCH_X_PLUS   17

  #define D4DTCH_X_PLUS_PORT  GPIOA_PDOR  // Data output register

  #define D4DTCH_X_PLUS_DDR   GPIOA_PDDR  // Output enable register

  #define D4DTCH_X_PLUS_ADCH  17          // ADC channel number

  #define D4DTCH_X_PLUS_PCR   PORTA_PCR17

 

  // X- wire definition

  #define D4DTCH_X_MINUS  10       

  #define D4DTCH_X_MINUS_PORT  GPIOB_PDOR 

  #define D4DTCH_X_MINUS_DDR   GPIOB_PDDR

  #define D4DTCH_X_MINUS_PCR   PORTB_PCR10

 

  

  // Y+ wire definition

  #define D4DTCH_Y_PLUS   6     

  #define D4DTCH_Y_PLUS_PORT  GPIOB_PDOR 

  #define D4DTCH_Y_PLUS_DDR   GPIOB_PDDR

  #define D4DTCH_Y_PLUS_ADCH   12

  #define D4DTCH_Y_PLUS_PCR   PORTB_PCR6

  //#define D4DTCH_INIT_Y_PLUS  OUTPUT(D4DTCH_Y_PLUS); RESET(D4DTCH_Y_PLUS);

  //#define D4DTCH_RESET_Y_PLUS RESET(D4DTCH_Y_PLUS);

  //#define D4DTCH_SET_Y_PLUS   SET(D4DTCH_Y_PLUS);

 

  // Y- wire definition

  #define D4DTCH_Y_MINUS  5 

  #define D4DTCH_Y_MINUS_PORT  GPIOB_PDOR 

  #define D4DTCH_Y_MINUS_DDR   GPIOB_PDDR

  #define D4DTCH_Y_MINUS_PCR   PORTB_PCR5

  //#define D4DTCH_CALIB_CROSS_OFFSET 30

  // Constant specifying maximum ADC value for a screen touch (=12bits)

  #define D4DTCH_FULL_SCALE           0x0FFF

  // Constants specifying minimum ADC value for a screen touch

  #define D4DTCH_X_TOUCH_MIN              (D4DTCH_FULL_SCALE / 10)

  #define D4DTCH_Y_TOUCH_MIN              (D4DTCH_FULL_SCALE / 10)

  #define D4DTCH_X_TOUCH_OFFMAX              (D4DTCH_X_TOUCH_MIN * 3)

  #define D4DTCH_Y_TOUCH_OFFMAX              (D4DTCH_Y_TOUCH_MIN * 3)

  // Constants specifying ADC difference for touch screen sample

  //#define D4DTCH_SAMPLE_MARGIN            (D4DTCH_FULL_SCALE / 256)

0 Kudos
Reply

965 Views
ankurchauhan
Contributor I

Hi Luis,

Thanks for reply.

This D4D project is expecting "mqx.h" file.

But I'm not using MQX ,my project is bare board project(using codewarrior 10.6.4).

Should I download MQX and integrate it  with CW or without MQX it's possible to configure and  use "touch twr-lcd"??

if I have need MQX then which version of it??

Regards

Ankur

0 Kudos
Reply

965 Views
LuisCasado
NXP Employee
NXP Employee

Hi Ankur,

eGUI (D4D) can work also in bare metal. Notice that TWR-K70 is used together with TWR-LCD-RGB. In this case, touch is controlled by CRTOUCH device populated in the TWR-LCD-RGB. So, all the examples you will find are based on TWR-K70 + TWR-LCD-RGB (using LCDC K70 module and CRTOUCH). http://www.freescale.com/products/sensors/touch-sensors/freescale-touch-sensing-platform-a-ready-pla...

But the configuration I gave you is coming from old demo using TWR-K70 + TWR-LCD where LCD was controlled by K70 Flexbus and touch using K70 ADC channels. But hardware rework was required because the TWR-K70 ADC channels connected to TWR-LCD doesn't have GPIO capability, as you know, that is needed for implementing a touch sensing with ADC/GPIO.

Luis

0 Kudos
Reply

965 Views
mjbcswitzerland
Specialist V

Hi

See http://www.utasker.com/docs/uTasker/uTaskerTouch.PDF

Code for K70 and TWR-LCD is included in the uTasker project at http://www.utasker.com/forum/index.php?topic=1721.0

Search for SUPPORT_TOUCH_SCREEN in the code and the settings for K70F150M_12M.

Initialisation is fnStartTouch() in glcd_tft.h and the interrupt is handled in fnTouchInterrupt().

The touch operation is also simulated in the uTasker Kinetis simulator - as show in screen shot below:

pastedImage_0.png

Video of the operation: https://www.youtube.com/watch?v=PvsFFRigwFU (same operation on TWR-K70)

Regards

Mark

Kinetis: http://www.utasker.com/kinetis.html

K70: http://www.utasker.com/kinetis/TWR-K70F120M.html / http://www.utasker.com/kinetis/EMCRAFT_K70F120M.html

For the complete "out-of-the-box" Kinetis experience and faster time to market

0 Kudos
Reply