Main Site Documentation

EMX/G120 LCD Newheven


#1

I can see on the forum that several has tried to use the 4.3 Inch LCD from Newhaven:

NHD‐4.3‐480272MF‐ATXI#‐T‐1 (old version)
NHD‐4.3‐480272EF‐ATXI#‐T‐1 (new version)

Can any one help setting this LCD up on the EMX / G120 ?

(GHI’s 4.3 inch touch screen is no more available - so we need and alternative)

This Newhaven has a very simple electrical interface, low price and seems to be a good quality.

Please help!

PS. I tried the this thread

http://www.tinyclr.com/forum/topic?id=9746

but with the same result as in the thread


#2

@ andre.marschalek - T35 is 3.5inch…not 4.3…


#3

So, here it is with calibrated touch interface:


using System;

using Microsoft.SPOT;
using Microsoft.SPOT.Input;
using Microsoft.SPOT.Presentation;
using Microsoft.SPOT.Presentation.Controls;
using Microsoft.SPOT.Presentation.Media;
using Microsoft.SPOT.Touch;

using GHIElectronics.NETMF.Hardware;

namespace MFW_EMX_Newhaven
{
    public class Program : Microsoft.SPOT.Application
    {
        // Text Control
        private static Text text;
        
        public static void Main()
        {
            Program myApplication = new Program();

            // SET LCD Calibration (Newhaven NHD-4.3-480272EF-ATXL#-T)
            SetLCDConfigurations();

            // Set touch calibration data. (Newhaven NHD-4.3-480272EF-ATXL#-T)
            Touch.Initialize(myApplication);
            const int CAL_POINTS = 5;
            short[] sx = new short[CAL_POINTS] { 240, 30, 30, 390, 390 };
            short[] sy = new short[CAL_POINTS] { 136, 18, 239, 239, 18 };
            short[] cx = new short[CAL_POINTS] { 478, 189, 169, 781, 790 };
            short[] cy = new short[CAL_POINTS] { 481, 238, 741, 767, 231 };
            Microsoft.SPOT.Touch.Touch.ActiveTouchPanel.SetCalibration(CAL_POINTS, sx, sy, cx, cy);

            Window mainWindow = myApplication.CreateWindow();

            // Start the application
            myApplication.Run(mainWindow);
        }

        private Window mainWindow;

        public Window CreateWindow()
        {
            // Create a window object and set its size to the size of the display.
            mainWindow = new Window();
            mainWindow.Height = SystemMetrics.ScreenHeight;
            mainWindow.Width = SystemMetrics.ScreenWidth;

            // Create a single text control.
            text = new Text();
            text.Font = Resources.GetFont(Resources.FontResources.small);
            text.TextContent = Resources.GetString(Resources.StringResources.String1);
            text.HorizontalAlignment = Microsoft.SPOT.Presentation.HorizontalAlignment.Center;
            text.VerticalAlignment = Microsoft.SPOT.Presentation.VerticalAlignment.Center;

            // Add the text control to the window.
            mainWindow.Child = text;

            // Set the window visibility to visible.
            mainWindow.Visibility = Visibility.Visible;

            // Touch Events
            mainWindow.TouchDown += new TouchEventHandler(mainWindow_TouchDown);
            mainWindow.TouchUp += new TouchEventHandler(mainWindow_TouchUp);

            return mainWindow;
        }

        // Set LCD Configuration for Newhaven NHD-4.3-480272EF-ATXL#-T
        private static void SetLCDConfigurations()
        {
            Configuration.LCD.Configurations lcdConfig = new Configuration.LCD.Configurations();
            lcdConfig.Width = 480;
            lcdConfig.Height = 272;

            // Only use if needed, see documentation.
            lcdConfig.PriorityEnable = false;

            lcdConfig.OutputEnableIsFixed = false;
            lcdConfig.OutputEnablePolarity = true;

            lcdConfig.HorizontalSyncPolarity = false;
            lcdConfig.VerticalSyncPolarity = false;
            lcdConfig.PixelPolarity = false;

            lcdConfig.HorizontalSyncPulseWidth = 41;
            lcdConfig.HorizontalBackPorch = 2;
            lcdConfig.HorizontalFrontPorch = 2;

            lcdConfig.VerticalSyncPulseWidth = 10;
            lcdConfig.VerticalBackPorch = 2;
            lcdConfig.VerticalFrontPorch = 2;

            // NOTE: This is used for EMX
            lcdConfig.PixelClockDivider = 8;


            // Set config
            if (Configuration.LCD.Set(lcdConfig))
            {
                // New settings were saved, must reboot
                Microsoft.SPOT.Hardware.PowerState.RebootDevice(false);
            }
        }

        private void mainWindow_TouchUp(object sender, TouchEventArgs e)
        {
            string S = "Touch up: " + e.Touches[0].X + ", " + e.Touches[0].Y;
            Debug.Print(S);
            text.TextContent = S;
        }

        private void mainWindow_TouchDown(object sender, TouchEventArgs e)
        {
            string S = "Touch down: " + e.Touches[0].X + ", " + e.Touches[0].Y;
            Debug.Print(S);
            text.TextContent = S;
        }
    }
}

Hardware connections:

Ribbon Function EMX
Pins Pins

