Clearing the display (FT815)

FTDI/Bridgetek EVE2 & EVE3 & EVE4 SPI TFT Series by Matrix Orbital

Moderator: Mods

Post Reply
rascalito
LCD Geek
Posts: 38
Joined: Sat Apr 18, 2020 11:22 pm

Clearing the display (FT815)

Post by rascalito »

Hello!

I'm back to EVE programming after a few months. This time, I'm trying to write my own library
in true C++ (i.e. not a wrapper around an existing lib, but something that fully uses C++ capability.

I'm starting from the programming manual, and I could initialize the display exactly as explained.
It looks like the initialization works. I could also write some widgets, but sometimes the contents of the
screen disappears, so I'm back to simple actions, just to check if it works. Right now I'm debugging
step by step the following code:

Code: Select all

#define	RED		0x00FF0000
#define	GREEN		0x0000FF00
#define	BLUE		0x000000FF

#define	CLEAR_CMD	0x26000000
#define	CLEAR_COL_CMD	0x02000000
#define	CLEAR_COL_INIT	BLUE
#define	DISPLAY_CMD	0
#define	SWAP_CMD	0xFFFFFF01
#define	CLEAR_ALL	0x00000007

//	Instance of the display
EveDisplay SysDisplay;

Initialization: SysDisplay.Init();
At this point, the screen is blue, which seems to indicate there is no problem.

I have defined a clear function like this:

Code: Select all

EveDisplay::Clear(uint32 color) {
	color &= 0x00FFFFFF;	//	Ensure it will not interfere with the command.
	wr32(REG_CMDB_WRITE, CLEAR_COL_CMD + color);
	wr32(REG_CMDB_WRITE, CLEAR_CMD + CLEAR_ALL);
	wr32(REG_CMDB_WRITE, DISPLAY_CMD);
	wr32(REG_CMDB_WRITE, SWAP_CMD);
}
I have also made a test function:

Code: Select all

EveDisplay::Test() {
	Clear(RED);
	Clear(GREEN);
	Clear(BLUE);
}
The problem: it doesn't work! (how did you guess?) After init, I get a uniform blue screen,
which is what I expected. After stepping over Clear(RED), instead of getting a red screen,
I get the screen that I used before setting it to blue. It was a darker blue, like 0x00000080.
And stepping again goes back to bright blue instead of green, and finally to darker blue.
The conclusion of this is that it swaps fine but the color setting commands don't work.
The funny thing is that do the exact same action in the initialization.

NB: I'm aware this code might not work when not running step by step because I guess
clearing the screen takes time and I don't check if it's busy. But I'm using it step by step
only for the time being, and this function will be removed.

By the way, I have just noticed that the programming guide says (point 8 of paragraph
2.3 initialization sequence) that the clock should be less than 30 MHz, and in the code
snippet it says it should be less than 11 MHz. Which one is it?
Well, that said, I'm running at 6.75 MHz, so it shouldn't be the reason.

The only difference with the documentation is that it is using the RAM_DL location and
I'm writing to REG_CMDB_WRITE.

Thanks for any hint!

rascalito
LCD Geek
Posts: 38
Joined: Sat Apr 18, 2020 11:22 pm

Re: Clearing the display (FT815)

Post by rascalito »

Hello!

Sorry for the mess! I reply to my own post, but I found out that the command DLSTART was missing.
Everything works well now. Just in case some might be as silly as me (very unlikely, but just in case),
here is the corrected clear method.

Code: Select all

EveDisplay::Clear(uint32 color) {
	color &= 0x00FFFFFF;	//	Ensure it will not interfere with the command.
	wr32(REG_CMDB_WRITE, CMD_DLSTART);			//	<---- This one was missing
	wr32(REG_CMDB_WRITE, CLEAR_COL_CMD + color);
	wr32(REG_CMDB_WRITE, CLEAR_CMD + CLEAR_ALL);
	wr32(REG_CMDB_WRITE, DISPLAY_CMD);
	wr32(REG_CMDB_WRITE, SWAP_CMD);
}

Henry
OMNIPRESENT
OMNIPRESENT
Posts: 3003
Joined: Tue Aug 14, 2001 6:00 pm
Contact:

Re: Clearing the display (FT815)

Post by Henry »

Thank you for following up and adding to the community!
Henry J.
President
Matrix Orbital

Post Reply