UTFT component? perfect for many graphic displays

Please add any feature requests for Flowcode version 6 here

Moderator: Benj

Forum rules
Only feature requests will be considered here. General questions should not be posted in this forum.
hyperion007
Posts: 528
Joined: Sat Dec 01, 2012 1:23 pm
Location: Sweden
Has thanked: 49 times
Been thanked: 101 times
Contact:

Re: UTFT component? perfect for many graphic displays

Post by hyperion007 »

Sorry but no go.

Just to clarify,

on my breakout board for the SSD1306 display I have connected it like this:
PINOUT - FC Connection
4-CS# - (CS)
5-RES# - (RST)
6-D/C# - (RS)
7-SCLK - (SCK)
8-SDIN - (SD)

Correct?
Attachments
SSD1306_BUF_PIC18F26K80.fcfx
(5.55 KiB) Downloaded 406 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: UTFT component? perfect for many graphic displays

Post by Benj »

Cheers, There must be something else I've missed, I'll have another peruse through.

Your connections look good to me.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: UTFT component? perfect for many graphic displays

Post by Benj »

Looks like I missed the final "switch on the display" 0xAF command from the initialise routine. Fingers crossed this will work.
Attachments
gLCD_SSD1306_buffered.fcpx
(7.2 KiB) Downloaded 392 times
gLCD_SSD1306.fcpx
(6.78 KiB) Downloaded 381 times

hyperion007
Posts: 528
Joined: Sat Dec 01, 2012 1:23 pm
Location: Sweden
Has thanked: 49 times
Been thanked: 101 times
Contact:

Re: UTFT component? perfect for many graphic displays

Post by hyperion007 »

Ah!

