tweedie
Posts: 19
Joined: Wed Mar 04, 2015 11:32 am

TFT 3.2 and display query

Tue May 19, 2015 11:41 am

Finally got the win10 IoT, and deployed a couple of apps to it. Whilst it works fine with HDMI port, but confused about how TFT would work getting them to display it.

I managed to get to my waveshare 3.2 v4 device working and displaying a couple of coloured blocks on TFT, but that is passing commands + bytes of data to draw pixels to certain position and not even related to what is on the page view.

so, rather then drawing by commands, how do I get it to "draw" from a xaml.controls.page? A couple of ideas going round my head and not sure what should be the correct way!
Should I....
1. catch the render/onpaint event (if it exist?) on the page object and issue commands to draw a pixel on TFT
2. create a new display device driver / universal window driver? (gulp!)
3. code something similar to a dlna/miracast/project my screen client and server on same app? (ie project the page and a receiver to draw onto TFT by drawing pixels?)
4. somehow read from the hdmi memory block address and display it to TFT by drawing pixels?

Just curious really what the best way. Any advice?

jtanner_msft
Posts: 105
Joined: Fri May 01, 2015 7:12 pm

Re: TFT 3.2 and display query

Tue May 19, 2015 8:39 pm

Based upon previous investigation I believe you would have to choose option #2 - Write your own display driver for Windows 10 IoT Core that knows how to talk to your TFT display.

Then all rendering would happen like it currently is for the HDMI, but now instead it would be using your display driver as the render surface.

I hope this helps.
Jonathan Tanner | Microsoft | Windows 10 IoT Core Insider Preview Support | This posting is provided 'as is' with no warranties and confers no rights.

jcdekoning
Posts: 6
Joined: Tue May 05, 2015 5:36 am

Re: TFT 3.2 and display query

Tue May 19, 2015 9:29 pm

@tweedie, are you able to share some code how you got your screen working. I tried to get a waveshare 3.5 inch screen working with spi (see post on this forum: viewtopic.php?f=105&t=109479&p=756013&) but I was unable to get the page and column adressing correctly. Meaning that I can only write pixel from the top.

Would like to see how you fixed that. Thanks!

jcdekoning
Posts: 6
Joined: Tue May 05, 2015 5:36 am

Re: TFT 3.2 and display query

Wed May 20, 2015 5:55 pm

@jtanner_msft But if we need to write our own display driver, can we find somewhere which methods should be implemented. I mean there is some kind of interface defines so Windows knows how to call the driver.

And are drivers for Windows IoT different than Windows 10? Or what about Windows Display Drivers written for Windows 8. If I would find an example of that one, would it help me writing a custom driver for Windows 10 IoT?

jtanner_msft
Posts: 105
Joined: Fri May 01, 2015 7:12 pm

Re: TFT 3.2 and display query

Wed May 20, 2015 6:50 pm

This link should serve as a starting point for you in developing a display driver for Windows 10:
https://msdn.microsoft.com/en-us/librar ... s.85).aspx

(Trying to fix the above link)
So long as that driver meets the requirements for being a 'Universal Driver' then it should also work on Windows 10 IoT Core.

A display driver that worked on Windows 8 / 8.1 might be able to work on Win 10, but a few changes might be required to be a 'Universal Driver'.

Developing a display driver can take a bit of work, so not something to enter into lightly.

I hope that helps.
Last edited by jtanner_msft on Wed May 20, 2015 8:14 pm, edited 1 time in total.
Jonathan Tanner | Microsoft | Windows 10 IoT Core Insider Preview Support | This posting is provided 'as is' with no warranties and confers no rights.

GerritV
Posts: 91
Joined: Fri May 01, 2015 4:16 pm
Location: St Catharines, ON
Contact: Website

Re: TFT 3.2 and display query

Wed May 20, 2015 7:06 pm

The link that Jonathan posted was a bit munged, it is: https://msdn.microsoft.com/en-us/librar ... e/dn932171
The Windows (pre 10) WDK (Windows Driver Toolkit) with examples, docs etc is here: https://msdn.microsoft.com/en-ca/window ... e/ff960953. there is a Windows 10 link on top bar there as well.

Gerrit

tweedie
Posts: 19
Joined: Wed Mar 04, 2015 11:32 am

Re: TFT 3.2 and display query

Wed May 20, 2015 10:01 pm

@jcdekoning, I haven't got your exact TFT as yours, but looking at your drawColor function where you are setting the column and page, I noticed you doing

DisplaySendCommand(new byte[] { 0x2A });
DisplaySendData(new byte[] { (byte)(startX >> 8), (byte)(startX >> 0xff), (byte)(endX >> 8), (byte)(endX >> 0xff) });

the difference I have is that I don't ">> 0xff" for the 2 and 4 argument. This is my positioning routine
private void addressSet(short x1, short y1, short x2, short y2)
{
DisplaySendCommand(0x2a);
DisplaySendData(new byte[] { (byte)(x1 >> 8), (byte)x1, (byte)(x2 >> 8), (byte)x2 });

DisplaySendCommand(0x2b);
DisplaySendData(new byte[] { (byte)(y1 >> 8), (byte)y1, (byte)(y2 >> 8), (byte)y2 });

DisplaySendCommand(0x2C);
}
might that be the problem? I will upload my git version later so you can see how I did mine.

