1
Discussion - Software / Re: FT813 initialization
« on: May 22, 2020, 02:47:36 PM »
Rudolph,
Thanks to your code I was able to find the problem in mine.
Thanks to your code I was able to find the problem in mine.
Welcome to the FTDI Community!
Please read our Welcome Note
Technical Support enquires
please contact the team @ FTDI Support
New Bridgetek Community is now open
Please note that we have created the Bridgetek Community to discuss all Bridgetek products e.g. EVE, MCU.
Please follow this link and create a new user account to get started.
Bridgetek Community
#include <SPI.h>
#include "functions.h"
void setup() {
// put your setup code here, to run once:
pinMode(ChipSelectPin, OUTPUT);
pinMode(INT_N, OUTPUT);
pinMode(PD_N, OUTPUT);
digitalWrite(ChipSelectPin, HIGH); //When ChipSelectPin is high you can't communicate with FT81X
digitalWrite(INT_N, HIGH); //deactivate interrupt to host
digitalWrite(PD_N, HIGH); //deactivate Chip power down mode
Serial.begin(9600);
//initialise SPI
SPI.begin();
SPI.setBitOrder(MSBFIRST); //Not strictly needed but just to be sure
SPI.setDataMode(SPI_MODE0); //Not stirctly needed but just to be sure
digitalWrite(PD_N, LOW);
delay(20);
digitalWrite(PD_N, HIGH);
delay(20);
SPI.setClockDivider(SPI_CLOCK_DIV4);
host_command(ACTIVE);
delay(500);
rd8(0x302000);
}
/*
void initialize(){
SPI.setClockDivider(SPI_CLOCK_DIV2);
host_command(CLKEXT);
host_command(ACTIVE);
delay(300);
wr16(REG_HCYCLE, 928);
wr16(REG_HOFFSET, 88);
wr16(REG_HSYNC0, 0);
wr16(REG_HSYNC1, 48);
wr16(REG_VCYCLE, 525);
wr16(REG_VOFFSET, 32);
wr16(REG_VSYNC0, 0);
wr16(REG_VSYNC1, 3);
wr8(REG_SWIZZLE, 0);
wr8(REG_PCLK_POL, 1);
wr8(REG_CSPREAD, 0);
wr16(REG_HSIZE, 480);
wr16(REG_VSIZE, 800);
//CMD_DLSTART; //Set display list address to 0
wr32(RAM_DL + 0, CLEAR_COLOR_RGB(0,0,0)); //CLEAR_COLOR_RGB0,0,0
wr32(RAM_DL + 4, CLEAR(1,1,1));
wr32(RAM_DL + 8, DISPLAY); //DISPLAY
wr8(REG_DLSWAP,0x02); //Send 0x02 because the programming guide says 10 (0x02) is recommended in most cases. Go to REG_DLSWAP for more info.
wr8(REG_GPIO_DIR,0x80);
wr8(REG_GPIO,0x80);
wr8(REG_PCLK,5);
}
*/
bool InitializeTrigger = true; //To trigger initialization once in the beginning
void loop() {
// put your main code here, to run repeatedly:
/*
if( InitializeTrigger == true){
initialize();
InitializeTrigger = false;
}
*/
// CMD_DLSTART; //Set display list address to 0
// wr32(RAM_DL + 0, CLEAR_COLOR_RGB(0,0,255)); //CLEAR_COLOR_RGB0,0,0
//wr32(RAM_DL + 4, CLEAR(1,1,1));
//wr32(RAM_DL + 8, 0x00);
}
#include <SPI.h>
#include "functions.h"
void setup() {
// put your setup code here, to run once:
pinMode(ChipSelectPin, OUTPUT);
pinMode(INT_N, OUTPUT);
pinMode(PD_N, OUTPUT);
digitalWrite(ChipSelectPin, HIGH); //When ChipSelectPin is high you can't communicate with FT81X
digitalWrite(INT_N, HIGH); //deactivate interrupt to host
digitalWrite(PD_N, HIGH); //deactivate Chip power down mode
Serial.begin(9600);
//initialise SPI
SPI.begin();
SPI.setBitOrder(MSBFIRST); //Not strictly needed but just to be sure
SPI.setDataMode(SPI_MODE0); //Not stirctly needed but just to be sure
}
void initialize(){
SPI.setClockDivider(SPI_CLOCK_DIV2);
host_command(CLKEXT);
host_command(ACTIVE);
delay(300);
wr16(REG_HCYCLE, 928);
wr16(REG_HOFFSET, 88);
wr16(REG_HSYNC0, 0);
wr16(REG_HSYNC1, 48);
wr16(REG_VCYCLE, 525);
wr16(REG_VOFFSET, 32);
wr16(REG_VSYNC0, 0);
wr16(REG_VSYNC1, 3);
wr8(REG_SWIZZLE, 0);
wr8(REG_PCLK_POL, 1);
wr8(REG_CSPREAD, 0);
wr16(REG_HSIZE, 480);
wr16(REG_VSIZE, 800);
//CMD_DLSTART; //Set display list address to 0
wr32(RAM_DL + 0, CLEAR_COLOR_RGB(0,0,0)); //CLEAR_COLOR_RGB0,0,0
wr32(RAM_DL + 4, CLEAR(1,1,1));
wr32(RAM_DL + 8, DISPLAY); //DISPLAY
wr8(REG_DLSWAP,0x02); //Send 0x02 because the programming guide says 10 (0x02) is recommended in most cases. Go to REG_DLSWAP for more info.
wr8(REG_GPIO_DIR,0x80);
wr8(REG_GPIO,0x80);
wr8(REG_PCLK,5);
}
bool InitializeTrigger = true; //To trigger initialization once in the beginning
void loop() {
// put your main code here, to run repeatedly:
if( InitializeTrigger == true){
initialize();
InitializeTrigger = false;
}
CMD_DLSTART; //Set display list address to 0
wr32(RAM_DL + 0, CLEAR_COLOR_RGB(0,0,255)); //CLEAR_COLOR_RGB0,0,0
wr32(RAM_DL + 4, CLEAR(1,1,1));
wr32(RAM_DL + 8, 0x00);
}