Forum Update - Announcement about May 10th, 2018 update and your password.

Flipped over Newhaven display

[img][/img]So I purchased a 5 inch resistive touch Newhaven EVE2 display panel in hopes of building a driver library for the Parallax Flip controller. My first task is to write “Hello World” on the display, after all that seems to be something simple to do.

With most displays this is a simple process and in most cases not difficult. With the Newhaven display panel this is not the case.

I download the display panel hardware manual and the programming manual to get started. This got me the pin connections to 3.3 volt and where the MISO, MOSI, SCLK and CS pins are located so I could connect the display panel to the Flip controller. I ended up later connecting the Power down pin as a way to reset the panel without having to power it down after making code changes.

My first issue with the display panel is the programming manual. It talks about API’s used in the manual but never tells you where to find these API’s. These happen to be the low level API’s that talk to the display panel and without them you’re not going to get too far.

Looking at the site they have several examples that talk about using an FT800 board connected to your PC that can drive the display directly. That’s not very helpful as I have a Flip controller and I just want to know how to send an address and data to the display to write “Hello World” on it. I did find a PIC example that actually talked about how an address is sent with the first two bits set to ‘10’ to tell the display panel that this is a write to address and the data will follow and if the bits are ‘00’ it’s a read address.

After several days of looking at this I finally got some code together to read and write data to the display panel registers so that I could start to program this panel. I did stumble a couple of times because I didn’t set the upper bits of the address and so my write instructs didn’t write anything but the read instructions worked perfectly.

Up to this point I could write to the panel but all I got was a black screen with no indication if I had the thing hocked up correctly or even properly powered on. The display was completely black and even when you powered it on no flicker of life and no LED to tell you it was on.

Finally I got some code together and using the hardware manual I was able to program the register to the values needed to get the display setup so I could put something on the screen.
  _write16(REG_HCYCLE, 928);
  _write16(REG_HOFFSET, 88);
  _write16(REG_HSYNC0, 0);
  _write16(REG_HSYNC1, 48);
  _write16(REG_VCYCLE, 525);
  _write16(REG_VOFFSET, 32);
  _write16(REG_VSYNC0, 0);
  _write16(REG_VSYNC1, 3);
  _write8(REG_SWIZZLE, 0);
  _write8(REG_PCLK_POL, 0);
  _write8(REG_CSPREAD, 1);
  _write8(REG_DITHER, 1);
  _write16(REG_HSIZE, 800);
  _write16(REG_VSIZE, 480);
  
  _write8(REG_PWM_DUTY, 64);
  _write8(REG_GPIO_DIR, 0x80 | _read8(REG_GPIO_DIR));
  _write8(REG_GPIO, 0x80 | _read8(REG_GPIO));

  _write8(REG_PCLK, 2);
After running this code the display finally turns on with these alternating vertical lines in different colors across the screen. Oh no I must have fried the screen or something or maybe I have one of the setup values wrong. Nope everything checks out. Must have fried the panel using the wrong values or something.

Well all is not lost since I can write to the registers and read back the data so the panel is not dead just not working. So I looked at more of the programming of this panel which is not simple. They talk about the RAM_DL where instructions are placed to tell the panel what you want it to do. Then you need to send these cryptic commands with encoded values and place them into RAM_DL.

So the first thing I tried was to clear the screen to see if I can get rid of the vertical lines so that I would know that I didn’t wreck the screen after all. So I tried the following code as pointed out, kind of, in the manual.
  doCMD(CMD_DLSTART);
  cmd(doClearColor(0, 255, 0));
  cmd(doClear(1, 1, 1));
  cmd(doDisplay());
No luck the screen did not clear and I was left with vertical lines. Now looking at a PIC manual they explained a few things that even though you tell the coprocessor what you want it to do it will not do it until you tell it that you want it to really do it. So sending DISPLAY is not enough you have to send it a DL_SWAP to tell it that you want it to move the instructions you want it to do into the real memory of where it actually will do it. They call it double buffering, I call it Excedrin headache number nine. Do they say that anymore?

Anyway the following code actually clears the screen with the color you specify. Still have not figured out how to write “Hello World” onto the display. But now I know the panel works and I didn’t break it after all.
  doCMD(CMD_DLSTART);
  cmd(doClearColor(0, 255, 0));
  cmd(doClear(1, 1, 1));
  cmd(doDisplay());
  doCMD(CMD_DLSWAP);
Few.

Mike

NewHaven5.JPG
2272 x 1704 - 1M

Comments

  • 10 Comments sorted by Date Added Votes
  • Yes, I write in C code and not SPIN. That display and hookup it different than my setup. Not compatible.


    Mike

  • You may want to test his code to be sure you are connected and everything works. Then start with the basics on your code.
  • T ChapT Chap Posts: 3,779
    edited August 3 Vote Up0Vote Down
    He is testing multiple displays in the thread. Resistive too with Eve. Not sure why you say it is not compatible.
  • The apis they are talking about are from the example code on ftdi website.

    But, they are mostly meant for talking to display from a pc using another ftdi chip for sqi interface.

    But, if you are using c++ there is a lot there you could copy directly from.
    Prop Info and Apps: http://www.rayslogic.com/
  • Btw: I think you can skip writing directly to the display list. It’s much nicer to send commands to the co-processor instead... it makes the display list for you...
    Prop Info and Apps: http://www.rayslogic.com/
  • I can't use the spin code as it's has to be setup for the display I have. You need to set individual attributes of the screen along with what pins you are using. His example does not work on my display.

    I am writing to the coprocessor and not directly to memory.

    I am working on building the rest of the instruction commands so I can run some of the examples they have now that I have a working base.

    The programming manual in my opinion is not very clear and leaves out some basic information needed to get this thing up and running. I also think the unit is too complex for most applications and there are better and more simple displays to choose from.

    Mike
  • If you want to try my code, all you need to do is change the SPI pin settings. Looks like you have the same type of display that I am currently using...

    Just look for this section:
    CON 'EVE SPI bus PINs
            pin_sck = 24            'SPI clock pin
            pin_miso = 25           'SPI MISO pin
            pin_mosi = 26           'SPI MOSI pin
            pin_csn1 = 27           'SPI chip select pin for LCD1    
            pin_intn1 = 21          'EVE2 interupt pin for LCD1
            pin_pdn1 =  8           'EVE2 power down pin for LCD1
    


    Don't worry about pin_intn1 because I'm not using it.

    I've modified the attached version of my latest test example so that it doesn't use uSD and instead has a very low res Denver image embedded.

    Prop Info and Apps: http://www.rayslogic.com/
  • The display I'm using is NHD-5.0-800480FT-CTXL-T which looks like MO50 in your config.

    I have a few more of the coprocessor command build so now I can run the LOGO demo and see that my display panel is up side down. Running the ROTATE command at 1 flips the screen correctly.

    Still need to figure out how the built the text out command so I can display "Hello World" on the screen.

    Mike

  • Actually MO50 and NH70 settings are exactly the same...
    Prop Info and Apps: http://www.rayslogic.com/
Sign In or Register to comment.