jcdekoning
Posts: 6
Joined: Tue May 05, 2015 5:36 am

Re: TFT 3.2 and display query

Thu May 21, 2015 5:42 pm

@tweedie. Tried your suggestion but with no effect. Problemly is there something wrong with the initalization commands. There are no official datasheets available for these displays so that makes it more diffcult.

Which SPI mode are you using btw?

Writing a display driver should probably be done in c++. I don't have any experience with writing drivers. There is an example project for a driver (https://ms-iot.github.io/content/win10/ ... verLab.htm). But here they are creating a driver for a complete new kind of hardware device. A display driver is a known hardware type, so it should follow some predefined rules / implement predefined methods.I would like to read some documentation which describes which methods should be implemented to redirect the graphics to the display with the use of SPI. Did not found something like that yet.

jtanner_msft
Posts: 105
Joined: Fri May 01, 2015 7:12 pm

Re: TFT 3.2 and display query

Thu May 21, 2015 6:05 pm

Before anyone spends a few weeks / months trying to implement a display driver for their SPI device I would suggest you hold off for the moment. There might be a better and simpler option eventually, but for the moment I would just say hold off from doing any display driver work unless you want to get a particular video card working with your Rpi2 or MBM device. Once I have more information that I can share I will.
Jonathan Tanner | Microsoft | Windows 10 IoT Core Insider Preview Support | This posting is provided 'as is' with no warranties and confers no rights.

GerritV
Posts: 91
Joined: Fri May 01, 2015 4:16 pm
Location: St Catharines, ON
Contact: Website

Re: TFT 3.2 and display query

Thu May 21, 2015 7:42 pm

jtanner_msft wrote:Before anyone spends a few weeks / months trying to implement a display driver for their SPI device (snipped).
And deny them all that learning pleasure? :lol: Device drivers can be soooo much fun regardless of the OS.

Gerrit

tweedie
Posts: 19
Joined: Wed Mar 04, 2015 11:32 am

Re: TFT 3.2 and display query

Thu May 21, 2015 10:05 pm

@jcdekoning as promised, my source if any help. https://github.com/DarrenTweedale/waveshare32bIOT.git. Its not pretty and optimized but at least it allows to set the position before drawing some box, pixels, and lines. Can rotate display, but can't do text yet as can't seem to issue an array of screen data (ie screen buffer) to the screen as it keeps crashing.

@Gerrit Its been a long time since I touched c++, never mind the fact I can't even work out whether it should be a kernel or user space driver! But you right, it will be fun!

@jtanner_msft Sounds like you know something interesting coming up in the pipeline! do keep us up to date when you know.

jcdekoning
Posts: 6
Joined: Tue May 05, 2015 5:36 am

Re: TFT 3.2 and display query

Sat May 23, 2015 9:38 am

@tweedie. Thanks for sharing your code. I tried it out by changing some initialization instructions but still setting the page and column address is not working correctly. Seems like I miss maybe some kind of initialization command. I will search further (or look for another display) to see if this solves the problem.

Andy725
Posts: 2
Joined: Mon Jun 08, 2015 2:43 pm

Re: TFT 3.2 and display query

Tue Jun 09, 2015 1:45 pm

Adafruit posted some details about their PiTFT screen.
I hope some of this helps ;)

http://forums.adafruit.com/viewtopic.ph ... 25#p380336

tweedie
Posts: 19
Joined: Wed Mar 04, 2015 11:32 am

Re: TFT 3.2 and display query

Wed Jun 10, 2015 10:08 am

Andy725 wrote:Adafruit posted some details about their PiTFT screen.
I hope some of this helps ;)

http://forums.adafruit.com/viewtopic.ph ... 25#p380336
Very interesting shall have a look at those. though adafruit comment "there is no way for us to develop the device driver for windows 10, it must be done by/with microsoft" - don't think that is true. you can create your own device drivers yourself.

Andy725
Posts: 2
Joined: Mon Jun 08, 2015 2:43 pm

Re: TFT 3.2 and display query

Wed Jun 10, 2015 10:37 am

I agree it would be stupid for Microsoft not to allow people to develop drivers.
I think adafruit just don't want to invest a little time to develop a driver.

Maybe if your interested, together we can look at writing a driver?

GerritV
Posts: 91
Joined: Fri May 01, 2015 4:16 pm
Location: St Catharines, ON
Contact: Website

Re: TFT 3.2 and display query

Wed Jun 10, 2015 12:14 pm

Clearly it is a case of Adafruit not wanting to develop a driver so they didn't look very far into the available options on Windows 10. They also do not provide one for *nix.

https://msdn.microsoft.com/en-us/librar ... e/dn384105 is the intro to writing User Mode drivers for Windows 8.1 and later. Still not trivial and not for the faint-of-heart but more doable than kernel mode drivers.

Gerrit

Return to “Windows 10 for IoT”