MI0283QT2 und netduino

wired 2011-02-01 09:55:34 Link
Hallo,

ich habe dieses sehr praktische Display erfolgreich mit dem Arduino +
EthershieldSD im Einsatz und würde es nun gerne mit dem netduino plus
verwenden da die Res. knapp werden.

Soweit ich verstanden habe müsste ich den C-code des Display und
Touch-Treibers als Klasse für das mikro-framework verpacken, gibt es so
etwas schon? .NET ist leider noch Neuland für mich, die Grundfunktionen der
Anwendung habe ich dort schon umgesetzt (Ethernet, SD, I2C).

Gruss und Danke vor allem für die Entwicklung des sehr praktischen
Display-Adapters.

Nicolas Brüggemann 2011-03-04 07:56:52 Link
Hallo, ich habe eine kleine Klasse für das Display und eine kleine Klasse
für den Touchscreen controler geschrieben.

Natürlich kann man die sachen noch optimieren.. aber hier schonmal ein
Anfang...

(Code im nächsten Beitrag.)

Andreas Watterott 2011-03-04 12:36:15 Link
Attachment: netduino_display.zip (9.08 KB)
Anbei der komplette Code von Nicolas.

han_swurst 2011-03-07 08:37:22 Link
Hallo Andreas,
kannst Du das ZIP neu anhängen? 
Es hat beim Runterladen 0kB.
MfG
Chris

Andreas Watterott 2011-03-07 09:33:06 Link
Ich habe das Archiv nochmal neu hoch geladen:
http://www.watterott.net/forum/attachment/797

han_swurst 2011-03-07 11:18:36 Link
Danke Andreas.
MfG
Chris

af6767 2011-03-23 00:06:32 Link
Ich hab die Klasse mal ausprobiert, leider bekomme ich schon beim
Bildschirm leeren ein 'SystemOutOfMemory'. Das Array scheint für den
Speicher zu groß. Wenn ich das erstmal umgehe, dann bekomme ich eine
Exception beim Druck auf das Display. Hat Jemand einen Tipp für mich ?

cu
   Andreas

af6767 2011-03-29 08:02:11 Link
Ok, nachdem ich mich jetzt mal rein gearbeitet habe, funktioniert alles
soweit. Ich musste aber Änderungen vornehmen. Was mir jetzt noch nicht so
klar ist, ist die Übertragung der C++ Funktion rd_data in C#. Andreas
Watterott hat ja alles sehr schön in seinem msdshield code aufgeführt. Das
ist dann von Nicolas in C# übertragen worden, aber da scheint es bei den
Bitoperationen Probleme zu geben. Eine 1 zu 1 Umsetzung scheint bei der
Touchscreen Position andere Ergebnisse zu liefern. Die Sache mit den 12 Bit
ist mir noch nicht so klar. Vielleicht hat Andreas da eine kurze Erklärung
für mich?

cu
   Andreas

Martino 2011-04-06 22:25:18 Link
Hi , I have try your code, but I have the problem with cs pin. If I set 
spi.configuration(Pins.GPIO_NONE ... )the Lcd is only white. I have try to
set spi.configuration(Pins.GPIO_PIN_D07 ..)  and the lcd run.
Sorry for my english!!

af6767 2011-04-07 08:16:03 Link
Hi,
SPI is on digital Pins 11-13 :
digital pins 11-13: SPI MOSI, MISO, SPCK

The Display Select 'cs' have to be connected to a normal digital pin.

You can connect like this :
            SPI_FullSpeed = new ExtendedSpiConfiguration(Pins.GPIO_NONE,  
false, 1, 1, false, true, 20000, SPI_Devices.SPI1, 16);
            SPI_Port = new SPI(SPI_FullSpeed);

// Anschlussports / Connection Ports
            DisplayReset = new OutputPort(Pins.GPIO_PIN_D8, true);
            TouchSelect = new OutputPort(Pins.GPIO_PIN_D6, true);
            DisplaySelect = new OutputPort(Pins.GPIO_PIN_D7, true);
            DisplayLed = new PWM(Pins.GPIO_PIN_D9);

            // LCD und Touch Panel erstellen
            lcd = new MI0283QT_2(SPI_Port, DisplaySelect, DisplayReset,
DisplayLed);
            tp = new ADS7846(SPI_Port, SPI_LowSpeed, SPI_Port.Config,
TouchSelect);

I hope, this helps you..

cu
   Andreas

Martino 2011-04-07 14:09:34 Link
Hi, I have try but I have this error:

"Eccezione non gestita di tipo 'System.NullReferenceException' in
NetduinoApplication6.exe"

In ExtendedSpiConfiguration.cs

"
   Type spiConfigurationType = typeof(SPI.Configuration);
            FieldInfo fieldInfo =
spiConfigurationType.GetField("Custom_BitsPerTransfer",
BindingFlags.NonPublic | BindingFlags.Instance);

            fieldInfo.SetValue(this, BitsPerTransfer); // The error is here
          
