Author Topic: NHD-C0216CZ-NSW-BBW-3V3 LCD initialization  (Read 2694 times)

Krishkakarla

  • Newbie
  • *
  • Posts: 2
  • Karma: 0
    • View Profile
NHD-C0216CZ-NSW-BBW-3V3 LCD initialization
« on: April 18, 2015, 05:09:52 PM »
Hello All,
1. I am having trouble initializing my NHD-C0216CZ-NSW-BBW-3V3 LCD using an STM32f303 discovery board. I am using the logic analyzer to debug my SPI communication protocol and the data I'm sending seems to be fine. I'm using the following SPI clock settings to send data; CPOL=1, CPHA=1.
2. I've done the following hardware connections: Between C1+ to C1- a 2.2uF cap, Vout to 1uF to GND; rest of the LCD pins to the microcontroller pins.
3. I've used the following initialization routine. The timing between the instructions sent is correct when I checked with my logic analyzer:

void lcd_initialization(void)
{
   SS=1;
        MOSI=1;
        SCK=1;
       
        RS=1;

   
   RST=1   
        Delay(2);
   RST=0
   Delay(20);
   send_inst(0x30);            // wake up
   Delay(2);
   send_inst(0x30);            // wake up
   send_inst(0x30);            // wake up
   send_inst(0x39);
   send_inst(0x14);            // wake up
   send_inst(0x56);            // function set and instruction table = 1
   send_inst(0x6D);            // interanl oscillator frequency
   send_inst(0x70);          // power control
   send_inst(0x0C);            // follower control
   send_inst(0x06);            // contrast set
   send_inst(0x01);
   Delay(2);
}



4. I also used the following initialization routine:
void lcd_initialization(void)
{
   SS=1;
        MOSI=1;
        SCK=1;
       
        RS=1;
   
   
   RST=1   
        Delay(2);
   RST=0
   
    Delay(40);
   send_inst(0x38);            // wake up
   send_inst(0x39);            // wake up
   send_inst(0x14);            // wake up
   send_inst(0x78);            // function set and instruction table = 1
   send_inst(0x5E);            // interanl oscillator frequency
   send_inst(0x6A);          // power control
    delay (200);
   send_inst(0x0C);            // follower control
   send_inst(0x01);            // contrast set
   delay (2);
   send_inst(0x06);         // entry mode set

}

Also, how do I check for the LCD busy flag when I only have a MOSI pin for the LCD but not a MISO pin??

I'm clueless on how to proceed further and the LCD shows no signs of life whatsoever except for the backlight. Any help would be really appreciated.

Thanks,
Krishna

   

Michael_L

  • Administrator
  • Hero Member
  • *****
  • Posts: 356
  • Karma: 33
    • View Profile
Re: NHD-C0216CZ-NSW-BBW-3V3 LCD initialization
« Reply #1 on: April 22, 2015, 11:41:23 AM »
How fast is your SPI clock?  The clock period has a minimum rating of 200ns.  Also, have you tried using the write routines provided in the example code section of the datasheet?
« Last Edit: April 22, 2015, 11:56:13 AM by Michael_L »

Krishkakarla

  • Newbie
  • *
  • Posts: 2
  • Karma: 0
    • View Profile
Re: NHD-C0216CZ-NSW-BBW-3V3 LCD initialization
« Reply #2 on: April 28, 2015, 04:20:08 AM »
@Michael,
Thanks for the quick reply. I saw that the clock speed specified in the datasheet is 380kHz at the least and so I reduced my SPI clock speed to 250kHz. I did not use the write routines that were specified in the datasheet. The ones that I'm using are built in SPI data transfer routines provided by STMicro. I've been able to see the clock toggling and the correct data being sent using my logic analyzer. I've also rechecked to ensure that there's no violation in the timing too.

Krishna

Michael_L

  • Administrator
  • Hero Member
  • *****
  • Posts: 356
  • Karma: 33
    • View Profile
Re: NHD-C0216CZ-NSW-BBW-3V3 LCD initialization
« Reply #3 on: May 01, 2015, 07:40:15 AM »
It might be worth a try to give those write routines in the datasheet a try, just as a means of troubleshooting.  That code should work regardless of what mcu you are using, therefore it will make for a good test.

 

NHD‐C0216CZ‐FSW‐FBW‐3V3

Started by AJS@UltraClenzBoard Character LCDs

Replies: 1
Views: 2359
Last post September 08, 2014, 09:22:04 AM
by Michael_L
NHD‐C12864A1Z‐FS(RGB)‐FBW‐HT1 Initialization

Started by BMohlmanBoard Graphic LCDs

Replies: 5
Views: 3746
Last post January 13, 2016, 07:44:16 AM
by Paul_B
Working on NHD‐2.4‐240320SF‐CTXL#‐FTN1, have problem in initialization

Started by sli25Board TFTs

Replies: 6
Views: 3616
Last post June 04, 2015, 09:52:25 PM
by sli25
NHD-C0216CZ-NSW-BBW-3V3 Voltage booster Capacitor Voltage

Started by GeoffStateBoard Character LCDs

Replies: 2
Views: 2962
Last post November 16, 2014, 09:34:14 PM
by GeoffState
Use of Timing characteristics in the initialization code of the display

Started by ShabdaBoard TFTs

Replies: 1
Views: 2828
Last post May 20, 2014, 08:00:39 AM
by Michael_L