NHD-0216K3Z-FL-GBW-V3 via SPI Help Requested

Comments

4 comments

  • Michael_L

    Have you looked at our serial interface  character LCD example code on our website?  Here is a link to it below:

    https://newhavendisplay.com/content/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.

    0
  • milhead

    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?

    // ...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

    0
  • milhead

    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

    0
  • Michael_L

    Thank you for sharing your corrections!

    0

Please sign in to leave a comment.