Panda II and Seedstudio TFT touchscreen shield

I’m VERY new to NetMF, but not so totally new to C#. I have some pretty good Arduino, Basic Stamp, PicAxe and Propeller experience. Can someone point me toward some demo code for using the Seeed TFT touchscreen shield with the Panda II? Repeated efforts with the forum search functionality were unproductive.

Did you come across this in your searching?

I did not see that. That code however gacks on “using GHIElectronics.NETMF.FEZ;” and I’m unsure which reference I need to add. Nothing in the reference list looks like that. Do I not have the right SDK installed?

Please post a link to the display. Is it parallel or SPI? Are you able to blink LEDs and do basic things?

Welcome to the community.

Here’s the shield:

I am able to flash LEDs and do such things. I was able to hook up and use their relay shield (… Although the pins needed to be remapped…

Relay 1 = Pin 19 (not 7)
Relay 2 = Pin 7 (not 6)
Relay 3 = Pin 15 (not 5)
Relay 4 = Pin 2 (not 4)

Probably old news to you all though.

It is parallel. Please check the fez touch code on codeshare.

Thanks Gus. When I access any of that code (such as it gacks on “[em]using GHIElectronics.NETMF.FEZ;[/em]” and I don’t know which reference to add. I downloaded the sdk from here: … Is that the right SDK for my Panda II board? When I go to add the reference I see GHIElectronics.Gadgeteer.FEZHydra and GHIElectronics.Gadgeteer.FEZSpider but no GHIElectronics.NETMF.FEZ. Sorry if I’m being dense.

@ G-Man - Gus will correct me if I am wrong since I never worked with the Panda devices. As far as I understand, Panda II is 4.1 only, so you need to install the 4.1 SDK (It can be run side by side with 4.2)

You’re correct. I just downloaded 4.1 on a lark and sure enough it’s there. Thanks and sorry for being a dense newb y’all.

Ok, I’ve gotten it working… somewhat.

I used the code available here:

Here’s what I get:

The datasheet for the shield provides the following pin-out:

D2 - LCD data bit 8.
D3 - LCD data bit 9.
D4 - LCD data bit 10.
D5 - LCD data bit 11.
D6 - LCD data bit 12.
D7 - LCD data bit 13.
D8 - LCD data bit 14.
D9 - LCD data bit 15.
D10 - LCD CS pin, active low.
D11 - LCD RS pin.
D12 - LCD WR pin.
D13 - LCD RD pin.
D14(A0) - Touch Screen Y-.
D15(A1) - Touch Screen X-.
D16(A2) - Touch Screen Y+.
D17(A3) - Touch Screen X+.

The code initializes the screen with the following sub routine:

                public LCDConfiguration(FEZ_Pin.Digital reset, FEZ_Pin.Digital chipSelect, FEZ_Pin.Digital RS, FEZ_Pin.Digital backLight, FEZ_Pin.Digital[] dataPins, FEZ_Pin.Digital writePin, FEZ_Pin.Digital readPin)

This module however does not have a reset or back light pin.

So I simply did not change the assignment of those pins and allowed them to stay where they were (23 & 24). Here’s how I modified the example initiation code:

FEZ_Components.FEZTouch.LCDConfiguration lcdConfig = new FEZ_Components.FEZTouch.LCDConfiguration( 
                new FEZ_Pin.Digital[8] { FEZ_Pin.Digital.Di2, FEZ_Pin.Digital.Di3, FEZ_Pin.Digital.Di4, FEZ_Pin.Digital.Di5, FEZ_Pin.Digital.Di6, FEZ_Pin.Digital.Di7, FEZ_Pin.Digital.Di8, FEZ_Pin.Digital.Di9 },


So what am I doing wrong?

The controller used on your display maybe different. I suggest you find what code seeed provided, probably arduino, then convert it.

The controller is indeed different. The Fez Touch uses an ILI9325 controller the Seeedstudio shield uses an ST7781R controller. The instruction sets are quite similar, but there are some differences. I did some research and was able to produce the following result:

This was achieved by altering the initiation code from:

                //************* Start Initial Sequence **********//
                WriteRegister(0x0001, 0x0100); // set SS and SM bit
                WriteRegister(0x0002, 0x0200); // set 1 line inversion
                WriteRegister(0x0003, 0x0030); // set GRAM write direction and BGR=0.
                WriteRegister(0x0004, 0x0000); // Resize register
                WriteRegister(0x0008, 0x0207); // set the back porch and front porch
                WriteRegister(0x0009, 0x0000); // set non-display area refresh cycle ISC[3:0]
                WriteRegister(0x000A, 0x0000); // FMARK function
                WriteRegister(0x000C, 0x0000); // RGB interface setting
                WriteRegister(0x000D, 0x0000); // Frame marker Position
                WriteRegister(0x000F, 0x0000); // RGB interface polarity
                //*************Power On sequence ****************//
                WriteRegister(0x0010, 0x0000); // SAP, BT[3:0], AP, DSTB, SLP, STB
                WriteRegister(0x0011, 0x0007); // DC1[2:0], DC0[2:0], VC[2:0]
                WriteRegister(0x0012, 0x0000); // VREG1OUT voltage
                WriteRegister(0x0013, 0x0000); // VDV[4:0] for VCOM amplitude
                WriteRegister(0x0007, 0x0001);
                Thread.Sleep(200); // Dis-charge capacitor power voltage
                WriteRegister(0x0010, 0x1690); // SAP, BT[3:0], AP, DSTB, SLP, STB
                WriteRegister(0x0011, 0x0227); // Set DC1[2:0], DC0[2:0], VC[2:0]
                Thread.Sleep(50); // Delay 50ms
                WriteRegister(0x0012, 0x000D); // 0012
                Thread.Sleep(50); // Delay 50ms
                WriteRegister(0x0013, 0x1200); // VDV[4:0] for VCOM amplitude
                WriteRegister(0x0029, 0x000A); // 04  VCM[5:0] for VCOMH
                WriteRegister(0x002B, 0x000D); // Set Frame Rate
                Thread.Sleep(50); // Delay 50ms
                WriteRegister(0x0020, 0x0000); // GRAM horizontal Address
                WriteRegister(0x0021, 0x0000); // GRAM Vertical Address
                // ----------- Adjust the Gamma Curve ----------//
                WriteRegister(0x0030, 0x0000);
                WriteRegister(0x0031, 0x0404);
                WriteRegister(0x0032, 0x0003);
                WriteRegister(0x0035, 0x0405);
                WriteRegister(0x0036, 0x0808);
                WriteRegister(0x0037, 0x0407);
                WriteRegister(0x0038, 0x0303);
                WriteRegister(0x0039, 0x0707);
                WriteRegister(0x003C, 0x0504);
                WriteRegister(0x003D, 0x0808);
                //------------------ Set GRAM area ---------------//
                WriteRegister(0x0050, 0x0000); // Horizontal GRAM Start Address
                WriteRegister(0x0051, 0x00EF); // Horizontal GRAM End Address
                WriteRegister(0x0052, 0x0000); // Vertical GRAM Start Address
                WriteRegister(0x0053, 0x013F); // Vertical GRAM Start Address
                WriteRegister(0x0060, 0xA700); // Gate Scan Line
                WriteRegister(0x0061, 0x0001); // NDL,VLE, REV

                WriteRegister(0x006A, 0x0000); // set scrolling line
                //-------------- Partial Display Control ---------//
                WriteRegister(0x0080, 0x0000);
                WriteRegister(0x0081, 0x0000);
                WriteRegister(0x0082, 0x0000);
                WriteRegister(0x0083, 0x0000);
                WriteRegister(0x0084, 0x0000);
                WriteRegister(0x0085, 0x0000);
                //-------------- Panel Control -------------------//
                WriteRegister(0x0090, 0x0010);
                WriteRegister(0x0092, 0x0000);
                WriteRegister(0x0007, 0x0133); // 262K color and display ON


                WriteRegister(0x0001, 0x0100);
                WriteRegister(0x0002, 0x0700);
                WriteRegister(0x0003, 0x1030);
                WriteRegister(0x0004, 0x0000);
                WriteRegister(0x0008, 0x0302);

                WriteRegister(0x000A, 0x0000);
                WriteRegister(0x000C, 0x0000);
                WriteRegister(0x000D, 0x0000);
                WriteRegister(0x000F, 0x0000);

                WriteRegister(0x0030, 0x0000);
                WriteRegister(0x0031, 0x0405);
                WriteRegister(0x0032, 0x0203);
                WriteRegister(0x0035, 0x0004);
                WriteRegister(0x0036, 0x0B07);
                WriteRegister(0x0037, 0x0000);
                WriteRegister(0x0038, 0x0405);
                WriteRegister(0x0039, 0x0203);
                WriteRegister(0x003c, 0x0004);
                WriteRegister(0x003d, 0x0B07);
                WriteRegister(0x0020, 0x0000);
                WriteRegister(0x0021, 0x0000);
                WriteRegister(0x0050, 0x0000);
                WriteRegister(0x0051, 0x00ef);
                WriteRegister(0x0052, 0x0000);
                WriteRegister(0x0053, 0x013f);

                WriteRegister(0x0060, 0xa700);
                WriteRegister(0x0061, 0x0001);
                WriteRegister(0x0090, 0x003A);
                WriteRegister(0x0095, 0x021E);
                WriteRegister(0x0080, 0x0000);
                WriteRegister(0x0081, 0x0000);
                WriteRegister(0x0082, 0x0000);
                WriteRegister(0x0083, 0x0000);
                WriteRegister(0x0084, 0x0000);
                WriteRegister(0x0085, 0x0000);
                WriteRegister(0x00FF, 0x0001);
                WriteRegister(0x00B0, 0x140D);
                WriteRegister(0x00FF, 0x0000);

                WriteRegister(0x0007, 0x0133);

                WriteRegister(0x0010, 0x14E0);

                WriteRegister(0x0007, 0x0133);

Now the gamma settings are still not quite right… but at least you have a starting point. If you find the initialization settings that work before I do, please share them here.

Shazam, I found it! Simply change the line in the new initialization sequence that reads:

WriteRegister(0x0003, 0x1030);

to make it read:

WriteRegister(0x0003, 0x0030);

and your monkey will not be blue any more!

Now to figure out the touch screen input part.

Well done. Maybe when done post the code on codeshare as well.

G-Man, this is great, did you ever complete the touch code?

No I didn’t… I got frustrated with it and when that happens one of my many other hobbies always arises to tempt me away… I will eventually get back to it though as I will eventually be itching for a puzzle to solve…