LCD display fault detect circuit - LFD - kinetis KL46

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

LCD display fault detect circuit - LFD - kinetis KL46

663 Views
piotr_sedrowski
Contributor I

Hello everybody! :smileyhappy:
I need your help. I've a little problem with my code which should  detect faults in a circuit in kinetis mkl46(RTOS, 12Mhz).


Here is my init code for LCD:

void sLCD_Init(void)
{
   uint8_t waveForm = 0;
   slcd_config_t config;
   slcd_clock_config_t clkConfig =
   {
      kSLCD_AlternateClk1,
      kSLCD_AltClkDivFactor1,
      kSLCD_ClkPrescaler01,
      false
   };
   LCD_InitPins_ALT0();
   SLCD_GetDefaultConfig(&config);

   /* Verify and Complete the configuration structure. */
   config.clkConfig = &clkConfig;
   config.powerSupply = kSLCD_InternalVll3UseChargePump;
   config.loadAdjust = kSLCD_LowLoadOrFastestClkSrc;
   config.dutyCycle = kSLCD_1Div4DutyCycle;
   config.slcdLowPinEnabled = 0xFFFFFF88U; /* 11111111 11111111 11111111 10001000 */ // 3,    7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,
   config.slcdHighPinEnabled = 0x1F73U; /* 00000000 00000000 00011111 01110011 */ // 32,33, 36,37,38, 40,41,42,43,44
   config.backPlaneLowPin = 0xF000000U; /* 00001111 00000000 00000000 00000000 */
   config.backPlaneHighPin = 0x0U; /* 00000000 00000000 00000000 00000000 */
   config.faultConfig = NULL;

   /* SLCD Initialize. */
   SLCD_Init(LCD, &config);

   //waveForm = (kSLCD_PhaseAActivate | kSLCD_PhaseBActivate | kSLCD_PhaseCActivate |    kSLCD_PhaseDActivate);
   /* Set SLCD back plane phase. */
   SLCD_SetBackPlanePhase(LCD, 24, kSLCD_PhaseAActivate); /* SLCD COM1 --- LCD_P24. */
   SLCD_SetBackPlanePhase(LCD, 25, kSLCD_PhaseBActivate); /* SLCD COM2 --- LCD_P25. */
   SLCD_SetBackPlanePhase(LCD, 26, kSLCD_PhaseCActivate); /* SLCD COM3 --- LCD_P26. */
   SLCD_SetBackPlanePhase(LCD, 27, kSLCD_PhaseDActivate); /* SLCD COM4 --- LCD_P27. */


   /* Starts SLCD display. */
   SLCD_StartDisplay(LCD);

}

And here is my code to detect faults in a circuit:

LCD_InitPins_ALT7();
for(i=0; i<36; i++){
   LCD_FDCR = 0;
   LCD_FDCR |= LCD_FDCR_FDPINID(LCD_PINS[i]);
   if(i<4){
      LCD_FDCR |= LCD_FDCR_FDBPEN(1); // 1-BACK PLANE
      LCD_FDCR |= LCD_FDCR_FDPRS(5); // CLOCK: 5 - 1/32 bus clock
      LCD_FDCR |= LCD_FDCR_FDSWW(6); // SAMPLE WIDTH: 6 - 256 sample clock cycles
   }else{
      LCD_FDCR |= LCD_FDCR_FDBPEN(0); // 0-FRONT PLANE
      LCD_FDCR |= LCD_FDCR_FDPRS(5); // CLOCK: 4 - 1/32 bus clock
      LCD_FDCR |= LCD_FDCR_FDSWW(2); // SAMPLE WIDTH: 2 - 16 sample clock cycles
   }

   LCD_FDCR |= LCD_FDCR_FDEN(1); // ENABLE FAULT DETECTION;
   while(!(LCD_FDSR & LCD_FDSR_FDCF_MASK)){

   }
   //msDelay(100);
   //LFD_one_samples_cnt[i] = (uint8_t)(LCD_FDSR & LCD_FDSR_FDCNT_MASK);

   LFD_one_samples_cnt[i] = SLCD_GetFaultDetectCounter(LCD);
   LCD_FDSR = LCD_FDSR_FDCF(1); // CLEAR BIT
}
LCD_InitPins_ALT0();

And output data:

LFD_one_samples_cnt[0] = 0xc9;

LFD_one_samples_cnt[1] = 0xca;

LFD_one_samples_cnt[2] = 0xb3;

LFD_one_samples_cnt[3] = 0xab;

LFD_one_samples_cnt[4] = 0x0;

LFD_one_samples_cnt[5] = 0x0;

LFD_one_samples_cnt[6] = 0x0;

LFD_one_samples_cnt[7] = 0x0;

LFD_one_samples_cnt[8] = 0x0;

LFD_one_samples_cnt[9] = 0x10;

LFD_one_samples_cnt[10] = 0x0;

LFD_one_samples_cnt[11] = 0x10;

LFD_one_samples_cnt[12] = 0x0;

LFD_one_samples_cnt[13] = 0x10;

LFD_one_samples_cnt[14] = 0x0;

LFD_one_samples_cnt[15] = 0x10;

LFD_one_samples_cnt[16] = 0x0;

LFD_one_samples_cnt[17] = 0x10;

LFD_one_samples_cnt[18] = 0x10;

LFD_one_samples_cnt[19] = 0x0;

LFD_one_samples_cnt[20] = 0x10;

LFD_one_samples_cnt[21] = 0x0;

LFD_one_samples_cnt[22] = 0x10;

LFD_one_samples_cnt[23] = 0x0;

LFD_one_samples_cnt[24] = 0x10;

LFD_one_samples_cnt[25] = 0x0;

LFD_one_samples_cnt[26] = 0x10;

LFD_one_samples_cnt[27] = 0x0;

LFD_one_samples_cnt[28] = 0x10;

LFD_one_samples_cnt[29] = 0x0;

LFD_one_samples_cnt[30] = 0x10;

LFD_one_samples_cnt[31] = 0x0;

LFD_one_samples_cnt[32] = 0x10;

LFD_one_samples_cnt[33] = 0x0;

LFD_one_samples_cnt[34] = 0x10;

LFD_one_samples_cnt[35] = 0x0;

LFD_one_samples_cnt[0], LFD_one_samples_cnt[1], LFD_one_samples_cnt[2] and LFD_one_samples_cnt[3] are correct. Others have always the same value - 0x0 or 0x10;

Does anyone have any idea why it does not work properly??? I wolud be grateful for any advice ;-)

Labels (1)
0 Kudos
2 Replies

425 Views
ivadorazinova
NXP Employee
NXP Employee

Hello Piotr Sedrowski,

I am very sorry for this late response!

We deal with you case and let you know as soon as possible.

Thank you for your patience.

Have a nice day.

Iva

0 Kudos

425 Views
ivadorazinova
NXP Employee
NXP Employee

Hello Piotr Sedrowski,

I received the feedback from our Application Team.

Please, check if front pins all has the good connection, and also please change clock prescale and sample window to have a try.

      LCD_FDCR |= LCD_FDCR_FDPRS(5); // CLOCK: 4 - 1/32 bus clock
      LCD_FDCR |= LCD_FDCR_FDSWW(2); // SAMPLE WIDTH: 2 - 16 sample clock cycles

for that fault count is 0, please try to inscrease the sample windows, and for that count is 0x10, please try to decrease clock prescale.

In case of any questions, please let me know.

Best Regards,

Iva

0 Kudos