Author Topic: NHD-0216K3Z-FL-GBW-V3 via SPI Help Requested  (Read 4243 times)

milhead

  • Newbie
  • *
  • Posts: 4
  • Karma: 2
    • View Profile
NHD-0216K3Z-FL-GBW-V3 via SPI Help Requested
« on: April 28, 2014, 12:06:17 AM »
Hello Folks;

I'm using a NHD-0216K3Z-FL-GBW-V3 via SPI and I cannot
get a single character to display...

My clock frequency is around 78Khz, The following
display, show my setting
Display-On (0xfe,0x41),
Set-Contrast (0xfe, 0c52, 0x19), then
Clear-Screen (0xfe, 0x51).. Then
the text for 'Hello'

I cannot get any logical commands to work, LCD back-light etc..

I have soldered a wire across R2 to select SPI...

Does someone have an example of commands needed to initialize the display or am I missing something else...

I have the exact same result with two displays, I suspect
there is something that I am not doing;

Any help would be appreciated!

Miller

Michael_L

  • Administrator
  • Hero Member
  • *****
  • Posts: 356
  • Karma: 33
    • View Profile
Re: NHD-0216K3Z-FL-GBW-V3 via SPI Help Requested
« Reply #1 on: April 29, 2014, 10:14:25 AM »
Have you looked at our serial interface  character LCD example code on our website?  Here is a link to it below:
http://www.newhavendisplay.com/app_notes/Serial_LCD.txt
You will see that in the example code, the various modes of serial communication are shown.  You will only need to focus on the SPI interface sections of code.
This will show you not only how to write to the display via SPI (timing, protocol) but also how to initialize it correctly.

milhead

  • Newbie
  • *
  • Posts: 4
  • Karma: 2
    • View Profile
Re: NHD-0216K3Z-FL-GBW-V3 via SPI Help Requested
« Reply #2 on: April 29, 2014, 06:11:24 PM »
Hi Michael

I've changed my code slightly to send the exact same commands with at least the same delays I still get no effect on the display.

In the example code it sets the Black light Brightness to 15 but the documentation says that it's
defined between 1-8.  Do you know what the correct range is?

Code: [Select]
// ...snippet from Newhaven example code....
// Set Backlight Level
tx_packet[1] = 0x53;
tx_packet[2] = 15; // backlight 1 - 15
send_packet(3);

In my case the back-light is on full (compared to my other parallel Newhaven displays).

Do you know what SPI 'mode' the display requires?

Would it be possible to see a logic analyzer trace of a successful display initialization? 
There are so many SPI variants combined with the emulation of an SPI slave by the
PIC controller.  Seeing a working one would allow me to quickly setup my master to
communicate the same way.

I've tried to back out the SPI pin interactions from the example code without success....

Any help would be appreciated!

Miller



milhead

  • Newbie
  • *
  • Posts: 4
  • Karma: 2
    • View Profile
OK, Have it working....
« Reply #3 on: April 30, 2014, 09:44:11 AM »
I got it working.. 

The PIC software does 'not' have a multi-byte transfer capability and requires the
clock be high prior to initiating the clock within a chip select as well as Sampling
on the clock rising edge...  Until I adjusted my master as shown below I had a variety of
failures.

In SPI specification terms

   MSB First
   8 Bits per transfer ( No Multi-byte transfers )
   Enable Line is active Low...
   SPI Mode 3 (See http://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus)
        SPI:CPOL=1  (Clock Polarity, High When Inactive)
        SPI:CPHA=1 (Clock Phase, Data is valid on clock trailing edge)

I'm sure the author of the PIC code knew this stuff but was dropped before the somewhat brief protocol discussion in the external reference. 

Obey the required delay after the various commands as shown in the spec..

I hope this saves somebody some time....

Miller


« Last Edit: May 01, 2014, 01:20:40 PM by milhead »

Michael_L

  • Administrator
  • Hero Member
  • *****
  • Posts: 356
  • Karma: 33
    • View Profile
Re: NHD-0216K3Z-FL-GBW-V3 via SPI Help Requested
« Reply #4 on: May 06, 2014, 12:07:10 PM »
Thank you for sharing your corrections!

 

Demo code for NHD-0216K3Z-FS(RGB)-FBW-V3 module on an ATMEL ATtiny 2313A

Started by swulfBoard Customer Projects

Replies: 1
Views: 13
Last post Today at 07:56:43 AM
by Paul_B
NHD-0216K3Z-FL-GBW-V3 losing/dropping characters

Started by SaintGimpBoard Character LCDs

Replies: 1
Views: 2964
Last post April 07, 2014, 08:57:01 AM
by Michael_L
LCD : NHD-0216K3Z-NSW-BBW-V3 -- Firmware version clarification

Started by amitattBoard Character LCDs

Replies: 1
Views: 2363
Last post August 26, 2014, 04:27:41 PM
by Michael_L
NHD-0216K3Z-FL-GBW-V3-C serial interface not working

Started by BobecBoard Character LCDs

Replies: 1
Views: 2009
Last post July 14, 2015, 08:49:25 AM
by Saurabh_B
NHD-0216K3Z-FL-GBW-V3 outputting 5V on data pin

Started by Andrew_BBoard Character LCDs

Replies: 4
Views: 1216
Last post December 07, 2016, 08:34:51 AM
by Paul_B