"

Thanks

P.s.
can you post a simply project?

af6767 2011-04-07 14:36:19 Link
Which Firmware Version do you have on your Netduino ?

cu
   Andreas

af6767 2011-04-07 15:07:43 Link
try to drop the last argument here :
SPI_FullSpeed = new ExtendedSpiConfiguration(Pins.GPIO_NONE,  
false, 1, 1, false, true, 20000, SPI_Devices.SPI1, 16); <----

write :
SPI_FullSpeed = new ExtendedSpiConfiguration(Pins.GPIO_NONE,  
false, 1, 1, false, true, 20000, SPI_Devices.SPI1);

I use Firmware 4.1.1.beta7

cu
   Andreas

Martino 2011-04-07 22:53:44 Link
the original firmware , I think 4.1.0.6 .
I have try the new Spi configuration but the problem isn't solved.

If I use  this class
    public MIO283QT_2()
        {
            //OutputPort pin = new OutputPort(Pins.GPIO_NONE, true);
            var spiConfig = new SPI.Configuration(Pins.GPIO_PIN_D7
                                                  , false
                                                  , 0
                                                  , 0
                                                  , false
                                                  , true
                                                  , 10000
                                                  , SPI.SPI_module.SPI1
                                                  );

           // OutputPort CS = new OutputPort(Pins.GPIO_PIN_D6, false);
            spi = new SPI(spiConfig);
//            var CS = new OutputPort(PIN_LCD_CS, true
                
                
                
                
                
        }



        public ushort Intensity
        {
            get { return LED.Intensity; }
            set { LED.Intensity = value; }
        }



        void Cmd(byte reg, byte param)
        {
            spi.Write(new byte[] { 0x70, reg });
            spi.Write(new byte[] { 0x72, param });
        }


        void Rst(bool Enable)
        {
            RST.Write(!Enable);
        }



        public void Clear(byte R, byte G, byte B)
        {
            Clear(RGB(R, G, B));
        }


        public void Clear(uint color)
        {
            byte[] data = new byte[LCD_WIDTH * 2 + 1];
            data[0] = LCD_DATA;
            for ( uint i = 1; i < data.Length; i += 2)
            {
                data[i] = (byte)(color >> 8);
                data[i + 1] = (byte)color;
            }

            for (uint h = 0; h < LCD_HEIGHT; h++)
            {
                Area(0, h, LCD_WIDTH -1 , h);
                spi.Write(new byte[] { LCD_REGISTER, 0x22 });
                spi.Write(data);
            }
        }


        public void Draw(uint x, uint y, uint width, uint height, byte[]
data)
        {
            Area(x, y, x + width -1, y + height -1);
            spi.Write(new byte[] { LCD_REGISTER, 0x22 });
            spi.Write(data);
        }


        public void Button(uint x , uint y)
        {
            uint color = RGB(5,5,5);
            Area(x, y, x+100, y+100);
            byte[] data = new byte[100 * 2 * 100 + 1];
            data[0] = LCD_DATA;
            for (uint i = 1; i < data.Length; i += 2)
            {
                data[i] = (byte)(color >> 8);
                data[i + 1] = (byte)color;
            }
            spi.Write(new byte[] { LCD_REGISTER, 0x22 });
            spi.Write(data);
        }


        void Area(uint x0, uint y0, uint x1, uint y1)
        {
            Cmd(0x03, (byte)(x0 >> 0)); //set x0     -- col address start 1
            Cmd(0x02, (byte)(x0 >> 8)); //set x0     -- Col address start 2
            Cmd(0x05, (byte)(x1 >> 0)); //set x1     -- Col address end 1
            Cmd(0x04, (byte)(x1 >> 8)); //set x1     -- col address end 2
            Cmd(0x07, (byte)(y0 >> 0)); //set y0     -- row address start 1
            Cmd(0x06, (byte)(y0 >> 8)); //set y0     -- row address start 2
            Cmd(0x09, (byte)(y1 >> 0)); //set y1     -- row address end 1
            Cmd(0x08, (byte)(y1 >> 8)); //set y1     -- row address end 2
        }



        public void Reset()
        {
            //reset
            Rst(true);
            Thread.Sleep(50);
            Rst(false);
            Thread.Sleep(50);

            //driving ability
            Cmd(0xEA, 0x0000);
            Cmd(0xEB, 0x0020);
            Cmd(0xEC, 0x000C);
            Cmd(0xED, 0x00C4);
            Cmd(0xE8, 0x0040);
            Cmd(0xE9, 0x0038);
            Cmd(0xF1, 0x0001);
            Cmd(0xF2, 0x0010);
            Cmd(0x27, 0x00A3);

            //power voltage
            Cmd(0x1B, 0x001B);
            Cmd(0x1A, 0x0001);
            Cmd(0x24, 0x002F);
            Cmd(0x25, 0x0057);

            //VCOM offset
            Cmd(0x23, 0x008D); //for flicker adjust

            //power on
            Cmd(0x18, 0x0036);
            Cmd(0x19, 0x0001); //start osc
            Cmd(0x01, 0x0000); //wakeup
            Cmd(0x1F, 0x0088);
            Thread.Sleep(5);
            Cmd(0x1F, 0x0080);
            Thread.Sleep(5);
            Cmd(0x1F, 0x0090);
            Thread.Sleep(5);
            Cmd(0x1F, 0x00D0);
            Thread.Sleep(5);

            //color selection
            Cmd(0x17, 0x0005); //0x0003=4K (2 pixels = 3 bytes)
                               //0x0005=65k (1 pixel= 2 bytes)
                               //0x0006=262k (1 pixel = 3 bytes)

            //panel characteristic
            Cmd(0x36, 0x0000);

            //display on
            Cmd(0x28, 0x0038);
            Thread.Sleep(40);
            Cmd(0x28, 0x003C);


            Cmd(0x16, 0x00A8); //MY=1 MX=0 MV=1 ML=0 BGR=1

            Area(0, 0, (LCD_WIDTH - 1), (LCD_HEIGHT - 1));
        }


        /// <summary>
        /// In de 64k kleuren mode, is R en B een 5 bit waarde, en G een 6
