Jump to content
jscrane

[Energia Library] Port of UTFT library

Recommended Posts

Hi,

I have ported Henning Karlsen's UTFT library to Energia on Stellaris. You can find the code here:

 

https://github.com/jscrane/UTFT-Energia

 

This code shows how to do reasonably fast graphics using GPIOPinWrite() instead of digitalWrite().

 

It is a fork of the fine work done by Andresv, described on the 43oh forum here: http://forum.43oh.com/topic/3633-utft-library-utouch-henning-karlsen/

 

Cheers,

Steve

Share this post


Link to post
Share on other sites

If I had to add support for this board, I would do something like:

 

* make a new config for HY28A, duplicating ILI9320 (in tft_drivers dir)

* add a case statement for it to UTFT::UTFT setting display_transfer_mode=1

* add a new transfer mode for hardware SPI (have a look at Adafruit's ST7735 library, I think this does both hardware and software SPI).

 

The first two steps should give you a working setup in any case.

 

Cheers,

Steve

Share this post


Link to post
Share on other sites

jscrane - YOU ARE THE MAN!!!

 

Thank you!!!

 

Tested one LCD, 8 bit mode last night...works just fine.  Going to test the same in 16 bit and see how much the speed improves.  Thank you again.

Share this post


Link to post
Share on other sites

Ok, so this seems to work really well.

 

So far I have only 1 issue.  I can get 8 bit to work on any of the TFT's that I have.  I can not get 16 bit to work on any of them.

 

Using this library (downloaded straight from K. H. webiste) I am able to use 16 bit on ChipKit Uno32 and Arduino without any issues. 

 

Has anyone gotten this port of the library to work with a 16 bit display on the StellarPad?

 

L293D

Share this post


Link to post
Share on other sites

Ok, so this seems to work really well.

 

So far I have only 1 issue.  I can get 8 bit to work on any of the TFT's that I have.  I can not get 16 bit to work on any of them.

 

Using this library (downloaded straight from K. H. webiste) I am able to use 16 bit on ChipKit Uno32 and Arduino without any issues. 

 

Has anyone gotten this port of the library to work with a 16 bit display on the StellarPad?

 

L293D

 

Hi,

You are right that there is a problem with 16-bit mode and I just fixed a bug where the bytes were written in the wrong order.

 

However this still doesn't allow 16-bit mode to work! Maybe the GPIOs I picked are used for something else on the Stellarpad?

(I'm using PF_2, PF_3, PD_2, PD_3 and PE_0 to PE_3 for DB0-DB7.)

 

Steve

Share this post


Link to post
Share on other sites

I even tried changing the pins (yes some of the pins you chose are used for the onboard LED for example).  I had already found the issue with them being written in the wrong order, and just like you, no luck.  I will keep playing with it.  If you happen to find a solution, please let me know.  Thank you again.

Share this post


Link to post
Share on other sites

I even tried changing the pins (yes some of the pins you chose are used for the onboard LED for example).  I had already found the issue with them being written in the wrong order, and just like you, no luck.  I will keep playing with it.  If you happen to find a solution, please let me know.  Thank you again.

 

I've done some more experimenting (in 8-bit mode) and have successfully driven my display (an S6D1121) from PE0-3 and PC4-7. When I combined that with PB0-7 (already tested in 8-bit mode) for 16-bit mode, nothing!

 

I have checked in these latest changes to github anyway, maybe you could test with your display if it's different from mine?

 

Steve

Share this post


Link to post
Share on other sites

The only thing I notice in the other HW specific files, is that in 16 bit mode, there is ALWAYS code to CLEAR the bits on the pins handling VL...for instance for the ATMega328:

case 16:
		PORTD = VH;
		cport(PORTC, 0xFC);
		sport(PORTC, (VL>>6) & 0x03);
		PORTB =  VL & 0x3F;
		pulse_low(P_WR, B_WR);
		break;

It is using the clear port and set port macro's.  That is all that I can see that is different.  Other than that...I am stumped on this one. 

Share this post


Link to post
Share on other sites

The only thing I notice in the other HW specific files, is that in 16 bit mode, there is ALWAYS code to CLEAR the bits on the pins handling VL...for instance for the ATMega328:

case 16:
		PORTD = VH;
		cport(PORTC, 0xFC);
		sport(PORTC, (VL>>6) & 0x03);
		PORTB =  VL & 0x3F;
		pulse_low(P_WR, B_WR);
		break;

It is using the clear port and set port macro's.  That is all that I can see that is different.  Other than that...I am stumped on this one. 

 

I guess this is just because sport() uses bitwise-or to set bits, so you need to clear existing bits as well...

Share this post


Link to post
Share on other sites

OK I went back to square one:

 

* Original library from HK on ATmega328p with new 16-bit display HY32D (controller SSD1289): works ok

* My latest library on same hardware: ok

* Transferred display wiring to Stellarpad: wiring D0-D7=PB0-PB7; D8-D15=PE0-3+PC4-7; RS=PA_5; WR=PA_7; CS=PA_6; RST=PD_6; RD=VREF; VCC=VREF.

 

...and it works!

 

So I guess the things you have to look out for:

* getting the controller chip right (in sketch + memorysaver.h)

* wiring the data bus correctly: PB now gets the low 8 bits (the ones which would be connected to ground in 8-bit mode)

* connecting RD high

 

Cheers,

Steve

Share this post


Link to post
Share on other sites

Nice!

 

Tell me - it is possible to add hardware SPI functionality?

I have a HY28A-LCDB -> ILI9320 with SPI only (without parallel)

I found a UTFT mod with SPI: https://github.com/corbinstreehouse/UTFT_Adafruit_22TFT

 

Please have a look at my LCD_screen Library Suite.

 

 

As at today, the following screens are supported:

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...