Shop OBEX P1 Docs P2 Docs Learn Events
Flipped over Newhaven display — Parallax Forums

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

Comments

  • 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: 4,198
    edited 2018-08-03 12:43
    He is testing multiple displays in the thread. Resistive too with Eve. Not sure why you say it is not compatible.
  • RaymanRayman Posts: 13,855
    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.
  • RaymanRayman Posts: 13,855
    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...
  • 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
  • RaymanRayman Posts: 13,855
    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.

  • 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

  • RaymanRayman Posts: 13,855
    Actually MO50 and NH70 settings are exactly the same...
  • I have complete most of the functions for using this display module and can now display hello world.

    I seem to spend more time debugging the microcode to drive the display as I do debugging the propeller code.

    In order to drive this display you have to write a microcode program that generate all the elements on the display. So to write "Hello World" on the display requires a program that first clears the screen then selects the font and places each letter on the screen right were you want it. So for each letter one or more instructions are require. This turns out to be a design problem as to fill the screen with instructions quickly runs you out of program instruction space since you only have 2048 instructions spaces available.

    Not only that but to change an object on the screen requires a whole new program that is then swapped in. The instruction memory has two copies and only one is active at a time. So you write to one page and then swap it in to activate it.

    There is also a co-processor that can be used to build objects quickly without having to write the programs yourself. For example it will to text, buttons, sliders, clocks, and more. You just tell the co-processor what you want to build and it will generate the instructions necessary to create it on the screen.

    I constructed a dump function so that I could see the generated code so that if the screen doesn't look quite right I can check the generated code to see what's wrong. Also they have an EVE Screen editor that you can download that can save you a lot of time. It will allow you to build your screen and show you the code needed to build that screen. It will show both the co-processor code and the instruction code along with how much memory you have available for instructions.

    It came in handy to see why some code that I generated was not working or had funny attributes. Dumping the instruction code would show me that something was not being generated correctly and either the function I built was wrong or I was missing something. Most of the time I forgot to add the DISPLAY instruction on the end to tell the display that that was the end of the instructions and to stop otherwise it keeps going adding random items to the display. The instruction memory is not cleared on startup and there is no clear memory function either.

    While the display is capable of generating some nice graphics I find it very hard to program and found a display like the Nextion display easer to setup and interact with. The buttons actually work when you touch them on the Nextion panel.

    I have loaded the library into the object exchange.

    Mike

Sign In or Register to comment.