bit waarde
        /// De volgorde van H -> L
        /// RRRRR GGGGGG BBBBB
        /// </summary>
        /// <param name="R"></param>
        /// <param name="G"></param>
        /// <param name="B"></param>
        /// <returns></returns>
        ushort RGB(byte R, byte G, byte B)
        {
            return (ushort)((R & 0x1F) << 11 | (G & 0x3F) << 5 | (B &
0x1F));
        }

    }
}

I can draw into the lcd.
But I want use your class becouse is complete!!

af6767 2011-04-08 07:37:53 Link
Ok, but the original class is from Nicolas. I've only made some changes.
I will post it in this thread todays evening.
But first, you have to update your netduino to firmware 4.1.1.beta7!
this is the last beta version postet on netduino forum.
This firmware is used for the spi and fixes some errors.

cu
   Andreas

Martino 2011-04-08 13:46:35 Link
THANKS!!!!!
I have upgrade netduino firmware and the lcd run correct!!

af6767 2011-04-09 00:35:13 Link
That's good :-)
Do you need the lcd class allready ?

cu
   Andreas

Martino 2011-04-09 01:14:29 Link
Yes!!!
I want to make a button like a icon but is hard to make the icon.

Martino 2011-04-10 21:20:42 Link
Hi,
another day another problem! :)
Sometimes vat tp.pressure return 230-238-238 and I not have touch. This
problem is a real problem when I try to calibrate, becouse the lcd finish
the calibration void before touched.

af6767 2011-04-11 07:55:15 Link
Attachment: Test.zip (16.63 KB)
Hi,

try this classes. they are only for test, not optimized.
if problems continue, we speak about the same code.

good luck :-)
   Andreas

Martino 2011-04-11 12:56:13 Link
Sorry but I don't have found  Falmer.SPOT; dll in the web.

af6767 2011-04-11 14:36:10 Link
This is my Namespace.
Change the Namespace of each file in the Test.zip to a simular Namespace
like 'Test' or you have to add the files to your project over the VS IDE.
If you only copy the files, the Namespace could not be find.

netduino user 2011-04-18 14:25:23 Link
Maybe also interesting:
http://forums.netduino.com/index.php?/topic/1484-28-tft-display-with-tou...

1011 2011-08-09 16:21:52 Link
Hallo,

mir würde es sehr helfen wenn Jemand ein funftionierendes Projekt einstellt
in dem ersichtlich ist wie die Klasse einzubinden bzw. angesprochen wird
ohne erst alle möglichkeiten durchprobieren zu müssen.

Wäre echt super und würde mir sehr helfen.

wuliwux 2011-10-02 02:24:50 Link
Hallo leute,

erstmal extrem coole sache das ganze...

hat von euch jemand die firmware 4.1.1.beta7 ? leider finde ich die im
netduino Forum nicht.

@af6767 / andreas
hast du deine Klassen einer weiterentwicklung unterzogen?
wenn ja gibt es vielleicht eine neuere Version für uns... ;-)

Danke im voraus!

lg wuliwux

af6767 2011-10-04 15:18:53 Link
@wuliwux
Ein wenig schon, aber nur noch für GHI FEZ nicht mehr für netduino, sorry.

cu
 andreas

wuliwux 2011-10-04 20:03:22 Link
und hättest du vielleicht die firmware 4.1.1.beta7 noch wo rumliegen?

aber die GHI FEZ geschichte hört sich auch spannend an... ;-)

Danke im Voraus!

lg

Reply

Name
eMail (not visible)
Subject (no text only in upper case; no HELP, URGENT...)
Text
HTML tags are not supported and links are generated automatically if they start with http or ftp.
Please submit long source code or log files as attachment (only registered users).
Please enter the number 9582