AnsweredAssumed Answered

LCD touch-screen on MK53DN512CMD10 set d4dtchhw_kinetis_adc_cfg and d4dlcdhw_gpio8080_8b_cfg

Question asked by Alberto Peña on Sep 1, 2015
Latest reply on Sep 14, 2015 by Alberto Peña

Hello,

 

I have tried to use a touch screen with a microcontroller MK53DN512CMD10, i'm trying to configure the hardware. It's connected as shown on the table.

 

TOUCH-SCREENMICROCONTROLLER PIN NAME

CS

PTC9
RSTPTC10
D/CPTC11
WRPTC12
RDPTC13
DB0PTC0
DB1PTC1
DB2PTC2
DB3PTC3
DB4PTC4
DB5PTC5
DB6PTC6
DB7PTC7
Y+

ADC1_DM1/

OP1_DM0

Y-

PGA1_DP/

ADC1_DP0/

ADC0_DP3

X+

PGA1_DM/

ADC1_DM0/

ADC0_DM3

X-

ADC1_SE16/

OP1_OUT/

CMP2_IN2/

ADC0_SE22/

OP0_DP2/

OP1_DP2

LED-A

DAC0_OUT/

CMP1_IN3/

ADC0_SE23/

OP0_DP4/

OP1_DP4

 

And i maded this configuration so far:

 

#define D4DLCD_CS          9     
  #define D4DLCD_DC          11    

   

 

  #define D4DLCD_WR          12   // WRITECLOCK  
  //#define D4DLCD_WR_PORT     PTED  // WRITECLOCK  
  //#define D4DLCD_WR_DDR      PTEDD // WRITECLOCK

 

  #define D4DLCD_RD          13    // READCLOCK
  //#define D4DLCD_RD_PORT     PTED  // READCLOCK
  //#define D4DLCD_RD_DDR      PTEDD // READCLOCK

 

#define D4DLCD_RESET         10

 

  /*********** Power macros - for modification uncoment and modify ***********/

 

  // Define void macros, because TWR-K60 board doesn't use RESET pin

  #define D4DLCD_INIT_RESET SIM_SCGC5 |= SIM_SCGC5_PORTC_MASK;\
                            CONFIG_PIN_FUNCTION(C,10,1);\
                            OUTPUT(C,10)

  #define D4DLCD_ASSERT_RESET WRITE_PIN(C,10,0);

  #define D4DLCD_DEASSERT_RESET WRITE_PIN(C,10,1);

 

  // Define void macros, because

  #define D4DLCD_INIT_CS    SIM_SCGC5 |= SIM_SCGC5_PORTC_MASK;\
                            CONFIG_PIN_FUNCTION(C,9,1);\
                            OUTPUT(C,9)

  #define D4DLCD_ASSERT_CS WRITE_PIN(C,9,0);

  #define D4DLCD_DEASSERT_CS WRITE_PIN(A,9,1);

 

  // Define void macros, because

  #define D4DLCD_INIT_DC    SIM_SCGC5 |= SIM_SCGC5_PORTC_MASK;\
                            CONFIG_PIN_FUNCTION(C,11,1);\
                            OUTPUT(C,11)

  #define D4DLCD_ASSERT_DC WRITE_PIN(C,11,0);

  #define D4DLCD_DEASSERT_DC WRITE_PIN(C,11,1);

 

  // Define void macros, because

  #define D4DLCD_INIT_RD    SIM_SCGC5 |= SIM_SCGC5_PORTC_MASK;\
                            CONFIG_PIN_FUNCTION(C,13,1);\
                            OUTPUT(C,13)

  #define D4DLCD_ASSERT_RD WRITE_PIN(C,13,0);

  #define D4DLCD_DEASSERT_RD WRITE_PIN(C,13,1);

 

  // Define void macros, because

  #define D4DLCD_INIT_WR     SIM_SCGC5 |= SIM_SCGC5_PORTC_MASK;\
                             CONFIG_PIN_FUNCTION(C,12,1);\
                             OUTPUT(C,12)

  #define D4DLCD_ASSERT_WR WRITE_PIN(C,12,0);

  #define D4DLCD_DEASSERT_WR WRITE_PIN(C,12,1);

  #define D4DLCD_INIT_DATA  SIM_SCGC5 |= SIM_SCGC5_PORTC_MASK;\
                            CONFIG_PIN_FUNCTION(C,0,1);\
                            OUTPUT(C,0);\
                            CONFIG_PIN_FUNCTION(C,1,1);\
                            OUTPUT(C,1);\
                            CONFIG_PIN_FUNCTION(C,2,1);\
                            OUTPUT(C,2);\
                            CONFIG_PIN_FUNCTION(C,3,1);\
                            OUTPUT(C,3);\
                            CONFIG_PIN_FUNCTION(C,4,1);\
                            OUTPUT(C,4);\
                            CONFIG_PIN_FUNCTION(C,5,1);\
                            OUTPUT(C,5);\
                            CONFIG_PIN_FUNCTION(C,6,1);\
                            OUTPUT(C,6);\
                            CONFIG_PIN_FUNCTION(C,7,1);\
                            OUTPUT(C,7);\
                            OUTPUT_ALL(C)

 

 

#endif /* __D4DLCDHW_GPIO8080_8B_CFG_H */

 

I try to run my code and got stuck on the next function at the d4dlcdhw_common.c file:

 

static void Cpu_Delay100US(unsigned short us100)

   {

    unsigned int i;

    while((us100--)){

      for(i=0; i < (MCU_BUS_CYCLES_100US/10); i++)

        {// 10 cycles delay

          asm("NOP");

          asm("NOP");

          asm("NOP");

        }

    }

  }

 

 

¿Is my configuration correct?

¿how do i configure the adc for the touch-screen?

¿how do i use the DAC output for the backlight ?

 

I will apreciate a lot your help !!!!!

Regards

Outcomes