Ucglib and Teensy3.1

Status
Not open for further replies.

dustovich

Member
Hello,
I know I am new to the forum, and to programming also. So please bear with me.

Through the research that I have done over the past while, I have grown to like Ucglib (and cousin U8glib), seems to be the most flexible TFT/glcd library. Has better fonts and functions then the adafruit series does from what I have seen and supports a number of controllers within the same library. It works just fine on the Teensy3.1 also (even with hswpi). The question that I have is if it would be possible to transfer some of the SPI optimizations from the ST7735/ILI9XXX tft libraries into Ucglib without much trouble to speed up the library. Im sure olikraus would appreciate the help, looks like he is trying to do this for the due right now.

Link below
https://github.com/olikraus/ucglib

Anybody have any ideas?
 
So you were able to get the Ucglib to work on the 3.1.

Did you have t do anything special to get the hardware SPI to work.

I tested the Hello World.ino on my Teensy 3.1 writing to my IL9341 display, but I did not get anything out.

I am a big fan of Oliver's work and have been using it a lot with Arduino but Arduino just does not seem to have enough horsepower...

Any advice?
 
Taking a fast look you may modify Ucglib.cpp and Ucglib.h files.
There's a lot of compiler preprocessor flags for specific CPU and you need to add the Teesny specific one but you need also to modify some of the existing (ex: defined(__arm__)).
You probably get working easily using native SPI but add the high optimized code that Paul used in ILI9341_t3 it's a challenge since you will need to modify a lot of files and only for Teensy stuff (because it uses CONT,LAST for sequential SPI transfer).
Even DUE code it's not using extended SPI so it's not optimized for speed.
Some display driver chip can use sequential SPI transfer but some other not so it's tricky create an universal driver that cover a lot of TFT.
It can be done but at the end will result in a tons of preprocessor flags and the overall code will grow a lot, I think the best way to go it's add basic Teensy native SPI with SPI transactions and then think about the optimized fast SPI of Paul.
 
Its good that there is some hope to getting ucglib to work with teensy 3.1! Hopefully someone sometime will have an interest in updating it a bit, I wish I had the skills myself. I find it is the best out of all the TFT LCD Libraries that I have came across (Fonts FONTS !!FONTS!!). I have had it work with both of the above displays using the vanilla library. To get it to work I have set all the pins in the constructor to the hw spi pins and it was working just fine. The speed is somewhat abysmal, nothing compared to Paul's optimized libraries (ST7735). You are probably missing the setup of the reset pin, I have found that that is the most important part of getting it to work. I dont have time to test again, but this is from my graphicstest sketch I modified and did have working a while ago.

This constructor for the ST7735 was in my sketch.
Code:
Ucglib_ST7735_18x128x160_HWSPI ucg(/*cd=*/ 9 , /*cs=*/ 10, /*reset=*/ 8);

so for the ILI9341 you could try
Code:
Ucglib_ILI9341_18x240x320_HWSPI ucg(/*cd=*/ 9 , /*cs=*/ 10, /*reset=*/ 8);

And dont forget to line the pins up.

Hopefully that works for ya!
 
Last edited:
Hey,
I just wanted to let you guys know the ili9341 works just fine for me with the ucglib using either SW or HW SPI. I use the following code:
Code:
#include <SPI.h>
#include "Ucglib.h"

#define TFT_MOSI 11
#define TFT_CLK 13
#define TFT_MISO 12
#define TFT_RST 8
#define TFT_DC 9
#define TFT_CS 10

//Ucglib_ILI9341_18x240x320_SWSPI tft(TFT_CLK, TFT_MOSI, TFT_DC , TFT_CS, TFT_RST);
Ucglib_ILI9341_18x240x320_HWSPI tft(TFT_DC , TFT_CS, TFT_RST);

The special teensy optimizations of ili9341_t3 would be nice, but i get more than 10FPS with HW Spi (~2fps with SW SPI) and this should be enough for my use case. I have checked this with the fps example of ucglib.
 
Hello,
I know I am new to the forum, and to programming also. So please bear with me.

Through the research that I have done over the past while, I have grown to like Ucglib (and cousin U8glib), seems to be the most flexible TFT/glcd library. Has better fonts and functions then the adafruit series does from what I have seen and supports a number of controllers within the same library. It works just fine on the Teensy3.1 also (even with hswpi). The question that I have is if it would be possible to transfer some of the SPI optimizations from the ST7735/ILI9XXX tft libraries into Ucglib without much trouble to speed up the library. Im sure olikraus would appreciate the help, looks like he is trying to do this for the due right now.

Link below
https://github.com/olikraus/ucglib

Anybody have any ideas?

Curious: What did you have to change in order to get ucglib to compile for a teensy? As it is it does not compile and I rather not re-invent the wheel.
 
Curious: What did you have to change in order to get ucglib to compile for a teensy? As it is it does not compile and I rather not re-invent the wheel.


Please help...
I'm also having problem, compelling ucglib for a teensy.
Thank you
 
Status
Not open for further replies.
Back
Top