Main Site Documentation

FEZ Panda III and TFT 2.3 Display


#1

Dear All,

I have a FEZ Panda III board and a TFT 2.3 LCD Shied V3.

In forum support, https://www.ghielectronics.com/support/netmf , I searched for a Panda III <===> Display Example and opted the “TOUCH” section. I tried to write the below code sample. And getting this error.

using System;
using Microsoft.SPOT;
using Microsoft.SPOT.Input;
using Microsoft.SPOT.Presentation;
using Microsoft.SPOT.Presentation.Media;
using Microsoft.SPOT.Touch;
namespace Micro_TFTDisplay
{
public class Program : Application
{
private Bitmap lcd;
public static void Main()
{
Debug.Print(Resources.GetString(Resources.StringResources.String1));

        Program app = new Program();

        app.Run();
    }

    public Program()
    {
        this.lcd = new Bitmap(SystemMetrics.ScreenWidth, SystemMetrics.ScreenHeight);

        Touch.Initialize(this);

        this.MainWindow = new Window();

        this.MainWindow.TouchDown += MainWindow_TouchDown;
        this.MainWindow.TouchUp += MainWindow_TouchUp;
        this.MainWindow.TouchMove += MainWindow_TouchMove;
    }

    private void MainWindow_TouchMove(object sender, TouchEventArgs e)
    {
        Debug.Print("Touch move at (" + e.Touches[0].X.ToString() + ", " + e.Touches[0].Y.ToString() + ")");

        this.lcd.DrawEllipse(Colors.Blue, e.Touches[0].X, e.Touches[0].Y, 5, 5);
        this.lcd.Flush();
    }

    private void MainWindow_TouchUp(object sender, TouchEventArgs e)
    {
        Debug.Print("Touch up at (" + e.Touches[0].X.ToString() + ", " + e.Touches[0].Y.ToString() + ")");
    }

    private void MainWindow_TouchDown(object sender, TouchEventArgs e)
    {
        Debug.Print("Touch down at (" + e.Touches[0].X.ToString() + ", " + e.Touches[0].Y.ToString() + ")");
    }
}

}

Error is
An unhandled exception of type ‘System.NotSupportedException’ occurred in Microsoft.SPOT.Touch.dll at
line
Touch.Initialize(this);

Attaching the touch screen images and IC details.

Ramb


#2

OR

PANDA III won’t support TFT?

TFT and Panda II says something like that. Or was it a issue with Panda II and PANDA III solved?

Or

Do I need to work with SPI protocol here?

Ramb


#3

If this TFT is buggy, I am happy to buy a new LCD display which will be supported by PANDA III. Any suggestion please, which is available in Amazon?

Will these work with Panda III?

OR

https://www.itead.cc/itead-2-8-tft-lcd-touch-shield-v2.html

Ramb


#4

None of the native graphics capabilities that your code uses will work on a Panda3 and an SPI based device. Panda3 doesn’t have the memory to be able to do this so GHI haven’t implemented full compatibility for the standard parallel LCD features that the G120 does.

But all is not lost. You can write your own driver for whatever touch sensor your shield has if you need it. I haven’t seen one done that works universally but you may find one depending on what your display has. And if your screen is ILI9341you can use https://github.com/veccsolutions/Vecc.Netduino.Drivers.Ili9341 in netmf on Panda3


#5

Dear Brett,

Thanks. I did one thing. Downloaded the https://github.com/veccsolutions/Vecc.Netduino.Drivers.Ili9341 based projects. Found that there is a dll and console application.Console application is for Secretlabs based hardware. I am using FEZ panda III. So I took the dll project only to my Panda based application solution. And added reference. So, when I flash my Panda based application to FEZ panda III , this dll (driver of Ili9341 ) will also flash to board.That is what my understanding.

After that I tried basic applications in NET MF support documentation. Still I am seeing a blank white screen. Do I need to register the driver dll? Is there any command for that?

This is the code I tried