1 GND
2 LED+ LED Power Supply
3 GND
4 Vcc Vcc 3.3V
5 GND
6 GND
7 GND
8 R3 LCD_R0
9 R4 LCD_R1
10 R5 LCD_R2
11 R6 LCD_R3
12 R7 LCD_R4
13 GND
14 GND
15 G2 LCD_G0
16 G3 LCD_G1
17 G4 LCD_G2
18 G5 LCD_G3
19 G6 LCD_G4
20 G7 LCD_G5
21 GND
22 GND
23 GND
24 B3 LCD_B0
25 B4 LCD_B1
26 B5 LCD_B2
27 B6 LCD_B3
28 B7 LCS_B4
29 GND
30 PCLK LCD_CLK
31 DISP IO15
32 HSYNC LCD_HT
33 VSYNC LCD_VT
34 Data Enabled LCD_DE
35 NC
36 GND
37 XR IO71
38 YD IO73
39 XL IO8
40 YU IO5

LED Power, use LT3593, in standard configuration
Vcc is 3.3Vdc
Screen ribbon connector is a XF2M-4015 (Not that the pin order can be inverted)
Least significant RGB bits on the screen is grounded.

NOTE !!! This screen cannot be substituted directly with the GHI Screens on PCB 3.5", 4.3" and 7".
You need a LED power supply on your own PCB and the pin out is different.


#4

@ nsb: Are you saying that the information you provided works with the Newhaven 4.3" display using a G120?

[quote]Least significant RGB bits on the screen is grounded.
[/quote]

I would suggest that the least significant bits be connected to the MSB of each color so that true black and white can be achieved.

Regards,
Synapsys


#5

That is under test right now…


#6

That is a good idea… thanks!


#7

Here is the code for the G120:

using System;

using Microsoft.SPOT;
using Microsoft.SPOT.Input;
using Microsoft.SPOT.Presentation;
using Microsoft.SPOT.Presentation.Controls;

using GHI.Premium.Hardware;

namespace MFW_G120_Newhaven
{
    public class Program : Microsoft.SPOT.Application
    {
        public static void Main()
        {
            Program myApplication = new Program();

            SetLCDConfigurations();

            Window mainWindow = myApplication.CreateWindow();

            // Start the application
            myApplication.Run(mainWindow);
        }

        private Window mainWindow;

        public Window CreateWindow()
        {
            // Create a window object and set its size to the
            // size of the display.
            mainWindow = new Window();
            mainWindow.Height = SystemMetrics.ScreenHeight;
            mainWindow.Width = SystemMetrics.ScreenWidth;

            // Create a single text control.
            Text text = new Text();

            text.Font = Resources.GetFont(Resources.FontResources.small);
            text.TextContent = Resources.GetString(Resources.StringResources.String1);
            text.HorizontalAlignment = Microsoft.SPOT.Presentation.HorizontalAlignment.Center;
            text.VerticalAlignment = Microsoft.SPOT.Presentation.VerticalAlignment.Center;

            // Add the text control to the window.
            mainWindow.Child = text;

            // Set the window visibility to visible.
            mainWindow.Visibility = Visibility.Visible;

            // Attach the button focus to the window.
            Buttons.Focus(mainWindow);

            return mainWindow;
        }

        // Set LCD Configuration for Newhaven NHD-4.3-480272EF-ATXL#-T
        private static void SetLCDConfigurations()
        {
            Configuration.LCD.Configurations lcdConfig = new Configuration.LCD.Configurations();
            lcdConfig.Width = 480;
            lcdConfig.Height = 272;

            // Only use if needed, see documentation.
            // lcdConfig.PriorityEnable = false;

            lcdConfig.OutputEnableIsFixed = false;
            lcdConfig.OutputEnablePolarity = true;

            lcdConfig.HorizontalSyncPolarity = false;
            lcdConfig.VerticalSyncPolarity = false;
            lcdConfig.PixelPolarity = false;

            lcdConfig.HorizontalSyncPulseWidth = 41;
            lcdConfig.HorizontalBackPorch = 2;
            lcdConfig.HorizontalFrontPorch = 2;

            lcdConfig.VerticalSyncPulseWidth = 10;
            lcdConfig.VerticalBackPorch = 2;
            lcdConfig.VerticalFrontPorch = 2;

            // NOTE: This is used for EMX
            lcdConfig.PixelClockRateKHz = 9000;


            // Set config
            if (Configuration.LCD.Set(lcdConfig))
            {
                // New settings were saved, must reboot
                Debug.Print("LCD Configuration Change. Device is rerooting.");
                Microsoft.SPOT.Hardware.PowerState.RebootDevice(false);
            }
        }
    }
}

The touch is not done by GHI, yet !!!

I will now try to make a way around this…

The electrical connections for the G120 will be added later when I have got the touch interface to work, also.
(The rest is in principle it is the same as for the EMX.)


#8

Hello, nsb! Is you forced work touch on G120 with this screen?


#9

Yes, since this post we have got touch from this screen.

Screen to EMX module (Internal NETMF Touch handler):
YU to AD1/IO5
XL to AD0/IO8
YD to IO73/P2.31
XR to IO72/P2.23

Screen to G120 module (Internal NETMF Touch handler):
YU to AD1/P0.24
XL to AD0/P0.23
YD to P1.0
XR to P1.1

XL and YU must have 10kOhm pull down (to GND) on G120

On EMX it works perfect, but on G120 we have some false positions, sometimes.
It happens on very light touches, only.

The only difference we can see is the 10k pull downs - but without them the G120 did not work. Please let us know if you find the cause!

(And the least significant bits be connected to the MSB of each color so that true black and white can be achieved, as suggested)


#10

Thank you! I’ll try it, but not today already, because all left on work. I think it solve my problem.