Now it turns on, but some(most?) routines are not working as they should :(

The clear display command don't work, the top "row" of 8 pixels are all on, probably from the clear display command.

The rest (next 3 rows of the display) is filled with random pixels.

Swapping the foreground and background colors in the component properties makes the top "row" pixels all OFF with the clear display command otherwise same as above.

I'm going through the other macros but the print number and print text ones don't seem to work either :(

Drawing a rectangle is working, draw a line too I think

The macros for changing foreground and background colors seems to do nothing. Changing the component properties seems to be the only way to change this.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: UTFT component? perfect for many graphic displays

Post by Benj »

Hello,

The clear function was assuming that at the end of page 0 we move automatically to page 1 which I guess is not how the hardware works.

I've had a go at fixing the clear function and the set colour functions so let me know how your getting on with this and if it's ok i'll roll out the change to the 1305 comps.
Attachments
gLCD_SSD1306.fcpx
(6.69 KiB) Downloaded 399 times
gLCD_SSD1306_buffered.fcpx
(7.21 KiB) Downloaded 393 times

hyperion007
Posts: 528
Joined: Sat Dec 01, 2012 1:23 pm
Location: Sweden
Has thanked: 49 times
Been thanked: 101 times
Contact:

Re: UTFT component? perfect for many graphic displays

Post by hyperion007 »

Now it goes 100% on when initialise but one pixel is then turned off. I would guess pixel row 0 column 16 or so.
Then nothing will work after this.

It might be easier and way more efficient if we hold off until you have these displays in your hands? (Even if I reaaaaally want these to work now now now :) )

I don't mind testing, not at all, but it makes more sense for you to try on hardware no?

hyperion007
Posts: 528
Joined: Sat Dec 01, 2012 1:23 pm
Location: Sweden
Has thanked: 49 times
Been thanked: 101 times
Contact:

Re: UTFT component? perfect for many graphic displays

Post by hyperion007 »

For the SSD1305 there are several options on how to interface them

Which would you recommend?
4-Wire SPI?
8080-8Bit?
I2C?


For the SSD1306 there was really only 4-Wire SPI available according to the datasheet for my display (ER-OLED0.91-1)
Attachments
ER-OLED0.91-2_Interfacing.pdf
(144.72 KiB) Downloaded 408 times

hyperion007
Posts: 528
Joined: Sat Dec 01, 2012 1:23 pm
Location: Sweden
Has thanked: 49 times
Been thanked: 101 times
Contact:

Re: UTFT component? perfect for many graphic displays

Post by hyperion007 »

I think we should concentrate on SSD1306 as it is a more commonly used display controller.

If you could send me a PM with the address you want me to send a display to, I'll have it out with the mail tomorrow.

/Daniel S

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: UTFT component? perfect for many graphic displays

Post by Benj »

Hello Daniel,

This address is great:

Ben Rowland
Matrix Technology Solutions Ltd
The Factory
33 Gibbet Street
Halifax
West Yorkshire
HX1 5BA
UK

As for which version to use well it depends which version you have available to purchase. Seems a lot of these controller ICs have multiple ways in (6080, 8080, I2C, SPI) but often the display manufacturers will jump on one method and only support that on the PCB.

hyperion007
Posts: 528
Joined: Sat Dec 01, 2012 1:23 pm
Location: Sweden
Has thanked: 49 times
Been thanked: 101 times
Contact:

Re: UTFT component? perfect for many graphic displays

Post by hyperion007 »

Alright, it's going out with tomorrows mail.

And I bought a bunch from http://www.buydisplay.com/

http://www.buydisplay.com/default/0-91- ... e-on-black

hyperion007
Posts: 528
Joined: Sat Dec 01, 2012 1:23 pm
Location: Sweden
Has thanked: 49 times
Been thanked: 101 times
Contact:

Re: UTFT component? perfect for many graphic displays

Post by hyperion007 »

Just thought I would let you know that I sent you my 0.91" LED SSD1306 yesterday.

Here's a photo so you can see the pin-out legend :)
Microscope_Pic_07.jpg
(1.75 MiB) Downloaded 2934 times

User avatar
RobH
Posts: 95
Joined: Wed Sep 11, 2013 7:51 pm
Has thanked: 29 times
Been thanked: 17 times
Contact:

Re: UTFT component? perfect for many graphic displays

Post by RobH »

Could you also add support for this model:

http://www.microsofttranslator.com/bv.a ... ves%2F1358

It only has 4 pins. More info on how some people got it working on Arduino here
http://forum.arduino.cc/index.php?PHPSE ... c=219419.0

Thanks!

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: UTFT component? perfect for many graphic displays

Post by Benj »

Hello,

Received the display now and will have a go at getting it working. Can you confirm what voltages you are placing onto the VDD and VBATT pins just so I can be sure of not damaging the display before I get started on the coding.

Looks like 3V3 on both pins should be ok.

Once this display is working the I2C version should be simple enough so I will look into this too.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: UTFT component? perfect for many graphic displays

Post by Benj »

Hello,

I found a couple of bugs regarding colour assignment and everything now seems to be working great.
gLCD_SSD1306_buffered.fcpx
(7.18 KiB) Downloaded 329 times
gLCD_SSD1306.fcpx
(6.68 KiB) Downloaded 332 times
Here is a simple test file I used for the buffered (no read functionality) display you sent over.
SSD1306Test.fcfx
(5.06 KiB) Downloaded 348 times
Let me know if you find anything further and I will investigate for you while I still have the hardware handy. If everything is ok then I'll pop the display back in the post for you.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: UTFT component? perfect for many graphic displays

Post by Benj »

Here is a version of the buffered SSD1306 component but with an I2C interface instead of the more common one way SPI interface.
gLCD_SSD1306_i2c.fcpx
(7.29 KiB) Downloaded 341 times
Let me know how you get on.

User avatar
RobH
Posts: 95
Joined: Wed Sep 11, 2013 7:51 pm
Has thanked: 29 times
Been thanked: 17 times
Contact:

Re: UTFT component? perfect for many graphic displays

Post by RobH »

Benj,

That works for the i2c version but the display runs SLOOOOOOOOOOW. This little GLCD sdoes not send an acknowledgement. Is that something that could be slowing things down?

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: UTFT component? perfect for many graphic displays

Post by Benj »

Hello,

Ok thanks for letting me know. I have used the software I2C CAL to get around the missing Ack signal so this shouldn't be causing any slow down. I have also found a slight optimisation which should speed up the display a little.
gLCD_SSD1306_i2c.fcpx
(7.28 KiB) Downloaded 350 times
One other thing you can try is to overclock the I2C connection. To do this you can try updating the CAL file in your Flowcode v6/CAL/PIC directory with the attached file. Note that this is a bit of a hack so I would recommend making a copy of the original file and only using this to try and speed up the display.
PIC_CAL_I2C.c
(15.76 KiB) Downloaded 338 times
Let me know how you get on.

User avatar
RobH
Posts: 95
Joined: Wed Sep 11, 2013 7:51 pm
Has thanked: 29 times
Been thanked: 17 times
Contact:

Re: UTFT component? perfect for many graphic displays

Post by RobH »

I'll try a different chip (currently on 18f25k50 INTOSC 16mhz) before I go further, but I wanted to give you feedback on the latest files you uploaded.
The GLCD update did nothing to improve speed. Granted, I haven't actually used the i2c pins of this chip, but only other digital pins.


The i2c.c file gave me multiple errors:

C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_I2C.c(240:2): error: unknown identifier 'Nop'
C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_I2C.c(240:2): error: failed to generate expression
C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_I2C.c(242:2): error: unknown identifier 'Nop'
C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_I2C.c(242:2): error: failed to generate expression
C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_I2C.c(264:2): error: unknown identifier 'Nop'
C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_I2C.c(264:2): error: failed to generate expression
C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_I2C.c(266:2): error: unknown identifier 'Nop'
C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_I2C.c(266:2): error: failed to generate expression
C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_I2C.c(268:2): error: unknown identifier 'Nop'
C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_I2C.c(268:2): error: failed to generate expression
C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_I2C.c(291:2): error: unknown identifier 'Nop'
C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_I2C.c(291:2): error: failed to generate expression
C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_I2C.c(293:2): error: unknown identifier 'Nop'
C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_I2C.c(293:2): error: failed to generate expression
C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_I2C.c(327:2): error: unknown identifier 'Nop'
C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_I2C.c(327:2): error: failed to generate expression
C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_I2C.c(329:2): error: unknown identifier 'Nop'
C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_I2C.c(329:2): error: failed to generate expression
C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_I2C.c(334:2): error: unknown identifier 'Nop'
C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_I2C.c(334:2): error: failed to generate expression
C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_I2C.c(336:2): error: unknown identifier 'Nop'
C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_I2C.c(336:2): error: failed to generate expression
C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_I2C.c(372:2): error: unknown identifier 'Nop'
C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_I2C.c(372:2): error: failed to generate expression
C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_I2C.c(376:2): error: unknown identifier 'Nop'
C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_I2C.c(376:2): error: failed to generate expression
C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_I2C.c(381:2): error: unknown identifier 'Nop'
C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_I2C.c(381:2): error: failed to generate expression
C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_I2C.c(391:2): error: unknown identifier 'Nop'
C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_I2C.c(391:2): error: failed to generate expression
C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_I2C.c(393:2): error: unknown identifier 'Nop'
C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_I2C.c(393:2): error: failed to generate expression
.
test1.c success

failure
Completed BoostC compilation, return = 1

C:\Program Files (x86)\Flowcode 6\compilers\pic\boostc\boostc_18F.exe reported error code 1


I'll test it on a different chip now with the original i2c.c file.
*edit*
18f2550 INTOSC 8mhz using SPI pins same speed issue.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: UTFT component? perfect for many graphic displays

Post by Benj »

Hello,

Right this updated C file should hopefully resolve the compile error and allow the display to run faster. It might bring the I2C out of spec but worth a quick go.
PIC_CAL_I2C.c
(15.76 KiB) Downloaded 334 times
The 18F2550 can run up to 48MHz (12MIPs) using the onboard PLL, the faster you can get the oscillator to run the faster the display will operate. At 8MHz the device is operating at roughly 2MIPs.

Let me know how you get on.

User avatar
RobH
Posts: 95
Joined: Wed Sep 11, 2013 7:51 pm
Has thanked: 29 times
Been thanked: 17 times
Contact:

Re: UTFT component? perfect for many graphic displays

Post by RobH »

The latest C file you posted compiled, but the screen shows nothing now. I would be happy to send you one of these little LCDs for tinkering purposes. You can keep it afterwards.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: UTFT component? perfect for many graphic displays

Post by Benj »

Hello Rob,

The section I changed in the file looks like this and is on line 139 and 140.

Code: Select all

		//#define MX_I2C_DELAY	delay_us(1);
		#define MX_I2C_DELAY	nop();
The commented out line is the line from the original file, the line below is a replacement delay for the I2C and instead of waiting 1 micro second it instead waits 1 instruction which may be way too fast for the display to detect.

You could try something like this as a bit of a half way house.

Code: Select all

		//#define MX_I2C_DELAY	delay_us(1);
		#define MX_I2C_DELAY	nop();nop();nop();nop();
You can keep adding the nops until the display fires up and hopefully this will be quicker then it was with the fixed 1us delay.

I will accept a display for testing if you would like to send us one but with it being this close to working well it's really up to you.

User avatar
RobH
Posts: 95
Joined: Wed Sep 11, 2013 7:51 pm
Has thanked: 29 times
Been thanked: 17 times
Contact:

Re: UTFT component? perfect for many graphic displays

Post by RobH »

Code: Select all

      //#define MX_I2C_DELAY   delay_us(1);
      #define MX_I2C_DELAY   nop();nop();
This is as fast as I could get it to work. Here's a video:

http://youtu.be/LoyxRrzoh_w

Here's the fcfx file:
Attachments
glcd_test1.fcfx
(5.26 KiB) Downloaded 302 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: UTFT component? perfect for many graphic displays

Post by Benj »

Hi Rob,

Wow that's still very slow! Are you still running the microcontroller at 8MHz? Might be worth clocking it up to 48MHz by enabling the PLL in the config settings and seeing if you can get it any faster but that is very slow.

Now the way the driver is currently working for each pixel being sent out is like this.

I2C transaction to set XY location.
I2C transaction to set pixel value.

This is what I do for the SPI types of display but SPI can run a lot faster then I2C and has less overhead.

Now there are some options.

1) We dont ever talk to the display until the contents have all been drawn to the local RAM buffer. This might be quite quick but involves redrawing the entire display each time we want to change something.
2) We check to see if the pixel value has changed since the last operation in which case we don't resend the new value, probably won't speed things up too much but pretty easy to do and should help.
3) We try and bundle things like text prints up into bytes so we can send 8 pixels at once rather then 1 at a time but this limits where you can position your text on the display.
4) As with option 1 but we also store the changes since the last redraw making the refresh process more efficient. Heavy on RAM usage.
5) Try and reduce the number of XY position settings by keeping track of where we were and only sending new coords when necessary. Good for things like clear and box drawing.

I'll have a quick crack at options 2 and 5 for you and see if these help at all.

User avatar
RobH
Posts: 95
Joined: Wed Sep 11, 2013 7:51 pm
Has thanked: 29 times
Been thanked: 17 times
Contact:

Re: UTFT component? perfect for many graphic displays

Post by RobH »

As far as I know, the current chip (18F25K50 - I changed it again from the 18F2550) is running at 48mhz... That's another reason I posted the fcfx files for you.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: UTFT component? perfect for many graphic displays

Post by Benj »

Hi Rob,

Right ok no probs, looks like it's down to me then :wink:

Please can you give this a try and see if were making any progress. This has optimisations for the pixel printing and display clearing as reported before in 2 and 5.
gLCD_SSD1306_i2c.fcpx
(7.37 KiB) Downloaded 388 times

Post Reply