using System;
using Microsoft.SPOT;
using Microsoft.SPOT.Input;
using Microsoft.SPOT.Presentation;
using Microsoft.SPOT.Presentation.Media;
using Microsoft.SPOT.Touch;
using GHI.Processor;
using Microsoft.SPOT.Hardware;
using Vecc.Netduino.Drivers.Ili9341;
 

namespace Micro_TFTApp3
{
    public class Program
    {
        public static void Main()
        {
            Debug.Print(Resources.GetString(Resources.StringResources.String1));
            Display.Populate(Display.GHIDisplay.DisplayCP7);
            //if (Display.Save())
            //    PowerState.RebootDevice(false);
            Bitmap lcd = new Bitmap(SystemMetrics.ScreenWidth, SystemMetrics.ScreenHeight);
            lcd.DrawLine(Colors.Green, 1, 20, 20, 40, 40);
            lcd.DrawEllipse(Colors.Blue, 5, 5, 5, 5);
            lcd.Flush();
        }
    }
}

#6


this should help you


#7

We already provide details and a serial display example for TinyCLR. Have you seen the new documents?


#8

No. I am new to the forum. I will search in TinyCLR branch.


#9

http://docs.ghielectronics.com/tinyclr/intro.html

http://docs.ghielectronics.com/tinyclr/accessories/adafruit_display_shield.html


#10

Right now I am using vs2013 and netmf. So for using lcd display app, i need to use tinyclr and vs2017!!! :disappointed_relieved:


#11

You can use NETMF and VS2013 but why would you want to do that? Why not use the latest and greatest?


#12

The reason is,

  1. I don’t want to use TinyCLR now. I am still planning to go ahead with Micro.NETfraework. My business demands it. Also I can’t move to VS2017. Customer not allowing.

So, my question is, if I using SPI communication, can I display BMPs or any sort of graphics in my TFT board or any other recommended board using Panda III + .NET micro framework

What about this link?

I don’t need conversion to Cobra. But can I use this sample code in Panda III? How will be the pin connections? Any reference?


#13

You will need SPI display. You will need to connect the SPI pins - that’s trivial. You will be able to display BMPs, within the limitations of the G80 (memory and bitmap size) For a small amount of display work, totally possible with the library and resources I pointed you to earlier. For a decent amount of display work, its going to be a challenge (but still likely achievable, just more work).


#14

Dear Brett and all

I spent some time in the TFT 2.8 display and finally it worked with Adruino Mega. I was struggling to find it’s driver. So, since it is working with Adruino, and I noted the PIN connection exactly same for Panda III, can I make it working in Panda III? I don’t think Adruino communicates with SPI. When I worked with Adruino mega, it was not SPI. So what about PANDA III?

Brett, you mentioned

And if your screen is ILI9341you can use https://github.com/veccsolutions/Vecc.Netduino.Drivers.Ili93412 in netmf on Panda3

But I got

TFT LCD test
Using Adafruit 2.4" TFT Breakout Board Pinout
TFT size is 240x320
Found UC8230 LCD driver

in Adruino serial monitor. And the output is

So, do we have any equivallent c# driver in gitHub? How can I shared the adruino driver code here? Is the forum rules allow it to post adruino code here?

Ramb


#15

I wont use tinyCLR because it is not matured enough to include all my requirements and customer’s Panda III’s firmware is Microsoft micro SDK


#16

As I said in private message, the device you have is not directly transportable to the SPI connection to ILI9341, so the driver at https://github.com/veccsolutions/Vecc.Netduino.Drivers.Ili9341 may be a starting point for you, but it’s not just going to work.

What are you trying to achieve? If you have a customer with a Panda3, I’d suggest you buy a different display that the driver will work with so you can focus on the application not the driver. Much simpler to start from a place you expect to work instead of trying to convert a driver from Arduino into C# on netmf.


#17

So here’s a few tidbits. I’m adding this here publicly so others can gain from it and contribute as well.

I’m not going to delve deeply into Arduino code here, but you have Arduino working, and you have the libraries it uses, so it’s possible you can transform that into a working solution here - whether it’s as effective as the Arduino or not, is yet to be seen.

The example code I’ve seen includes TWO libraries that duplicate some functionality or interact in some way I’m not going to try to unravel for you - but you will need to! This uses the Adafruit TFTLCD library (it also uses the Adafruit GFX library which is the core graphics components there). There’s a comment about checking Adafruit_tftlcd.h for hardware definitions - over to you on that one :wink: It also uses the MCUFriend_KBV display library. The sample code that I expect you’ve used for the display above is the DisplayStrong.ino example. The “tft” object is created as the MCUFriend_kbv object - so there’s a high likelihood you’ll need to dig in to that (but also worth noting is that driver has been written to detect different displays, so likely has much more complexity than you need, assuming you have only this display). You might try simplifying an example on Arduino to only the Adafruit libraries and see if that works, as that may be a simpler place to start from - but you’ll probably need to read the code.

The next thing you need to focus on is changing from Arduino pin manipulation to netmf. You’ll need to dive in to the pin_magic.h code from the Adafruit lib to see how they do a lot of (fast) pin manipulation, but unfortunately that’s not going to easily be achievable for what you have as the hardware capability and what netmf exposes aren’t the same - you’ll have to accept that you’ll have to move back to more single pin manipulation via setting it to 0 and 1. But essentially, any time a pin is manipulated you need to alter that to be a netmf pin action. You’ll see calls like “CS_IDLE”, “CS_ACTIVE”, “CD_COMMAND”, “WR_IDLE”, “RD_IDLE” etc, which you’ll need to emulate on your assigned pins.

From there you need to see how other code (eg the ILI9341 driver) creates and manages bitmaps and fonts, and sends data to the screen and see how transportable that approach and perhaps even some of that code is for your use case.

And then eventually you could get moving towards actual coding of an app.

An alternative approach would be to look at the datasheet and command structure and start from scratch - may in fact give you quicker results. I suspect you could make a pretty quick start at the driver and send appropriate controls to prove you can get it working.

To be “full featured”, you will need a decent amount of work and time, no matter where you start from. Do I still think this is possible? Yes, still possible. Will it work like the Arduino? It won’t be as fast, and there’s a lot of unknowns about how complex the code you have as your starting point is, and where you can best spend your effort.

One other parting thought. It’s completely possible to use BOTH the Arduino and Panda in a solution that will be quicker to create, but may not meet your needs (but it’s quick). You essentially write a serial-based app on the Arduino that takes graphics/text primitives from a serial stream, and writes them to the display. Then the Panda is for “higher level” functions and it sends the data to the Arduino. Without knowing anything about your end application and goals, I have no idea if that’s a possible approach, or if at that point you should just say that you should just use the Arduino on it’s own, but I did want to mention it in case it was a valuable option.

Code is code, you can share it where you like. But the easiest way is to host it somewhere else (even bitbucket is a reasonable dumping point) and just point people to it - if they’re in a position to help, they’ll head over there and look, and if uninterested they won’t. I can give you one more tip in this though, if you give people your whole problem (make this display work on Panda) then you’ll only get a certain level of feedback - if you come with small well defined problems (how do I do bit manipulation in C#/NETMF like this code in Arduino C++), you’ll get a much more precise answer.


#18

Dear Ben,

My client sent a new 9341 board

Exactly same.

Not writing a driver. (I wish but I will have to improve my skills). I hope I can connect as Adruino in Panda III.
I will check it.

Only confusion is in this one

        var tft = new Driver(isLandscape: true,
                             lcdChipSelectPin: Pins.GPIO_PIN_D5,
                             dataCommandPin: Pins.GPIO_PIN_D6,
                             backlightPin: Pins.GPIO_PIN_D7);

#19

You always hire on of this community’s experts to do it for you. GHI Electronics’ consulting is another option.


#20

How can I get that service? Also winding up this thread from my end before you shoot me…:stuck_out_tongue_closed_eyes: